Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Update fw_patch_jb.py

Lakr63dca4538353
diff --git a/researchs/kernel_fairplay_kexts.md b/researchs/kernel_fairplay_kexts.md
new file mode 100644
index 00000000..16c81a0f
--- /dev/null
+++ b/researchs/kernel_fairplay_kexts.md
@@ -0,0 +1,73 @@
+# FairPlay IOKit Extensions in PCC Kernel
+
+**Kernel:** `kernelcache.release.vphone600` (PCC/cloudOS, vresearch101ap)
+**Total kexts in kernel:** 161
+**FairPlay kexts found:** 2
+
+---
+
+## 1. com.apple.driver.AvpFairPlayDriver
+
+| Field | Value |
+|-------|-------|
+| Path | `/System/Library/Extensions/AvpFairPlayDriver.kext` |
+| Version | 2.9.0 |
+| Executable Size | 2,920 bytes |
+| IOClass | `AvpFairPlayDriver` |
+| IOProviderClass | `AppleVirtIOTransport` |
+| IOUserClientClass | `AvpFairPlayUserClient` |
+| PCI Match | `0x1a08106b` |
+| Dependencies | AppleVirtIO, IOKit, libkern |
+
+**Notes:**
+- Virtualization-specific FairPlay driver — matches on a VirtIO PCI device ID (`0x1a08106b`).
+- Tiny kext (2.9 KB), acts as a paravirtual bridge to the host-side FairPlay backend.
+- Implies the host Virtualization.framework exposes a FairPlay VirtIO device to the guest.
+- Has two IOKit personalities:
+ - `AvpFairPlayDriver` — matches `AppleVirtIOTransport` with `IOVirtIOPrimaryMatch: 0x1a08106b`
+ - `AvpFairPlayDriver Transport` — matches `IOPCIDevice` with `IOPCIPrimaryMatch: 0x1a08106b` (published by `com.apple.driver.AppleVirtIO`)
+
+---
+
+## 2. com.apple.driver.FairPlayIOKit
+
+| Field | Value |
+|-------|-------|
+| Path | `/System/Library/Extensions/FairPlayIOKit.kext` |
+| Version | 72.15.0 |
+| Executable Size | 269,440 bytes |
+| IOClass | `com_apple_driver_FairPlayIOKit` |
+| IOProviderClass | `IOResources` (always-match) |
+| IOUserClientClass | `com_apple_driver_FairPlayIOKitUserClient` |
+| IOMatchCategory | `FairPlayIOKit` |
+| IOProbeScore | 1000 |
+| Dependencies | bsd, **dsep**, iokit, libkern, mach, private, unsupported |
+
+**Notes:**
+- Full FairPlay DRM framework kext (269 KB of code).
+- Matches on `IOResources` — loads unconditionally at boot.
+- Provides FairPlay services to userland via `com_apple_driver_FairPlayIOKitUserClient`.
+- Depends on `com.apple.kpi.dsep` (data-at-rest encryption / DRM subsystem).
+- Copyright 2008–2019 — long-lived Apple DRM component.
+
+---
+
+## String Occurrences
+
+| Pattern | Count |
+|---------|-------|
+| `FairPlay` (case-sensitive) | 139 |
+| `fairplay` (lowercase) | 27 |
+| `com.apple.driver.FairPlayIOKit` | 6 |
+| `com.apple.driver.AvpFairPlayDriver` | 3 |
+
+Lowercase `fairplay` strings include launch constraint labels: `com.apple.fairplayd`, `com.apple.fairplayd.A2`, `com.apple.fairplayd.A2.dev`, `com.apple.fairplayd.G1` — these are userland daemon identifiers referenced in kernel launch constraint plists.
+
+---
+
+## Implications
+
+- Both kexts are present in the non-JB PCC boot kernel and will load at boot.
+- `AvpFairPlayDriver` is the VM-aware component — it bridges FairPlay operations to the host via VirtIO. This is unique to the virtualized (PV=3) environment.
+- `FairPlayIOKit` is the standard iOS FairPlay kext, providing DRM primitives to userland processes (e.g., `fairplayd`, media frameworks).
+- For research purposes, these kexts may need to be patched or neutralized if FairPlay enforcement interferes with instrumentation or custom binaries.
diff --git a/scripts/fw_patch_jb.py b/scripts/fw_patch_jb.py
index a05e763d..680e20bc 100644
--- a/scripts/fw_patch_jb.py
+++ b/scripts/fw_patch_jb.py
@@ -19,18 +19,10 @@ from fw_patch import (
load_firmware,
save_firmware,
)
-from patchers.iboot_jb import IBootJBPatcher
from patchers.kernel_jb import KernelJBPatcher
from patchers.txm_jb import TXMJBPatcher
-def patch_ibss_jb(data):
- p = IBootJBPatcher(data, mode="ibss", label="Loaded iBSS", verbose=True)
- n = p.apply()
- print(f" [+] {n} iBSS JB patches applied dynamically")
- return n > 0
-
-
def patch_kernelcache_jb(data):
kp = KernelJBPatcher(data, verbose=True)
n = kp.apply()
@@ -47,9 +39,7 @@ def patch_txm_jb(data):
COMPONENTS = [
# (name, search_base_is_restore, search_patterns, patch_function, preserve_payp)
- ("iBSS (JB)", True,
- ["Firmware/dfu/iBSS.vresearch101.RELEASE.im4p"],
- patch_ibss_jb, False),
+ # NOTE: iBSS nonce skip removed — nonce is not required for boot.
("TXM (JB)", True,
["Firmware/txm.iphoneos.research.im4p"],
patch_txm_jb, True),