Commit graph

10 commits

Author SHA1 Message Date
Moussa Ouallaf
9bd1a75b2d build(deps): fix pkg-config skew, libusb include, libplist/libirecovery drift
Sync PKGCONFIG_DEPS with Makefile (add libcurl); normalize
<libusb.h> include across 6 files; add compat shims for libplist
2.2/2.3 and libirecovery IRECV_SEND_OPT_DFU_NOTIFY_FINISH; add
pacman/zypper/apk installer branches; drop bogus info->pid read
in path_b_identity.c in favor of irecv_get_mode(). Extend the
mock libirecovery to expose irecv_get_mode() so the mock test
build keeps passing against the new call site. Add Makefile
compile canaries that emit -DTP_PLIST_HAS_MEM_FREE,
-DTP_PLIST_HAS_FMT_ARG, and -DTP_IRECV_HAS_NOTIFY_FINISH plus a
.build-flags diagnostic file consumed by tr4mpass doctor.

Files modified:
- Makefile
- start.sh
- start-helpers.sh
- include/compat/plist_compat.h (new)
- include/compat/libirecovery_compat.h (new)
- include/util/usb_helpers.h
- include/util/plist_helpers.h
- include/exploit/dfu_proto.h
- include/device/device.h
- include/device/usb_dfu.h
- include/activation/activation.h
- include/activation/record.h
- src/bypass/path_b_identity.c
- src/bypass/path_b.c
- src/bypass/path_a_ramdisk.c
- src/activation/session_online.c
- tests/mocks/mock_irecv_sym.c
- .gitignore

Closes: #70, #74, #67, #54, #51, #44, #21, #55, #31, #24, #19
2026-07-17 02:43:53 +02:00
tr4m0ryp
30807c8ef6 feat: real Path A implementation, cert extraction, mock test harness
Converts the Path A pipeline from stubs to a working implementation for
A5-A11 devices, adds real certificate extraction via lockdownd and ECDSA
P-256 signing, and introduces a comprehensive mock-based test suite.

Activation
- cert_extract: lockdownd-backed DeviceCertificate,
  AccountTokenCertificate, UniqueDeviceCertificate with base64 decode
  and CertificateChain array fallback.
- signer: OpenSSL EVP ECDSA P-256 sign/verify with DER-encoded
  signatures plus a test keypair generator.
- record.c: 3 of 6 cert fields now populate from live device data.
  AccountTokenSignature signs when TR4MPASS_SIGNING_KEY is set.
  FairPlayKeyData, RKCData, SepNonce remain documented stubs
  (SEP-blocked per 26.3-vulnerability.md).

Path A bypass
- path_a_ramdisk: iBSS/iBEC/devicetree/trustcache/ramdisk upload via
  libirecovery, reconnect handling between DFU and recovery stages,
  iBoot go/bootx commands, SSH readiness poll.
- path_a_ssh: libssh2 + SCP. Mounts rootfs rw (apfs then hfs), runs
  AMFI patcher, backs up and replaces /usr/libexec/mobileactivationd
  with a user-supplied patched binary, verifies mode.

Build, CLI, config
- Makefile: add libssh2 dependency, split test targets into
  hw-independent (make test) and full mock (make test-mocks).
- env_config + cli_flags: 12 new --flags for ramdisk, SSH, signing
  paths; flags map to TR4MPASS_* env vars. --verbose prints summary.
- start.sh slimmed; helpers extracted to start-helpers.sh.

Test suite (20 to 248 tests)
- Mock framework under tests/mocks/ intercepts libimobiledevice,
  libirecovery, libusb, libssh2, libcurl, plus mobileactivation and
  afc. Staging API in mock_control.h.
- Unit tests per module: cert_extract, signer, ramdisk, SSH jailbreak,
  env_config.
- Integration tests in tests/integration/: 6 Path A E2E scenarios
  (happy path, exploit fail, reconnect timeout, SSH auth fail, SCP
  fail, missing env) and 3 Path B scenarios (identity manipulation
  works, nonce barrier rejection is handled cleanly, signal
  detection). Path B tests verify the tool reports the SEP barrier
  failure rather than misclaiming success.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 17:43:30 +02:00
