diff --git a/data/meterpreter/aarch64_osx_stage b/data/meterpreter/aarch64_osx_stage new file mode 100755 index 0000000000..8061608948 Binary files /dev/null and b/data/meterpreter/aarch64_osx_stage differ diff --git a/data/meterpreter/x64_osx_stage b/data/meterpreter/x64_osx_stage index cb20b82afb..39640cd5b8 100755 Binary files a/data/meterpreter/x64_osx_stage and b/data/meterpreter/x64_osx_stage differ diff --git a/data/templates/template_aarch64_darwin.bin b/data/templates/template_aarch64_darwin.bin index 7b9b008d23..fe4ddfe32b 100755 Binary files a/data/templates/template_aarch64_darwin.bin and b/data/templates/template_aarch64_darwin.bin differ diff --git a/external/source/shellcode/osx/aarch64/stage_mettle.s b/external/source/shellcode/osx/aarch64/stage_mettle.s index 203bbe57bd..b3c7d05f04 100644 --- a/external/source/shellcode/osx/aarch64/stage_mettle.s +++ b/external/source/shellcode/osx/aarch64/stage_mettle.s @@ -1,5 +1,5 @@ // Compile: clang stage_mettle.s -// Shellcode: objdump -d a.out | cut -d ' ' -f 2-5 | grep -Ev ':|o|^$' | rev | awk '{print "0x"$1$2$3$4","}' +// Shellcode: objdump -d a.out | cut -d ' ' -f 2-5 | cut -d ' ' -f 2- | ruby tools/payloads/format_aarch64.rb .equ SYS_RECVFROM, 0x200001d .equ SYS_MPROTECT, 0x200004a .equ SYS_MMAP, 0x20000c5 @@ -72,7 +72,7 @@ _main: ldr x10, [x10] mov x12, x11 mov x15, x0 - + /* make stack space */ /* mmap(addr=0, length=0x40000, prot=3 (PROT_READ | PROT_WRITE), flags=0x1002 (MAP_PRIVATE | MAP_ANON), fd=0, offset=0) */ mov x0, xzr diff --git a/external/source/shellcode/osx/stager/.gitignore b/external/source/shellcode/osx/stager/.gitignore new file mode 100644 index 0000000000..1d086c3bd3 --- /dev/null +++ b/external/source/shellcode/osx/stager/.gitignore @@ -0,0 +1,4 @@ +x64_osx_stage +x64_osx_stage_debug +aarch64_osx_stage +aarch64_osx_stage_debug diff --git a/external/source/shellcode/osx/template/.gitignore b/external/source/shellcode/osx/template/.gitignore new file mode 100644 index 0000000000..8377e15bc3 --- /dev/null +++ b/external/source/shellcode/osx/template/.gitignore @@ -0,0 +1 @@ +template_aarch64_darwin diff --git a/external/source/shellcode/osx/template/Makefile b/external/source/shellcode/osx/template/Makefile index aabb8e5419..3283781d93 100644 --- a/external/source/shellcode/osx/template/Makefile +++ b/external/source/shellcode/osx/template/Makefile @@ -1,4 +1,20 @@ .PHONY: templates +CFLAGS=-fno-stack-protector -fomit-frame-pointer -fno-exceptions -fPIC -Os -O0 +GCC_BIN_OSX=`xcrun --sdk macosx -f gcc` +GCC_BASE_OSX=$(GCC_BIN_OSX) $(CFLAGS) +GCC_OSX_X64=$(GCC_BASE_OSX) -arch x86_64 +GCC_OSX_AARCH64=$(GCC_BASE_OSX) -arch arm64 + +all: templates + +template_aarch64_darwin: template_aarch64_darwin.c + $(GCC_OSX_AARCH64) -o $@ $^ + strip $@ + templates: template_aarch64_darwin - strip $^ - cp $^ ../../../../../data/$@/$^.bin + +install: templates + cp template_aarch64_darwin ../../../../../data/templates/template_aarch64_darwin.bin + +clean: + rm -f template_aarch64_darwin