Shellcode 1 -> execve(/bin/sh) JMP CALL POP
We will use JMP CALL POP technique to find the address of /bin/sh and make rdi point to it.
Add a null byte after it
RDX needs to point to a place where 8 byte of 0 is there.
RSi needs to point to the address of /bin/sh,0x0000000000000000 instruction
Shellcode becomes:
Note: lea might give an error. In that case, we have to ensure that our shellcode can edit the defined bytes in the text section. If that doesn't happen an alternate is to introduce a null byte with /bin/sh in the defined bytes and finding other ways to make RSI point to the address of /bin/sh followed by 8 bytes of 0s and RDX can be assigned by RAX which is already 0.
Last updated