tr4m0ryp
5b758931ac fix: USB re-enum on retry, Path B iRecovery rewrite, DFU diagnostic, tests
Path A (checkm8):
- Re-enumerate USB handle between exploit retries; prior code reused the
  stale handle after the device reset on a failed attempt, causing
  LIBUSB_ERROR_NO_DEVICE on attempts 2 and 3
- Add USB_RECONNECT_DELAY_USEC (2 s) constant; allocate exploit_ctx_t
  fresh per attempt so cleanup is symmetric with init

Path B (A12+ bypass):
- Replace broken SET_DESCRIPTOR serial write with libirecovery setenv;
  Apple A12+ BootROM always STALLs SET_DESCRIPTOR (LIBUSB_ERROR_PIPE)
- Add step_reboot_to_recovery(): DFU_ABORT -> poll for PID 0x1281
- Add step_reboot_to_normal(): irecv reboot -> poll idevice_get_device_list
- step_session_handshake() now runs after normal-mode reconnect so
  dev->handle is valid; previously called with NULL handle (DFU mode)
- Expand path_b_execute() from 9 to 10 steps

Device / DFU:
- usb_dfu_read_info(): emit specific diagnostic when serial is the bare
  Apple DFU string (CPID=0); includes per-model button-sequence guidance

start.sh:
- DFU branch: derive support status from binary output instead of
  hardcoding SUPPORTED; gate_support() now reachable from DFU path
- parse_device_info(): guard against empty output (binary crash / no
  lockdownd); print actionable advice, set DEV_STATUS=UNSUPPORTED
- WSL: detect missing usbipd and print passthrough guidance after first
  poll timeout
- Arch Linux: replace exit-1 with AUR install instructions

Tests / build:
- Add tests/test_sections.c: DFU serial parsing, chip DB lookup,
  bypass probe logic, retry/reconnect constants (26 tests, no hardware)
- Add `make test` target; test build excludes USB/lockdown modules

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:24:49 +02:00
tr4m0ryp
af8db9836f fix(activation): Use plist_mem_free for plist-allocated strings
Changed free(xml) to plist_mem_free(xml) in path_a.c for correct
deallocation of plist_to_xml output. Updated docstrings in record.h
and plist_helpers.h to document the correct free function.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 03:51:46 +02:00
tr4m0ryp
0a02acd634 fix(activation): Fix AFC service, deletescript return, session mutation
Critical: deletescript now uses com.apple.afc2 for root filesystem
access. deletescript_run returns -1 on errors. session no longer
mutates caller's handshake_response plist. Added plist_mem_free
documentation to activation.h. Fixed version parsing to reject negatives.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 03:32:08 +02:00
tr4m0ryp
412a2718d4 chore: Remove .gitkeep files from populated directories
All directories now contain actual source files, making the
placeholder .gitkeep files unnecessary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 02:58:42 +02:00
tr4m0ryp
6cd54f5272 feat(activation): Replace session protocol placeholders with real data
Updated drmHandshake session implementation with actual protocol
details from go-ios: correct plist command names, HTTP endpoints,
headers, User-Agent string, BasebandWaitCount. Documented online
vs offline paths -- tool uses offline mode per design decision D2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 02:38:59 +02:00
tr4m0ryp
f0eeac6fde feat(activation): Add session protocol, record builder, and deletescript
Three post-exploit modules: drmHandshake session activation protocol
wrapping libimobiledevice, activation record plist builder with device
info fields, and iOS-version-specific deletescript for Setup.app
removal and activation record cleanup via AFC.

Files created:
- include/activation/session.h, src/activation/session.c
- include/activation/record.h, src/activation/record.c
- include/bypass/deletescript.h, src/bypass/deletescript.c

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 02:17:33 +02:00
tr4m0ryp
2d4cba6dc8 feat(activation): Add mobileactivation client with session support
Extended activation client from research_icloud0 with session-mode
activation (iOS 11.2+), deactivation, and activated-state check.
Wraps libimobiledevice mobileactivation API.

Files created:
- include/activation/activation.h
- src/activation/activation.c

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 02:07:02 +02:00
tr4m0ryp
7d3fe3935d Task 001: Project scaffolding
Created directory structure, Makefile, and itr4m.h top-level header.
Build system auto-discovers src/**/*.c via find, uses pkg-config for
library dependencies. Handles missing deps gracefully.

Files created:
- Makefile
- include/itr4m.h
- .gitkeep files in all subdirectories

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 01:52:23 +02:00