A simple example of how to manipulate the value of a memory address of another process.
- First off, compile the programs using
gcc
.- Spin up the
target
and get itspid
- Go into
gdb
using thepid
of the targetgdb -p <pid>
- In
gdb
, find the memory address of the variable:p &secret
, and copy it- Finally, run the
injector
with thepid
and the address of the variable:./injector <pid> <address>
This'll only work if the variable is not in the stack or in the register, hence why we're placing it outside of the
main
scope.
Filename | Modified | Size | Type |
---|---|---|---|
[Parent Directory] | - | - | - |
injector.c | 14/02/25 21:5514/02/25 | 1.1 KiB | [Download][Save] |
target.c | 14/02/25 21:1014/02/25 | 222 B | [Download][Save] |