๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

systemhacking5

[Dreamhack] Level1: Return to Shellcode ๐Ÿ›Ž๏ธ Access Exploit Tech: Return to Shellcode์—์„œ ์‹ค์Šตํ•˜๋Š” ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. ๐Ÿ‘พ Exploit Algorithm & Payload ๋”๋ณด๊ธฐ // Name: r2s.c // Compile: gcc -o r2s r2s.c -zexecstack #include #include void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); } int main() { char buf[0x50]; init(); printf("Address of the buf: %p\n", buf); printf("Distance between buf and $rbp: %ld\n", (char*)__builtin_frame_address(0) - buf).. 2023. 8. 30.
[Dreamhack] Level1: basic_exploitation_001 ๐Ÿ›Ž๏ธ Access ์ด ๋ฌธ์ œ๋Š” ์„œ๋ฒ„์—์„œ ์ž‘๋™ํ•˜๊ณ  ์žˆ๋Š” ์„œ๋น„์Šค(basic_exploitation_001)์˜ ๋ฐ”์ด๋„ˆ๋ฆฌ์™€ ์†Œ์Šค ์ฝ”๋“œ๊ฐ€ ์ฃผ์–ด์ง‘๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋žจ์˜ ์ทจ์•ฝ์ ์„ ์ฐพ๊ณ  ์ต์Šคํ”Œ๋กœ์ž‡ํ•ด “flag” ํŒŒ์ผ์„ ์ฝ์œผ์„ธ์š”. “flag” ํŒŒ์ผ์˜ ๋‚ด์šฉ์„ ์›Œ๊ฒŒ์ž„ ์‚ฌ์ดํŠธ์— ์ธ์ฆํ•˜๋ฉด ์ ์ˆ˜๋ฅผ ํš๋“ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ”Œ๋ž˜๊ทธ์˜ ํ˜•์‹์€ DH{…} ์ž…๋‹ˆ๋‹ค. ๐Ÿ‘พ Exploit Algorithm & Payload ๋”๋ณด๊ธฐ #basic_exploitation_001.c #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout,.. 2023. 8. 28.
[Dreamhack] Level2: basic_exploitation_000 ๐Ÿ›Ž๏ธ Access ์ด ๋ฌธ์ œ๋Š” ์„œ๋ฒ„์—์„œ ์ž‘๋™ํ•˜๊ณ  ์žˆ๋Š” ์„œ๋น„์Šค(basic_exploitation_000)์˜ ๋ฐ”์ด๋„ˆ๋ฆฌ์™€ ์†Œ์Šค ์ฝ”๋“œ๊ฐ€ ์ฃผ์–ด์ง‘๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋žจ์˜ ์ทจ์•ฝ์ ์„ ์ฐพ๊ณ  ์ต์Šคํ”Œ๋กœ์ž‡ํ•ด ์…ธ์„ ํš๋“ํ•œ ํ›„, “flag” ํŒŒ์ผ์„ ์ฝ์œผ์„ธ์š”. “flag” ํŒŒ์ผ์˜ ๋‚ด์šฉ์„ ์›Œ๊ฒŒ์ž„ ์‚ฌ์ดํŠธ์— ์ธ์ฆํ•˜๋ฉด ์ ์ˆ˜๋ฅผ ํš๋“ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ”Œ๋ž˜๊ทธ์˜ ํ˜•์‹์€ DH{…} ์ž…๋‹ˆ๋‹ค. ๐Ÿ‘พ Exploit Algorithm & Payload ๋”๋ณด๊ธฐ #basic_exploitaion_000.c #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbu.. 2023. 8. 25.
[Dreamhack] Level2: shell_basic ๐Ÿ›Ž๏ธAccess ์ž…๋ ฅํ•œ ์…ธ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์ด ์„œ๋น„์Šค๋กœ ๋“ฑ๋ก๋˜์–ด ์ž‘๋™ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. main ํ•จ์ˆ˜๊ฐ€ ์•„๋‹Œ ๋‹ค๋ฅธ ํ•จ์ˆ˜๋“ค์€ execve, execveat ์‹œ์Šคํ…œ ์ฝœ์„ ์‚ฌ์šฉํ•˜์ง€ ๋ชปํ•˜๋ฉฐ, ํ’€์ด์™€ ๊ด€๋ จ์ด ์—†์Šต๋‹ˆ๋‹ค. flag ํŒŒ์ผ์˜ ์œ„์น˜์™€ ์ด๋ฆ„์€ /home/shell_basic/flag_name_is_loooooong์ž…๋‹ˆ๋‹ค. ๐Ÿ‘พ Exploit Algorithm & Payload ๋”๋ณด๊ธฐ // Compile: gcc -o shell_basic shell_basic.c -lseccomp // apt install seccomp libseccomp-dev #include #include #include #include #include #include #include #include #include void alarm.. 2023. 8. 22.
๋ฐ˜์‘ํ˜•