Return Oriented Programming
-
PwningCTF/HackCTF 2021. 2. 5. 19:18
Disassembly 디스어셈블리 void main(void) { setvbuf(_reloc.stdout, 0, 2, 0); vuln(); return; } void vuln(void) { char *str; uint32_t var_ch; printf("How many bytes do you want me to read? "); get_n((int32_t)&str, 4); var_ch = atoi(&str); if ((int32_t)var_ch < 0x21) { printf("Ok, sounds good. Give me %u bytes of data!\n", var_ch); get_n((int32_t)&str, var_ch); printf("You said: %s\n", &str); } else { pr..
-
Unexploitable #2CTF/HackCTF 2021. 2. 5. 03:07
Disassembly 디스어셈블리 undefined8 main(void) { char *s; setvbuf(_reloc.stdout, 0, 2, 0); setvbuf(_reloc.stdin, 0, 2, 0); fwrite("Hard RTL ha? You don\'t even have fflush@dynstr!\n", 1, 0x30, _reloc.stdout); fgets(&s, 0x40, _reloc.stdin); return 0; } Unexploitable #1에서 fflush가 사라진 것을 제외하면 같은 문제이다. Return Oriented Programming 이전 문제에서 fflush를 이용하지 않고 해결했기 때문에, 같은 풀이를 사용했다. Code 더보기 from pwn import * bi..
-
[0x41414141 CTF] Return Of The ROPsCTF/WRITEUP 2021. 2. 2. 15:45
Disassembly 디스어셈블리 문제에서 제공하는 파일은 main.sh, PoW, return-of-the-rops로 세 개이다. #!/bin/bash `pwd`/PoW if [ $? == 0 ]; then echo "\n" `pwd`/ret-of-the-rops fi main.sh는 PoW가 통과하면 바이너리를 실행한다. def PoW(res): for x in tqdm(product(ascii_lowercase, repeat=4)): d = "" for i in x: d += i y = md5(d.encode()).digest().hex() if y[-6:] == res: log.info("key : " + d) p.sendline(d) p.recvline() break dest = p.recvli..