분류 전체보기
gdb core 파일이 생성되지 않을 때
core file size가 0이면 생성되지 않는다. [assassin@localhost assassin]$ ulimit -a core file size (blocks) 0 data seg size (kbytes) unlimited file size (blocks) unlimited max locked memory (kbytes) unlimited max memory size (kbytes) unlimited open files 1024 pipe size (512 bytes) 8 stack size (kbytes) 8192 cpu time (seconds) unlimited max user processes 2048 virtual memory (kbytes) unlimited 그러므로 [assassin@..
![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbyeWZF%2FbtrMcQrCpS2%2FhgTZ6PrP20ewXHeOu3OxbK%2Fimg.png)
[lob] giant -> assassin
1. intro 2. code 및 분석 2.1. C code /* The Lord of the BOF : The Fellowship of the BOF - assassin - no stack, no RTL */ #include #include main(int argc, char *argv[]) { char buffer[40]; if(argc < 2){ printf("argv error\n"); exit(0); } if(argv[1][47] == '\xbf') { printf("stack retbayed you!\n"); exit(0); } if(argv[1][47] == '\x40') { printf("library retbayed you, too!!\n"); exit(0); } strcpy(buffer..
9월의 중반에 쓰는 일기.
자체 평가 : ★★★★★ write up 목표는 원활하게 진행하고 있다. 다만 다소 귀찮을 뿐... 솔직히 dreamhack 문제들이 너무 재미있어서 다른 것들을 보기가 싫어진다;;; 더 이상 사용되지 않는 낮은 버전의 os 문제들을 다시 풀어야하나 라는 생각이 많이 들긴 하지만, 목표니까 일단 진행 중. 간혹 도움이 될만한 내용들이 나오긴 하니 그나마 위안된다. CTF 참여는 했지만 하지 않았다. = 한문제도 못풀었다. 어떻게 접근해야할지는 알겠지만, 결국 풀지 못한 문제가 수두룩하다. 아직 경험이 부족해서 그런 것이라 생각하지만... 위축되는 것은 어쩔 수 없나보다. 계속 공부하고 풀어보고 write up을 통해 복기해보는 방법 밖에 없는 듯. 어딘가 조언을 구할만한 사람이 있다면 좋겠는데... 잔여..
![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbN5ZDa%2FbtrMe8jfLuR%2F0kcI7xvyKeEHktgFBmFFEk%2Fimg.png)
[lob] bugbear -> giant
1. intro 2. code 및 분석 2.1 C code /* The Lord of the BOF : The Fellowship of the BOF - giant - RTL2 */ #include #include #include main(int argc, char *argv[]) { char buffer[40]; FILE *fp; char *lib_addr, *execve_offset, *execve_addr; char *ret; if(argc < 2){ printf("argv error\n"); exit(0); } // gain address of execve fp = popen("/usr/bin/ldd /home/giant/assassin | /bin/grep libc | /bin/awk '{pri..
![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fl5y2Q%2FbtrMcPj2TOo%2F8ykwKfNOKXOikCNZEHVDg0%2Fimg.png)
[lob] darkknight -> bugbear
1. intro 2. code 및 분석 2.1 C code /* The Lord of the BOF : The Fellowship of the BOF - bugbear - RTL1 */ #include #include main(int argc, char *argv[]) { char buffer[40]; int i; if(argc < 2){ printf("argv error\n"); exit(0); } if(argv[1][47] == '\xbf') { printf("stack betrayed you!!\n"); exit(0); } strcpy(buffer, argv[1]); printf("%s\n", buffer); } 2.3. 분석 2.3.1. assembler code (중요 부분) 지금까지는 retu..
![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FblvwCs%2FbtrL9YIFbMC%2FbCJojfOqKkea3ej5O2LGSK%2Fimg.png)
[lob] golem -> darkknight
1. intro 2. code 및 분석 2.1 C code /* The Lord of the BOF : The Fellowship of the BOF - darkknight - FPO */ #include #include void problem_child(char *src) { char buffer[40]; strncpy(buffer, src, 41); printf("%s\n", buffer); } main(int argc, char *argv[]) { if(argc
![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbN0r3q%2FbtrL9kEuqRq%2Fv9MBIpzKCttuh2UEp9Koek%2Fimg.png)
[lob] skeleton -> golem
1. intro 2. code 및 분석 2.1 C code /* The Lord of the BOF : The Fellowship of the BOF - golem - stack destroyer */ #include #include extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; if(argc < 2){ printf("argv error\n"); exit(0); } if(argv[1][47] != '\xbf') { printf("stack is still your friend.\n"); exit(0); } strcpy(buffer, argv[1]); printf("%s\n", buffer); // stack de..
House of force
1. 서론 그 유명한 house of series다. libc 2.27 이하에서만 사용 가능하기에 사실 지금에 와서는 쓸 수 없는 기법임에도 불구하고 아직까지 많은 사랑을 받고 있는 듯. 원문은 아래 링크를 참조. https://dl.packetstormsecurity.net/papers/attack/MallocMaleficarum.txt 2. 원리 기본적으로 아래가 가능해야 이 기법을 사용할 수 있다. libc version이 2.27 이하일 것. top chunk size field를 수정할 수 있는 상황. (by overflow or etc) heap allocation size를 마음대로 설정할 수 있는 상황. (가능한 음수값, 물론 양수도 가능.) 공격 구조는 top chunk의 size를 최대..