The curious thing when looking up the environment variable address in gdb

Recently, I have been doing some experimenting with a Return-to-libc attack on paper. Bypassing an unused stack during operation using return-to-libc with my Ubuntu11.10.

Before my experiment, I closed ALSR.

According to the document, I can find the address of the environment variable SHELL = "/ bin / bash" in gdb (use gdb to debug the program I want to attack):

enter image description here
enter image description here

But I found that this address is incorrect when I try to use it for the Return-to-libc experiment.

And then I write a simple program to get the address of the environment variable:

enter image description here

, :

enter image description here

.

question . ( ).

, .

+5
1

, , 32- Intel. , , :

  • , , c. ( x/100s **(char***)&environ).
  • x86-64, , , .
  • 0xBffff47A ( 0xC0000000).

, , :

  • - .
  • GDB . , "_=/usr/bin/gdb" GDB, , , GDB.

, - , , .

+3

All Articles