开发者

Finding the environment variables in assembler

开发者 https://www.devze.com 2023-02-25 18:26 出处:网络
I\'m trying to exploit a buffer overflow for an assignment, and I have to access the environment var开发者_StackOverflow社区iables (read one of them), but I have no clue where to look for them. I\'m u

I'm trying to exploit a buffer overflow for an assignment, and I have to access the environment var开发者_StackOverflow社区iables (read one of them), but I have no clue where to look for them. I'm using gdb to inspect memory, but I just can't find the environment variables.


There's a global variable (char **environ) which should exist in the running executable's symbol table, if that was compiled with the -g option.


I hope that you have found since time. Environment varialbes are stocked on the esp register, by example on my current exercice, I can show the environment variables with this command (starti is for break at the first instruction):

(gdb) starti
(gdb) x/50s $esp+450
0

精彩评论

暂无评论...
验证码 换一张
取 消