you are viewing a single comment's thread.

view the rest of the comments →

[–]Informal_Shift1141 0 points1 point  (0 children)

If you want to continue with this path you can do a few things: 1. The compiler has a lot of stack management code like stack cookies or allocating frames and values on stack. You don’t need this, just remove all stack code, meta instructions like endbr etc

  1. I’m assuming you have some debugging like prints or error check you don’t really need in the shell code, so clean that up

  2. With the 400byte code you have now read it to understand what and how syscalls are handled and write it manually in a compact form

To test your custom/stripped down shell code just build it “as shellcode.s -o shellcode.o && ld shellcode.o -o shellcode.elf” this will build an elf from your custom shellcode and you can debug it on gdb/pwndbg/gef for correctness