보호되어 있는 글입니다.
Introduction file struct 구조를 분석하여 File Stream Oriented Programming에 대해 공부한 내용을 정리하려 한다. Data Structure in File 먼저, file 구조체를 알아야한다. struct _IO_FILE { int _flags; /* High-order word is _IO_MAGIC; rest is flags. */ #define _IO_file_flags _flags /* The following pointers correspond to the C++ streambuf protocol. */ /* Note: Tk uses the _IO_read_ptr and _IO_read_end fields directly. */ char* _IO_rea..
exit()? C에서 exit() 이라는 함수는, 현재의 C프로그램 자체를 완전 종료하는 기능을 가집니다. exit()는 코드에서 직접 선언하여 사용할 수도 있지만, __libc_start_main()에서 main함수를 동작한 이후 마지막 단계에서 호출하기도 합니다. ba0bab➤ disas 0x7ffff7a05ab0 Dump of assembler code for function __libc_start_main: 0x00007ffff7a05ab0 : push r13 0x00007ffff7a05ab2 : push r12 0x00007ffff7a05ab4 : xor eax,eax ... ... ... 0x00007ffff7a05b95 : call rax 0x00007ffff7a05b97 : mov edi,..
#include #include #include int main(void) { char buf[300] = {0}; setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); printf("input: "); read(0, buf, 300); printf(buf); exit(0); } 컴파일 : gcc fsb.c -o fsb -no-pie printf 에서 Format String Bug가 발생한다. Exploit scenario 오프셋 구하기 exit_got를 main으로 돌리는 동시에 libc_start_main leak exit_got를 one_gadget으로 overwrite get shell Exploit flow main으로 다시 가야하는 이유는 첫 번째 fsb..
root@kali:/usr/share/metasploit-framework/tools# ls 이 위치에 많은 tool들이 존재한다. root@kali:/usr/share/metasploit-framework/tools# ./pattern_create.rb 5000Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8Ae9Af0Af1Af2Af3Af4Af5Af6Af7Af8Af9Ag0Ag1Ag2Ag3Ag4Ag5Ag6Ag7Ag8Ag9Ah0Ah1Ah2Ah3Ah4Ah5Ah6Ah7Ah8Ah9Ai0Ai1Ai2Ai..
https://www.lazenca.net/display/TEC/
https://github.com/hyomin-Lee/exploit/blob/master/Hitcon_training/lab5/simplerop.py hitcon training lab5 simplerop 문제이다. 이 문제는 static 컴파일이 되어있어서 GOT overwrite 같은 공격이 불가하다. 따라서 shellcode의 실행으로 sh을 얻을 수 있었다. not stripped 이기때문에 mprotect의 주소를 얻을 수 있었다. NX기법이 걸려있으면 shellcode를 실행 할 수 없다. 하지만 mprotect를 이용해서 bss영역에 실행권한을 부여하면 shellcode를 이용해서 공격할 수 있다.
- 본선가고싶다
- ebp change
- fastbin
- rt_sigreturn
- pwnable.tw
- SQLi
- srop
- TLS
- overflow
- pwnable
- glibc
- 해킹
- heap
- shellcoding
- HackCTF
- hacking
- fastbindup
- oob
- codegate
- stack reusing
- pwable
- FSB
- tcache
- fsop
- exit
- Total
- Today
- Yesterday