execle()也规定了环境。这意味着什么? [英] execle() also specifies the environment. What does that mean?

查看:189
本文介绍了execle()也规定了环境。这意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读了一本书叫黑客:开采的艺术,我碰到这个段落:


  

使用execl的(),现有的环境中使用,但如果你使用execle()
  整个环境可以被指定。如果环境阵列仅仅是
  外壳code作为第一个字符串(用NULL指针终止列表)时,
  只有环境变量将壳code。这使得它的地址容易
  计算。在Linux中,地址将是0xbffffffa,减去的长度
  壳中的环境code,减去执行的名称的长度
  程序。因为此地址将是准确的说,就没有必要为一个NOP雪橇



  1. 这是什么意思,通过指定的环境?


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


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


  4. 如果我用EXECL()函数,而不是execle()可能我没有使用的shell code环境变量?



解决方案

  

他们是怎么通过指定的环境呢?


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


  

分类什么不同环境?


我不完全得到这一个。每个程序都有自己的一套环境变量,仅此而已。


  

为什么环境变量的地址计算,方式(或者更具体地说,为什么基址0xbffffffa)?


由于Linux内核中实现像这样。


  

如果我使用了 EXECL()函数代替 execle()可我没有使用的shell code环境变量?


EXECL()做的不可以让您指定的环境变量,如果这就是你感兴趣的东西。

I am reading a book called "Hacking: The art of exploitation" and I came across this paragraph:

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. What do they mean by specifying the environment?

  2. What classifies different environments?

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

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

解决方案

What do they mean by specifying the environment?

The last argument passed to execle() is an array of char pointers, which contain C strings describing the environment variables the executed program will see. Here is an example.

What classifies different environments?

I don't quite get this one. Each program has its own set of environment variables, that's it.

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

Because the Linux kernel is implemented like so.

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

execl() does not let you specify environment variables, if that's what you're interested in.

这篇关于execle()也规定了环境。这意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