Pwnable(30)
-
ROP X64 -Dreamhack-
문제의 소스코드는 아래와 같다. #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(30); } int main(int argc, char *argv[]) { char buf[0x40] = {}; initialize(); read(0, buf, 0x400); write(1, buf, sizeof(buf)); return 0; } 보호기법을 확인하고 카나리와 별다른 함수를 호출하지..
2023.03.26 -
Pico CTF -x-sixty-what-
문제의 소스코드는 아래와 같다. #include #include #include #include #include #define BUFFSIZE 64 #define FLAGSIZE 64 void flag() { char buf[FLAGSIZE]; FILE *f = fopen("flag.txt","r"); if (f == NULL) { printf("%s %s", "Please create 'flag.txt' in this directory with your", "own debugging flag.\n"); exit(0); } fgets(buf,FLAGSIZE,f); printf(buf); } void vuln(){ char buf[BUFFSIZE]; gets(buf); } int main(int argc,..
2023.03.24 -
Dreamhack Rao -Stack Buffer Over Flow-
문제의 소스코드는 다음과 같다. #include #include void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); } void get_shell() { char *cmd = "/bin/sh"; char *args[] = {cmd, NULL}; execve(cmd, args, NULL); } int main() { char buf[0x28]; init(); printf("Input: "); scanf("%s", buf); return 0; } scanf 에서 버퍼오버플로우를 일으킬 수 있고 ret 주소를 get_shell 주소로 덮는다면 플래그를 획들 할 수 있게 만든 문제인거 같다. 바로 gef를 통해 패턴을 생성하고 offset 을 구한..
2023.03.24 -
Buffer Over Flow 2 -Pico CTF-
#include #include #include #include #include #define BUFSIZE 100 #define FLAGSIZE 64 void win(unsigned int arg1, unsigned int arg2) { char buf[FLAGSIZE]; FILE *f = fopen("flag.txt","r"); if (f == NULL) { printf("%s %s", "Please create 'flag.txt' in this directory with your", "own debugging flag.\n"); exit(0); } fgets(buf,FLAGSIZE,f); if (arg1 != 0xCAFEF00D) return; if (arg2 != 0xF00DF00D) return..
2023.03.09 -
Clutter Buffer Over Flow
#include #include #define SIZE 0x100 #define GOAL 0xdeadbeef const char* HEADER = " ______________________________________________________________________\n" "|^ ^ ^ ^ ^ ^ |L L L L|^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^|\n" "| ^ ^ ^ ^ ^ ^| L L L | ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |\n" "|^ ^ ^ ^ ^ ^ |L L L L|^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ==================^ ^ ^|\n" "| ^ ^ ^ ..
2023.03.09 -
Dreamhack -off_by_one_001-
#include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(30); } void read_str(char *ptr, int size) { int len; len = read(0, ptr, size); printf("%d", len); ptr[len] = '\0'; } void get_shell() { system("/bin/sh"); } int main() { char name[20];..
2023.03.05