python3 pwntools can't set env for process or gdb

99 views Asked by At

I'm trying to debug some linux system binaries with pwntools and gdb, but I seem to be unable to set my desired environment variables for the process:

from pwn import *
elf = ELF("/usr/bin/su")
gs = 'show environment'
dbg = gdb.debug([elf.path], gdbscript=gs, env={"Z": "AAAA"})
dbg.interactive()

This code spawns the gdb-terminal for me, but during the show environment the desired Z=AAAA does not show up. It seems like the env-argument does not do anything, so maybe my understanding of it might be flawed.

Update: env worked as intended, but the env of gdb are different from the ones of the debugged process. therefore checking /proc//environ shows the right env vars

0

There are 0 answers