profile image

L o a d i n g . . .

Published 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

다음과 같이 컴파일 해준다.

'Hacking > Pwnable' 카테고리의 다른 글

[P4C] pwnable problem writeup1  (0) 2021.04.29
[P4C] Pwnable problem 3 - writeup  (0) 2021.04.27
[P4C] Pwnable problem 1 - writeup  (0) 2021.04.10
[P4C] Pwnable problem 2 - writeup  (0) 2021.04.10
[P4C] Pwnable problem 2  (0) 2021.04.10
복사했습니다!