c - execle() 还指定了环境。这意味着什么?

标签 c linux exec exploit shellcode

我正在读一本名为“黑客:剥削的艺术”的书,我看到了这段话:

With execl(), the existing environment is used, but if you use execle(), the entire environment can be specified. If the environment array is just the shellcode as the first string (with a NULL pointer to terminate the list), the only environment variable will be the shellcode. This makes its address easy to calculate. In Linux, the address will be 0xbffffffa, minus the length of the shellcode in the environment, minus the length of the name of the executed program. Since this address will be exact, there is no need for a NOP sled.

  1. 指定环境是什么意思?

  2. 什么对不同的环境进行分类?

  3. 为什么环境变量的地址是这样计算的(或者更具体地说,为什么基地址是 0xbffffffa)?

  4. 如果我使用 execl() 函数而不是 execle() 函数,我是否可以不使用 shellcode 环境变量?

最佳答案

What do they mean by specifying the environment?

传递给 execle() 的最后一个参数是一个字符指针数组,其中包含描述执行程序将看到的环境变量的 C 字符串。 Here是一个例子。

What classifies different environments?

我不太明白这个。每个程序都有自己的一组环境变量,仅此而已。

Why is the address of the environment variable calculated that way (or more specifically why is the base address 0xbffffffa)?

因为Linux内核是这样实现的。

If I used the execl() function instead of the execle() could I not have used the shellcode environment variable?

execl() 让您指定环境变量,如果您对此感兴趣的话。

关于c - execle() 还指定了环境。这意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16864812/

相关文章:

C : error while writing file using UDP socket

objective-c - 我可以在 iOS 上的 C/Objective-C 中创建内存映射 FILE * 吗?

c - Fgets() 不断跳过第一个字符

linux - 对 txt 文件进行排序,查找重复项,同时打印在其中找到的行

php - 我可以在 PHP 的 Linux 服务器上运行新的 COM ("WScript.Shell")

java - Runtime.exec 和 Android 的问题

c - 处理包含空格的字符数组

linux - 如何在配置文件中查找设置的最后一个实例

c - 在 Linux 上的 C 中,我将如何使用 2 个程序,后者使用 stdout 将文本数据发送到第一个显示的程序?

c - 使用进程通过管道运行命令