############################################################################### # © Gustavo Romero López 2021 - GPLv3 - gustavo@ugr.es # int execve(const char *filename, const char *argv[], const char *envp[]); # al rdi rsi rdx # 0x3b /bin/sh null null # gcc -m64 -nostartfiles 22b.s -o 22b ############################################################################### .text _start: .globl _start push $0x3b # push sys_execve pop %rax # copy 0x3b in al cltd # make rdx = 0 push %rdx # push null pop %rsi # copy null push %rdx # push '\0' mov $0x68732f2f6e69622f,%rcx # '/bin//sh' push %rcx # push '/bin//sh' push %rsp # push '/bin//sh\0' address pop %rdi # copy '/bin//sh\0' address syscall