Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2021-30807 PoC — Apple iPadOS 缓冲区错误漏洞

Source
Associated Vulnerability
Title: Apple iPadOS 缓冲区错误漏洞 (CVE-2021-30807)
Description:A memory corruption issue was addressed with improved memory handling. This issue is fixed in macOS Big Sur 11.5.1, iOS 14.7.1 and iPadOS 14.7.1, watchOS 7.6.1. An application may be able to execute arbitrary code with kernel privileges. Apple is aware of a report that this issue may have been actively exploited.
Description
Exploit for CVE-2021-30807
Readme
Write up is here: https://jsherman212.github.io/2021/11/28/popping_ios14_with_iomfb.html

Exploit for CVE-2021-30807. If you really want to build a jailbreak out
of it, it will require tuning for your device and iOS version because I
have no info leak to use for this.

To tune for A11 and below, use pongo to load xnuspy and build with
`SAMPLING_MEMORY=1 make -B`. This will enable a test that gathers
the memory returned by `kernel_memory_allocate`, sorts those pointers,
then spits out a range. You'll see something like this:

```
sample_kernel_map: 0xffffffe8ebe9c000 [0x10000 bytes from behind]
sample_kernel_map: to add to alloc_averager:
[0xffffffe8ce934000, 0xffffffe8ebf98000],
```

(just ignore the warnings it spits out)

The test is meant to be ran 30 seconds after the device boots.

Inside `alloc_averager.py` is a couple of samples I already ran for
my phones. It takes the average of all the averages of each range.
Create a "samples list" for your device and add the range to it. 
Repeat the test a couple times until you have 5-10 entries in that
list. `alloc_averager.py` will report a success rate for the guess it
generates based on the list. If you like the success rate, take the guess
and replace the value for `GUESSED_OSDATA_BUFFER_PTR` at the top of
`IOMobileFramebufferUserClient.c` with it.

It is very important to not include outliers in this list. After running
the test a couple times you'll likely run into a range that sticks
out from the rest of the ranges you already have.

You will need to find offsets for your device/version to run this test.

First, to find `kernel_memory_allocate`, simply xref
`kernel_memory_allocate: VM is not ready`. When you have the offset
set `kma`'s value to it inside `install_kernel_memory_alloc_hook`.

Second, to isolate the test from the other allocations XNU makes,
I test for a specific return address. That address is inside
`OSData::initWithCapacity`. You can easily find OSData's vtable
by xrefing the string `"OSData"`. The first xref to that string
will be in a function that has an xref to the vtable for OSData::MetaClass.
Right above that vtable is OSData's vtable, and `OSData::initWithCapacity`
is at `+0x78`.

Once you have `OSData::initWithCapacity`, find the only `BL` to
`kernel_memory_allocate` and take the offset of the instruction *right below
it*. Inside `kernel_hooks.c`, use that offset in the only if statement
in the only function in that file.

A12+ will need to use something like Correlium.
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →