【发布时间】:2018-06-23 19:20:05
【问题描述】:
我在http://pwnable.kr/play.php 上做“bof”问题 我下载了“bof”文件。但是当我使用gdb时,它是这样说的:
Starting program: /home/henry/Downloads/bof
/bin/bash: /home/henry/Downloads/bof: Permission denied
/bin/bash: line 0: exec: /home/henry/Downloads/bof: cannot execute: Permission denied
During startup program exited with code 126.
bof.c:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void func(int key){
char overflowme[32];
printf("overflow me : ");
gets(overflowme); // smash me!
if(key == 0xcafebabe){
system("/bin/sh");
}
else{
printf("Nah..\n");
}
}
int main(int argc, char* argv[]){
func(0xdeadbeef);
return 0;
}
【问题讨论】:
-
确保
bof不包含DOS 行尾(例如dos2unix /path/to/bof),然后确保您有执行权限(chmod +x /path/to/bof)。如果您在 Win10 WSL 下使用“Linux”,文件必须位于 WSL 文件系统中。 NTFS 没有 Linux 文件权限的概念。但是,/home/henry/Downloads/bof看起来位于正常的 Linux FHS 位置。