PoC 1.0 #1
@ -2,7 +2,7 @@
|
||||
|
||||
VERSION=${1:-14}
|
||||
OUT=./out
|
||||
LOGIC=3
|
||||
LOGIC=${2}
|
||||
|
||||
mkdir -p $OUT
|
||||
|
||||
@ -39,7 +39,7 @@ clang++ -mmacosx-version-min=$VERSION -o $OUT/libc.dylib -shared c.cc
|
||||
# create our dummy lib first
|
||||
clang++ -mmacosx-version-min=$VERSION -o $OUT/libb.dylib -shared -Wl,-reexport_library out/libc.dylib dummy.cc
|
||||
# build a references libb
|
||||
clang++ -mmacosx-version-min=$VERSION -o $OUT/a -L"./out" -lb a.cc
|
||||
clang++ -mmacosx-version-min=$VERSION -o $OUT/a -L"./out" -Xlinker -no_data_const -lb a.cc
|
||||
|
||||
# extract symbols from a
|
||||
../../macho-go/bin/ios-wrapper pepe -o $OUT/a-fixed -b $OUT/b.bcell --remove-imports --remove-exports --remove-symbol-table $OUT/a
|
||||
@ -68,7 +68,7 @@ clang -fobjc-arc -ObjC -mmacosx-version-min=$VERSION -o $OUT/a -L"./out" -lb a.m
|
||||
../../macho-go/bin/ios-wrapper bcell2header -b $OUT/b.bcell -o $OUT/b.h
|
||||
# build libb with symbols extracted from a
|
||||
clang++ -mmacosx-version-min=$VERSION -o $OUT/libb.dylib -shared -Wl,-reexport_library out/libc.dylib b.cc
|
||||
../../macho-go/bin/ios-wrapper pepe -o $OUT/libb.dylib -b $OUT/libb.bcell --remove-imports --remove-exports --keep-imports _dyld_get_sdk_version --keep-imports _malloc --keep-imports _printf --keep-imports ___stack_chk_guard $OUT/libb.dylib
|
||||
# ../../macho-go/bin/ios-wrapper pepe -o $OUT/libb.dylib -b $OUT/libb.bcell --remove-imports --remove-exports --keep-imports _dyld_get_sdk_version --keep-imports _malloc --keep-imports _printf --keep-imports ___stack_chk_guard $OUT/libb.dylib
|
||||
|
||||
# resign
|
||||
codesign --force --deep -s - $OUT/a-fixed
|
||||
@ -82,10 +82,37 @@ $OUT/a-fixed
|
||||
|
||||
else
|
||||
|
||||
# dummy test build
|
||||
# remove imports test
|
||||
|
||||
clang++ -mmacosx-version-min=$VERSION -o $OUT/libc.dylib -shared c.cc
|
||||
clang++ -mmacosx-version-min=$VERSION -o $OUT/libb.dylib -shared -Wl,-reexport_library out/libc.dylib b.cc
|
||||
clang++ -mmacosx-version-min=$VERSION -o $OUT/a -L"./out" -lb a.cc
|
||||
# test rpath
|
||||
clang++ -mmacosx-version-min=$VERSION -o $OUT/libc.dylib -install_name @rpath/libc.dylib -shared c.cc
|
||||
# linked with libd
|
||||
# with rpath = $OUT
|
||||
clang++ -mmacosx-version-min=$VERSION -Xlinker -no_data_const -o $OUT/a \
|
||||
-rpath ./heheeeekkkkkkk \
|
||||
-rpath $OUT \
|
||||
-rpath ./hehe \
|
||||
-rpath ./haha \
|
||||
$OUT/libc.dylib a.cc \
|
||||
|
||||
|
||||
# extract symbols from a
|
||||
../../macho-go/bin/ios-wrapper pepe -o $OUT/a-fixed -b $OUT/b.bcell -l out/libb.dylib --remove-imports --remove-exports $OUT/a
|
||||
|
||||
# build restoration libb with symbols extracted from a
|
||||
../../macho-go/bin/ios-wrapper bcell2header -b $OUT/b.bcell -o $OUT/b.h
|
||||
clang++ -mmacosx-version-min=$VERSION -o $OUT/libb.dylib -shared b.cc
|
||||
|
||||
# obfuscate libb (bugged)
|
||||
# ../../macho-go/bin/ios-wrapper pepe -o $OUT/libb.dylib -b $OUT/libb.bcell --remove-imports --remove-exports --keep-imports _dyld_get_sdk_version --keep-imports _malloc --keep-imports _printf --keep-imports ___stack_chk_guard $OUT/libb.dylib
|
||||
|
||||
# resign
|
||||
codesign --force --deep -s - $OUT/a-fixed
|
||||
codesign --force --deep -s - $OUT/libb.dylib
|
||||
|
||||
# export OBJC_PRINT_LOAD_METHODS=1
|
||||
# export OBJC_PRINT_CLASS_SETUP=1
|
||||
$OUT/a-fixed
|
||||
# unset OBJC_PRINT_LOAD_METHODS
|
||||
# unset OBJC_PRINT_CLASS_SETUP
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user