edb-debugger
edb-debugger copied to clipboard
Set Environment Variables
I would it if the Environment Viewer plugin could set the environment variables it finds.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Adding new variables would be nice too.
Besides, there is currently no way to set (not just edit) environment variables before execution, execle() style. That would be really handy.
So, I think the way to do this most "correctly" would be do the following:
- allocate a new page in the foreign process, probably by forcing a
mmap
call - copy the existing environment to that page
- modify as needed in the new copy
- set the libc's environment pointer to that new page
Now here's the real question: We know how to do all of the above, but have not had any particular demand for this feature. Do we need an issue for this given that if needed, we know how to do it?
PS: if the new values are in total smaller than the previous ones, then we can just overwrite the stuff in the environment directly.
set the libc's environment pointer to that new page
What if the app isn't using libc, like fasm? Although fasm doesn't check environment, a similar app can still use it.
Good point, we'd probably want to find some pointer which is the most "fundamental" to work with then
To execute the child don't we fork and exec? Can't we call setenv before we exec? I believe we already do this for some environment variables.
On Jan 3, 2017 4:26 PM, "Evan Teran" [email protected] wrote:
Good point, we'd probably want to find some pointer which is the most "fundamental" to work with then
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/eteran/edb-debugger/issues/14#issuecomment-270243130, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIk4R0y0PZApZmpI7qAl6kR_pQXZcchks5rOsr6gaJpZM4LZ4me .
@AaronOpfer yes, we do and that will cover setting environment variables for a process we are about to start. When I first wrote this FR, I was thinking more along the lines of changing the environment of a process that is already running.