crack.c
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
|
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
unsigned int password ;
int main(){
setvbuf(stdout,0,2,0);
char buf[100];
char input[16];
int fd ;
srand(time(NULL));
fd = open("/dev/urandom",0);
read(fd,&password,4);
printf("What your name ? ");
read(0,buf,99);
printf("Hello ,");
printf(buf);
printf("Your password :");
read(0,input,15);
if(atoi(input) != password){
puts("Goodbyte");
}else{
puts("Congrt!!");
system("cat /home/crack/flag");
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4f; text-decoration:none">Colored by Color Scripter
|
보호기법 확인
exploit방법으로는
1. format string bug를 이용해 password에 원하는 값을 삽입해서 두번째 input때 값을 맞추는 방법
2. format string bug로 password의 값을 leak시켜 해당 값을 input으로 넣는 방법
두가지 정도가 있다.
slv.py
아직 문제해결을 못했음.
20번째 줄에 printf(buf)부분에서 format string bug를 이용할 수 있는 부분이 있음
'System > Hitcon training' 카테고리의 다른 글
190421-lab9 (0) | 2019.04.21 |
---|---|
190421-lab8 (0) | 2019.04.21 |
190403-lab6 (0) | 2019.04.03 |
190403-lab5 (0) | 2019.04.03 |
190403-lab4 (0) | 2019.04.03 |