我正在读一本名为“黑客:剥削艺术”的书,我看到了这一段:
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.
>通过指定环境意味着什么?
>什么分类不同的环境?
>为什么环境变量的地址以这种方式计算(或更具体地说为什么是基址0xbffffffa)?
>如果我使用execl()函数而不是execle(),我可以使用shellcode环境变量吗?
解决方法:
What do they mean by specifying the environment?
传递给execle()的最后一个参数是一个char指针数组,它包含描述执行程序将看到的环境变量的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 theexecle()
could I not have used the shellcode environment variable?
execl()不允许您指定环境变量,如果这是您感兴趣的内容.