List soal PWN untuk KSL Seleksi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
//gcc -m32 -mpreferred-stack-boundary=2 -fno-stack-protector -no-pie -fno-builtin -o tumpuk2 soal.c
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
char *pager ="/";
|
|
char *bin = "bin";
|
|
char *sh = "sh";
|
|
char binsh[8];
|
|
|
|
void flag(int y,int w){
|
|
if( y == 0xfacebabe && w == 0xbeefdead)
|
|
system(binsh);
|
|
}
|
|
|
|
void ramuan(int x, char *dest, char *src){
|
|
if( x == 0xdeadbeef )
|
|
strcpy(dest,src);
|
|
}
|
|
|
|
void vuln(){
|
|
char buf[64];
|
|
printf("Masukkan flag : ");
|
|
fflush(stdout);
|
|
gets(buf);
|
|
printf("flag adalah %s\n", buf);
|
|
}
|
|
|
|
int main(){
|
|
vuln();
|
|
}
|