There are two ways to start debugging a process:
- The first and more immediate one, is to make our debugger start the process:
forkandexec. This is what happens when you pass a program name as a parameter togdborstrace. - The other option we have is to dynamically attach our debugger to a running process. This enables process injection.
.
├── inject.c
├── README.md
└── samples # sample applications to inject into
# compile shellcode
nasm -f elf64 -o shellcode.o shellcode.asm
# convert shellcode to C string
./bin2sc.py shellcode.o
# run hello
./hello
# inject shellcode into hello's process
./inject <pid of hello>