text stringlengths 0 1.99k |
|---|
------------------------------------- |
mach_port_t connection: 0x1d07 |
uint32_t selector: 0x0 |
const uint64_t * input: 0x0 |
uint32_t inputCnt: 0x0 |
const void * inputStruct: 0x600001310240 |
size_t inputStructCnt: 0x60 |
uint64_t * output: 0x0 |
uint32_t * outputCnt: 0x16fdfe994 |
void * outputStruct: 0x16fdfe998 |
size_t * outputStructCnt: 0x100068a20 |
Input Struct Hexdump (first 32 bytes): |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
```````````````````````````````````````````````````````````````````````````` |
However, the most handy function I made is iokit_dump. By using this, we |
can gather corpus for fuzzer: |
```````````````````````````````````````````````````````````````````````````` |
(lldb) iokit_dump corpus.bin |
Successfully dumped 96 bytes of inputStruct to 'corpus.bin' |
```````````````````````````````````````````````````````````````````````````` |
====== |
--[ 2.2.5 - Tracer |
============================================================================ |
One more thing. We can also upgrade the previously introduced |
trace_ioserviceopen.py to monitor the IOConnectCallMethod, so we have the |
whole picture of what process opens a connection to which service using |
what type of user client with what selector number, and finally, the proper |
sizes of the arguments. So here it is, the iokit_tracer.py[38]: |
```````````````````````````````````````````````````````````````````````````` |
command script import iokit_tracer.py |
trace_iokit --pid 81203 |
---------------------------------------------------------------- |
PID: 81203 |
EXE PATH: /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder |
SERVICE: AppleAPFSContainer (Connection: 0x21267) |
TYPE: 0 |
SELECTOR: 8 (0x8) |
inputCnt: 0 |
inputStruct: 0x0 |
inputStructCnt: 0 |
output: 0x0 |
outputCnt: 0x0 |
outputStruct: 0x0 |
outputStructCnt: 0x0 |
---------------------------------------------------------------- |
trace_iokit --executable_path --executable_path crims0n -- -arg1 val1 |
---------------------------------------------------------------- |
PID: 8236 | EXE: /Users/karmaz/r/scripts/FUZZER/CRIMS0N/bin/crims0n |
SERVICE: H11ANE (Connection: 0x1a07) | TYPE: 1 |
SELECTOR: 0 (0x0) |
--- INPUT --- |
input Scalars (2 values at 0x600000330020): [0x123, 0x123] |
inputStruct (96 bytes at 0x600002534240): |
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| |
--- OUTPUT --- |
outputCnt: 0 (capacity pointer: 0x16b08e974) |
outputStructCnt: 0 (capacity pointer: 0x104dd8a10) |
```````````````````````````````````````````````````````````````````````````` |
This effectively finishes the runtime mapping part. How do we verify that |
the data we gather through all of these guides is valid, though? |
================ |
--[ 2.3 - Map Verification |
============================================================================ |
Finally, a tool of the trade when it comes down to verification of our |
map. IOVerify[39]. I created it a long time ago as part of my fuzzer. I |
decided to extract the logic of it to make it a separate tool that can be |
used for testing external methods user clients types, matching services, |
etc. Bascially all of the things we learned here. |
I recommend checking out the code. Here is the helper: |
```````````````````````````````````````````````````````````````````````````` |
❯ ./IOVerify -h |
Usage: ./IOVerify -n <name> (-m <method> | -y <spec>) [options] |
Options: |
-n <name> Target driver class name (required). |
-t <type> Connection type (default: 0). |
-m <id> Method selector ID. |
-y <spec> Specify method and buffer sizes in one string. |
Format: "ID: [IN_SCA, IN_STR, OUT_SCA, OUT_STR]" |
Example: -y "0: [0, 96, 0, 96]" |
-p <string> Payload as a string. |
-f <file> File path for payload. |
-b <hex_str> Space-separated hex string payload. |
-i <size> Input buffer size (ignored if -y is used). |
-o <size> Output buffer size (ignored if -y is used). |
-s <value> Scalar input (uint64_t). Can be specified multiple times. |
-S <count> Scalar output count (ignored if -y is used). |
-h Show this help message. |
```````````````````````````````````````````````````````````````````````````` |
And here is the most common usage so we can check if we enumerated properly |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.