Advertisement
Madmouse

delete self and exit all inside elf header code cave

Aug 9th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [bits 64]
  2.  
  3. section .text
  4. global _start
  5.  
  6. org 0x08048000
  7. ehdr:                                  ; Elf64_Ehdr
  8.     db 0x7F, "ELF" ;,2, 1, 1, 0         ;   e_ident
  9.     _start:
  10.     pop rdi
  11.     pop rdi
  12.     push 87
  13.     pop rax
  14.     syscall
  15.     push 60
  16.     pop rax
  17.     syscall
  18.     end:
  19.     times 12-(end-_start) db 0
  20.     dw 2                               ;   e_type
  21.     dw 62                              ;   e_machine
  22.     dd 1                               ;   e_version
  23.     dq _start                          ;   e_entry
  24.     dq phdr - $$                       ;   e_phoff
  25.     dq 0                               ;   e_shoff
  26.     dd 0                               ;   e_flags
  27.     dw ehdrsize                        ;   e_ehsize
  28.     dw phdrsize                        ;   e_phentsize
  29.     dw 1                               ;   e_phnum
  30.     dw 0                               ;   e_shentsize
  31.     dw 0                               ;   e_shnum
  32.     dw 0                               ;   e_shstrndx
  33.     ehdrsize equ $ - ehdr
  34. phdr:                                  ; Elf64_Phdr
  35.     dd 1                               ;   p_type
  36.     dd 7                               ;   p_flags
  37.     dq 0                               ;   p_offset
  38.     dq $$                              ;   p_vaddr
  39.     dq $$                              ;   p_paddr
  40.     dq filesize                        ;   p_filesz
  41.     dq filesize                        ;   p_memsz
  42.     dq 0x1000                          ;   p_align
  43.     phdrsize equ $ - phdr
  44. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  45.  
  46.  
  47.  
  48. filesize equ $ - $$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement