Hacking/Pwnable
[P4C] Pwnable problem 3
h4won
2021. 4. 27. 14:55
1. 문제
#include <stdio.h>
#include <stdlib.h>
void get_shell(){
system("/bin/sh");
}
void welcome(){
printf("Welcome to pwnable world!\n");
}
void main(){
void (*call)() = welcome;
char buf[30];
fgets(buf, 38, stdin);
call();
}
2. 컴파일
gcc -o problem problem.c -fno-stack-protector -fno-pie -mpreferred-stack-boundary=2 -m32
다음과 같이 컴파일 해준다.