Heap
-
heap1 풀이System hacking training/Protostar 2018. 12. 21. 11:57
[heap1.c] #include #include #include #include #include struct internet { int priority; char *name; }; void winner() { printf("and we have a winner @ %d\n", time(NULL)); } int main(int argc, char **argv) { struct internet *i1, *i2, *i3; i1 = malloc(sizeof(struct internet)); i1->priority = 1; i1->name = malloc(8); i2 = malloc(sizeof(struct internet)); i2->priority = 2; i2->name = malloc(8); strcpy..
-
heap0 풀이System hacking training/Protostar 2018. 12. 21. 10:23
[heap0.c] #include #include #include #include #include struct data { char name[64];};struct fp { int (*fp)();};void winner(){ printf("level passed\n");}void nowinner(){ printf("level has not been passed\n");}int main(int argc, char **argv){ struct data *d; struct fp *f; d = malloc(sizeof(struct data)); f = malloc(sizeof(struct fp)); f->fp = nowinner; printf("data is at %p, fp is at %p\n", d, f);..
-
What is heap - part 2System hacking training/Knowledge 2018. 12. 21. 08:22
What is heap part 2! Ref : https://www.youtube.com/watch?v=GiOKJJEXBiU 오늘도 koreangang의 영상을 보고 정리한 글을 공유하려 합니다. 영상이 매우 짜임새있고, 이해하기 쉬워서 heap을 공부하시는 분들이라면 꼭 봤으면 좋겠네요..ㅎㅎ 지난번에는 heap의 구조에 대해 알아봤다면 오늘은 dlmalloc이 메모리를 어떻게 관리하는지에 대해 알아보겠습니다. dlmalloc의 알고리즘 dlmalloc의 할당하고, 해제하는 메커니즘은 크게 두가지로 나눌 수 있는데 boundary tag와 binning이 이에 해당합니다. - chunk의 크기 정보가 chunk의 앞뒤에 저장(boundary tag) - 재사용 가능한 chunk를 크기 단위로 관리(b..
-
What is heap - part1System hacking training/Knowledge 2018. 12. 12. 09:57
What is heap part 1 CTF문제를 풀이함에 있어 전혀 손도 못대는 영역이 heap영역에 대한 취약점을 다룬 문제들이였는데 Koreangang에서 아주 좋은 강의가 올라와서 heap을 처음으로 공부를 해봤습니다. 영상에서도 설명이 되었지만 how2heap을 통해 공부를 시작하려고 하지만 어디서부터 어떻게 시작해야되는지 모르시는 분들에게 정말 필요한 영상인것 같습니다 :) Heap Concept Tutorial#1(for heap exploit) https://www.youtube.com/watch?v=l0GVitgBPf0 이번 글에서는 해당 영상을 토대로 공부를 하면서 정리를 한 것을 포스팅하겠습니다. 제 정리가 보기 불편하고 어렵다면 위의 링크에서 영상을 보고 오시는 것을 추천드립니다. h..
-
gdb-peda에서 heap에 대한 정보 보기tmp/Tip 2018. 11. 19. 00:36
[설치] cd ~/ git clone https://github.com/scwuaptx/Pwngdb.git cp ~/Pwngdb/.gdbinit ~/ [명령어] gdb-peda$ heapinfo gdb-peda$ chunkinfo gdb-peda$ chunkptr 위 명령에뿐만 아니라 아래 링크를 타고 가면 여러가지 heap에 대한 정보를 출력해 낼 수 있는 명령어를 지원한다. Ref : https://github.com/scwuaptx/Pwngdb