memory leak

System Hacking Advanced

[dreamhack] cpp_string

checksec└─# checksec cpp_string[*] '/root/dream/cpp_string/cpp_string' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: No PIE (0x400000)  문제분석//g++ -o cpp_string cpp_string.cpp#include #include #include #include #include char readbuffer[64] = {0, };char flag[64] = {0, };std::string writebuffer;int read_file(){ std::ifstrea..

System Hacking Advanced

[dreamhack] _IO_FILE Arbitrary Address Read

개념정리파일을 읽고 쓰는 과정은 라이브러리 함수 내부에서 파일 구조체의 포인터와 값을 이용한다. 파일 구조체를 조작해 임의의 메모리를 읽는 취약점에 대해 알아볼 것이다. 취약점에 대해 소개하기 전에 파일 쓰기 과정이 어떤 함수와 로직을 통해 진행되는지 분석해보자. 파일에 데이터를 쓰기 위한 함수는 대표적으로 fwrite, fputs가 있다. 해당 함수는 라이브러리 내부에서 _IO_sputn 함수를 호출한다. ○ _IO_XSPUTN#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN (__fp, __s, __n)_IO_size_t_IO_new_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n){ ... if (to_do + ..

System Hacking Advanced

[dreamhack] Return to Shellcode

checksec└─# checksec r2s[*] '/root/dream/rts/r2s' Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX disabled PIE: PIE enabled RWX: Has RWX segmentsNX 보호기법이 적용되지 않았다. 따라서 쉘코드를 이용한 공격이 가능하다. 문제분석 & 풀이int main() { char buf[0x50]; init(); printf("Address of the buf: %p\n", buf); printf("Distance between buf and $rbp: %ld\n",(char*)__bu..

System Hacking Advanced

[dreamhack] ssp_001

SSP(Stack Smashing Protector) SSP(Stack Smashing Protector)SSP는 BOF를 방어하기 위한 보호기법 중 하나로 함수를 실행할 때, canary라는 랜덤 값을 스택에 추가하여 BOF로 스택 데이터가 변조됐는지 확인하는 방법이다. canary가 변조된 경우는 스택 데이터가keyme2003.tistory.com #include #include #include #include void get_shell() { system("/bin/sh");}void print_box(unsigned char *box, int idx) { printf("Element of index %d is : %02x\n", idx, box[idx]);}void menu() { ..

keyme
'memory leak' 태그의 글 목록