
[pwnable] bof
2022. 5. 18. 22:25
Pwnable
bof - 5 pt [writeup] ๋ณธ๊ฒฉ์ ์ผ๋ก ๋ฌธ์ ๋ฅผ ํ๊ธฐ ์ ์ wget์ ์ฌ์ฉํด์ bofํ์ผ๊ณผ bof.cํ์ผ์ ๋ค์ด๋ฐ์์คฌ๋ค. bof.c ํ์ผ์ ํ์ธํด๋ดค๋ค. #include #include #include void func(int key){ char overflowme[32]; printf("overflow me : "); gets(overflowme);// smash me! if(key == 0xcafebabe){ system("/bin/sh"); } else{ printf("Nah..\n"); } } int main(int argc, char* argv[]){ func(0xdeadbeef); return 0; } overflowme๋ผ๋ charํ ๋ฐฐ์ด์ด ์ ์ธ๋์ด์๊ณ , gets๋ฅผ ์ฌ์ฉํด์ overfl..

[pwnable] shellshock
2022. 5. 18. 20:29
Pwnable
shellshock - 1 pt [writeup] shellshock์ ๋ํ ๊ฐ๋
๊ณผ ์๋ฆฌ๋ฅผ ๋จผ์ ์์๋ณด์. shellshock (CVE-2014-6271) ์ถ์ฒ https://baobob1024.tistory.com/42 : GNU bash shell์์ ํ๊ฒฝ๋ณ์๋ฅผ ํตํด ๊ณต๊ฒฉ์๊ฐ ์๊ฒฉ์ผ๋ก ๋ช
๋ น์ด๋ฅผ ์คํํ ์ ์๋ ์ทจ์ฝ์ ๊ฐ๋จํ ๋ช
๋ น์ด๋ง์ผ๋ก ์์คํ
์ ์ฅ์
ํ ์ ์์ด shellshock์ทจ์ฝ์ ์ CVSS ๋ฑ๊ธ 10์ ์ ๋ฐ์๋ค. โท ํจ์์ฒ๋ผ ๋ณด์ด๋ ๋ณ์(ํ๊ฒฝ๋ณ์)๋ฅผ ์ ์ํ ๋ ๋ฐ์ํ๋ ์ทจ์ฝ์ ํ๊ฒฝ๋ณ์์ ํจ์๋ฅผ ์ ์ํ๋ ๋ฐฉ๋ฒ $ x() { echo abcd; } ์์ ์ฌ์ง๊ณผ ๊ฐ์ด export์ -f(function) ์ต์
์ผ๋ก ํ๊ฒฝ๋ณ์์ ํจ์๋ฅผ ๋ฑ๋กํ๊ณ ํจ์(x)๋ฅผ ํธ์ถํ๋ฉด ํจ์ ์์ ๋ด์ฉ์ ํ์ธํ ์ ์๋ค. sh..

[pwnable] leg
2022. 5. 6. 16:35
Pwnable
leg - 2 pt [writeup] ssh leg@pwnable.kr -p2222 (pw:guest)๋ฅผ ํตํด ์ ์์ ์ฑ๊ณตํ๋ค. ls -al ๋ช
๋ น์ด๋ฅผ ํตํด์ ์กด์ฌํ๋ ๋ชจ๋ ํ์ผ๋ค๊ณผ ๋๋ ํ ๋ฆฌ๋ค์ ์ถ๋ ฅํด์ฃผ์๋ค. ์ฐ์ ๋ฌธ์ ์์ ์ฃผ์ด์ง leg.c๋ฅผ ํ์ธํด์ฃผ์๋ค. #include #include int key1(){ asm("mov r3, pc\n"); } int key2(){ asm( "push{r6}\n" "addr6, pc, $1\n" "bxr6\n" ".code 16\n" "movr3, pc\n" "addr3, $0x4\n" "push{r3}\n" "pop{pc}\n" ".code32\n" "pop{r6}\n" ); } int key3(){ asm("mov r3, lr\n"); } int main(){ i..

[pwnable] fd
2022. 5. 4. 13:57
Pwnable
fd - 1 pt [writeup] ssh fd@pwnable.kr -p2222๋ผ๊ณ ์
๋ ฅํ์ฌ ์ ์์ ์ฑ๊ณตํ๋ค. (pw : guest) ls -al์ ํตํด ๋ชจ๋ ํ์ผ๊ณผ ๋๋ ํ ๋ฆฌ๋ฅผ ์ถ๋ ฅํด์ฃผ์๋ค. flag๋ฅผ ํ์ธํ ์ ์์ผ๋ ํ์ฌ id(fd)์ flag์ id(fd_pwn)์ด ๋ฌ๋ผ์ ๊ถํ์ด ์๊ธฐ ๋๋ฌธ์ ๋น์ฅ์ ํ์ธ์ ๋ชปํ๋ค. fd.c๋ฅผ ํ์ธํด๋ดค๋ค. ์ฝ๋๋ฅผ ์ดํด๋ณด์ char buf[32]; 32ํฌ๊ธฐ์ ๋ฌธ์ํ ๋ฐฐ์ด buf๋ฅผ ์ ์ธ if(argc

[pwnable] File Descriptor
2022. 5. 4. 11:46
Pwnable
File Descriptor (FD) ์ถ์ฒ https://dev-ahn.tistory.com/96 https://twofootdog.tistory.com/51 ํ์ผ ๋์คํฌ๋ฆฝํฐ - ์์คํ
์ผ๋ก๋ถํฐ ํ ๋น ๋ฐ์ ํ์ผ์ ๋ํํ๋ 0์ด ์๋ ์ ์ ๊ฐ - ํ๋ก์ธ์ค์์ ์ด๋ฆฐ ํ์ผ์ ๋ชฉ๋ก์ ๊ด๋ฆฌํ๋ ํ
์ด๋ธ์ ์ธ๋ฑ์ค ์ ๋์ค ์์คํ
์์ ํ๋ก์ธ์ค๊ฐ ํ์ผ๋ค์ ์ ๊ทผํ ๋์ file descriptor๋ผ๋ ๊ฐ๋
์ ์ด์ฉ file descriptor๋ ์์๊ฐ ์๋ 0๊ณผ ์์์ธ ์ ์ ๊ฐ์ ๊ฐ๋๋ค. ํ๋ก์ธ์ค ์คํ ์ค์ ํ์ผ์ openํ๋ฉด ์ปค๋์ ํด๋น ํ๋ก์ธ์ค์ ํ์ผ ๋์คํฌ๋ฆฝํฐ ์ซ์ ์ค์ ์ฌ์ฉํ์ง ์๋ ๊ฐ์ฅ ์์ ๊ฐ์ ํ ๋นํด์ค๋ค. ๊ทธ ๋ค์ ํ๋ก์ธ์ค๊ฐ ์ด๋ ค์๋ ํ์ผ์ ์์คํ
์ฝ์ ์ด์ฉํด์ ์ ๊ทผ ํ ๋, FD ๊ฐ์ ์ด์ฉํด ํ์ผ์ ์ง์นญ ํ๋ก๊ทธ๋จ..