목록CTF (20)
hOwDayS 선린 10720
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596from pwn import *import string#log = getLogger(__name__)fini_arry = 0x8049f0ccontext.terminal = ['gnome-terminal','-x','sh','-c'] e= ELF("./shellcoding") flag = '' while 1: include = False for i in string.printable:..
소개 대회기간때 Leak만하고 익스하는 법을 몰라 몇시간 동안 잡다가 롸업보고 풀었는데새로운 기법을 터득했다( __IO_2_1_stdin_) 보호 기법 RELRO FULL RELROStack CanaryCanary Found NX NX enabled PIE NO PIE 분석 바이너리 그대로 보면 ccloud() -> 익스 leak() -> 릭 Leak 1. leak()함수에 들어감 2. libc릭 할 수 있을 만큼 채운다 ( ret뒤에 바로 있다 ){ 카나리는 무시한다(익스 할때 필요 없음) } Exploit ccloud()에 들어감 여기서 는 계속 malloc , free 가 되서 힙익스도 할 수가 없다 *((byte *)buf + size -1)를 한다 예를들어 0x7ffff7dd1918 를 덮고싶을..
소개 오랜만에 작성한다UAF문제나오면 잘 몰라서 멍때렸다이 문제가 UAF기법에서 아주 좋은 문제 같다. 보호 기법 RELRO Partial RELROStack CanaryCanary Found NXNX Enabled PIENO PIE 분석 1. 생성 2. 수정Edit 할때 ptr를 만들어 ptr(전역변수) 유무 확인 후정보입력하고 적용할 것인지 확인를 한다. 3. 하나 출력 4. 모두 출력 Vulnerable 취약점은 Edit에서 발견 할 수있다. 정보 입력하고 n을 누른다 (ptr에 0을 안넣고 free만 한다.) 그리고 1번을 눌러 새로운 CAT을 만들면 전 ptr이 있던 위치에 할당한다 --> UAF Leak 1. Create New cat (any content) ( idx : 0) 2. Edit..
소개 unsorted bin으로 leak하는 문제fastbin duplicate , unsafe_unlink로 둘중 하나로쉽게 fastbin_dup으로 풀었다 보호 기법 RELRO Partial RELRO Stack Canary No Canary NX NX Enabled PIE No PIE 분석 1. AddNote - malloc으로 할 당 (할당시 초기화 안함) 2.DeleteNote - Free(index n) 3.ViewNote - idx를 골라서 출력 좀 특이한게 있다면 배열에서 빈부분을 채워 주는 게 아니라 배열 수를 저장하는 변수를 선언한다음 AddNote : +1DeleteNote : -1 릭 , 익스 어렵게 짜면 인덱스 구별하기 어려워진다;; Leak 릭 정말쉽다. 1. Allocate s..
소개 고등학교 모의고사(망쳤다;;)끝나고 저번과 같이 문제를 하나 더 풀어서 써보도록 한다...TRUSTCTF문제보호 기법 RELRO FULL RELROStack Canary No Canary NX NX Enabled PIE No PIE 분석 저렇게 되는데 scan_int함수에서 바로 취약점이 보여서 2 , 3 , 4 메뉴를 볼 필요가 없었다 read에서 buf가 원래 크기보다 더 크게 받으므로 이걸로 Leak , exploit 할 수 있다. Leak 처음에 입력받을때 바로 릭할 수 있다. 1. Leak libc_base , using puts 2. return to main Exploit 릭하고 메뉴로 왔으니 처음 입력받을 때 익스 할 수 있다. 1. overwrite ret to oneshot 익스할..
소개 fastbin dup문제.unsorted bin 문제.realloc을 사용한 leak문제. 보호 기법 RELRO FULL RELRO Stack CanaryCanary Found NX NX Enabled PIE PIE Enabled 분석 Modified 에서 calloc만 출력 Leak 1. Allocate smallbin (malloc 0) (0x108) 2. Allocate fastbin (malloc 1) (0x28) 3. Realloc malloc 0 인 bin 을 malloc 1 bin에게 영향을 줄 수 있도록 재할당. -> 원래 있던곳을 free하고 다른 곳에 재할 당 됨->원래 있던 위치의 fd , bk 에 main_arena + 88 들어감 4. Allocate fastbin (call..
소개 디미고에서 CTF한다는 소식을 나중에 알고(주변 이쪽분야 지인이 없다...) 참가했는데 포너블 풀다가 끄적끄적 한문제 적어본다..보호 기법 RELRO Partial RELROStack Canary No Canary NX NX enabled PIE No Pie 분석 메뉴 fight trainning winner winner 함수에 read에서 취약점이 생기므로 winner를 실행시키긴 위해선 trainning을 통해 power를 800을 넘기면 된다 Leak Leak libc , using puts_got Exploit 1. write /bin/sh on bss 2. overwrite read_got to system 3. run read_plt Exploit Code 서버 환경에 맞추기위해 s.re..
소개 how2heap으로 unsorted bin , fastbin 을 공부하고 관련 문제가 있다고 하길래 찾아서 다른 분들의 Write-up을 참고하여 풀어 보았다. 보호 기법 RELRO FULL RELROStack Canary Canary Found NX NX Enabled PIE PIE Enabled 분석 1.Allocate- Size :-> Result { Allocate (calloc) index n (n은 index 번호) }2.Fill- index :- (Vulnerable!) Size : - Content : 3.Free- index : 4. Dump- index : -> Result { print content of index n }5. Exit-> ExitLeak Leak은 2번 Fill..
대회에 참가했을 당시 포너블 할 줄 몰라서 못풀었는데 최근 포너블 공부하면서 CTF문제 찾다가 ROOTCTF가 떠올라 풀게 되었다 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687from pwn import * #p = remote("222.110.147.52",6975)p = process("./sandbag")e = ELF("./sandbag")libc = ELF("/lib/i386-linux-gnu/libc.so.6") pr = 0x8048f66pppr =..
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 s = process("./BaskinRobins31")e = ELF("./BaskinRobins31") write_plt = e.plt["write"]write_got = e.got["write"] read_plt = e.plt["read"]read_got = e.got["read"] pop3 = 0x40087a #pop rdi , rsi , rdxpop_rdi = 0x400bc3 system_offset = 0x45390read_offset = 0xf7250 bss = 0x602100 # ..