I am trying to do an exploit, which spawns a shell, the shellcode is inside an environment variable and I launch the program or GDB with a clean environment so the variable is at the top.
env -i MYVAR=10 gdb ./prog
The thing is, inside GDB there are variables called COLUMNS and LINES and removing them using:
unset env COLUMNS
unset env LINES
and then printing the env with:
x/20s *((char **)environ)
Still produces an output where those variables are visible and with the same addresses. I know I have deleted them because using
show env COLUMNS
Produces an error stating that the variable is not defined.
How can I show the newly updated environment without those that have been deleted?
My goal is finding the address of MYVAR outside of GDB, but I cannot tamper with the program, so by replicating the environment inside GDB without the variables set by it I can get the address.
Thank you, Josh