ii4gsp
OverTheWire - Narnia0 본문
#include <stdio.h>
#include <stdlib.h>
int main(){
long val=0x41414141;
char buf[20];
printf("Correct val's value from 0x41414141 -> 0xdeadbeef!\n");
printf("Here is your chance: ");
scanf("%24s",&buf);
printf("buf: %s\n",buf);
printf("val: 0x%08x\n",val);
if(val==0xdeadbeef){
setreuid(geteuid(),geteuid());
system("/bin/sh");
}
else {
printf("WAY OFF!!!!\n");
exit(1);
}
return 0;
}
val이 0xdeadbeef면 쉘을 실행시킨다.
scanf()함수에서 취약점이 발생한다.
narnia1 = efeidiedae
'시스템 해킹 > OverTheWire - Narnia' 카테고리의 다른 글
OverTheWire - Narnia2 (0) | 2020.02.22 |
---|---|
OverTheWire - Narnia1 (0) | 2020.02.22 |
Comments