Commit Graph

93 Commits

Author SHA1 Message Date
X Sanchez
6a6373a608 🐛 fix platform fusing one error (#180) 2026-03-10 23:01:46 +08:00
Lakr
6d11093152 feat: Add VM manifest system and code clarity improvements
Implement VM configuration manifest system compatible with security-pcc's
VMBundle.Config format, storing VM settings in config.plist.

**Manifest System:**
- Add VPhoneVirtualMachineManifest.swift with security-pcc compatible structure
- Add scripts/vm_manifest.py for manifest generation during vm_new
- Update VPhoneCLI to support --config option with CLI overrides
- Update vm_create.sh to generate config.plist with CPU/memory/screen settings

**Environment Variables:**
- CPU/MEMORY/DISK_SIZE now only used during vm_new (written to manifest)
- boot/boot_dfu automatically read from config.plist
- Remove unused CFW_INPUT variable (overridden by scripts internally)
- Document remaining variables with their usage scope

**Documentation:**
- Update README.md with VM configuration section
- Update docs/README_{zh,ja,ko}.md with translated VM configuration docs
- Update Makefile help output with vm_new options and config.plist usage
- Fix fw_patch_jb description: "dev + JB extensions"
- Fix restore_get_shsh description: "Dump SHSH response from Apple"

**Code Quality:**
- Add VPhoneVirtualMachineRefactored.swift demonstrating code-clarity principles
- Extract 200+ line init into focused configuration methods
- Improve naming: hardwareModel, graphicsConfiguration, soundDevice
- Add BatteryConnectivity enum for magic numbers
- Create research/manifest_and_refactoring_summary.md with full analysis

**Compatibility with security-pcc:**
- Platform type: Fixed vresearch101 (iPhone-only)
- Network: NAT only (no bridging/host-only needed)
- Added: ScreenConfig and SEP storage (iPhone-specific)
- Removed: VirtMesh plugin support (PCC-specific)

docs: add machineIdentifier storage analysis

Research and validate the integration of machineIdentifier into config.plist.

**Findings:**
- security-pcc stores machineIdentifier in config.plist (same approach)
- VZMacAuxiliaryStorage creation is independent of machineIdentifier
- VZMacMachineIdentifier only requires Data representation, not file source
- No binding or validation between components

**Conclusion:**
-  No compatibility issues
-  Matches security-pcc official implementation
-  Proper handling of first-boot creation and data recovery
-  Safe to use

Delete VPhoneVirtualMachineRefactored.swift

refactor: integrate machineIdentifier into config.plist

Move machineIdentifier storage from standalone machineIdentifier.bin file
into the central config.plist manifest for simpler VM configuration.

**Changes:**
- VPhoneVirtualMachineManifest: Remove machineIDFile field
- VPhoneVirtualMachine: Load/create machineIdentifier from manifest
- VPhoneCLI: Remove --machine-id parameter, require --config
- Makefile: Remove --machine-id from boot/boot_dfu targets
- vm_manifest.py: Remove machineIDFile from manifest structure

**Behavior:**
- First boot: Creates machineIdentifier and saves to config.plist
- Subsequent boots: Loads machineIdentifier from config.plist
- Invalid/empty machineIdentifier: Auto-regenerates and updates manifest
- All VM configuration now centralized in single config.plist file

**File cleanup:**
- Move VPhoneVirtualMachineRefactored.swift to research/ as reference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 17:12:13 +08:00
Lakr
7514e10d06 Tidy tweakloader README and adjust table spacing
Convert README header to ATX style and add spacing/blank lines for improved Markdown readability in scripts/tweakloader/README.md. Also adjust spacing in a table row in research/0_binary_patch_comparison.md to correct alignment/formatting.
2026-03-10 12:15:44 +08:00
Felipe Cavalcanti
cd389412ec Add tweakloader to jailbreak install flow (#173) 2026-03-10 11:32:08 +08:00
Felipe Cavalcanti
97f96a86e0 Fix TrollStore Lite install failure handling (#172) 2026-03-10 11:31:42 +08:00
zqxwce
e040c3e422 dtree: Implement device tree patching (#170) 2026-03-10 02:52:21 +08:00
Luke Symons
cb409416af keychain: add remote keychain browser via vphoned (#169)
Co-authored-by: rezk <rezk>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 00:48:04 +08:00
zqxwce
ede318a29b setup_machine: Add missing quotation in send_first_boot_commands (#157) 2026-03-09 13:40:11 +08:00
Huge_Black
76c7c9e513 allow opening symlinks pointing to folders in file manager (#156) 2026-03-09 01:17:20 +08:00
zqxwce
d48ad72fa4 launch_daemons: Readd dropbear back as default in all variants (#155) 2026-03-09 01:17:02 +08:00
zqxwce
48d33b19ef ramdisk_build: Set default value for sudo password to None so prompt would show (#154) 2026-03-08 22:59:42 +08:00
zqxwce
cb709eb1a3 Feature/jb add missing dev capabilities (#150)
* cfw_install_jb: Add debugserver entitlement patching

* cfw_install_jb: Add developer overlay to match cfw_install_dev
2026-03-08 20:36:38 +08:00
Lakr
1888131fc8 Add SSH shell profile setup to JB first-boot script
Create .bashrc and .bash_profile for /var/root so SSH sessions
(both login and non-login) source /var/jb/etc/profile for the
full JB PATH. Adapted from #144 to the new vphone_jb_setup.sh
architecture introduced in #141.

Co-authored-by: McNight <mcnight@mcnight.fr>
2026-03-08 13:01:39 +08:00
Felipe Cavalcanti
32b73cd50b Rework JB finalization: drop dropbear, auto-bootstrap on first boot (#141)
* fix: build

* fix: remove [trusted=yes] from Havoc apt source

The inline [trusted=yes] option can cause issues with Sileo's
source parser. The apt-get calls already use AllowUnauthenticated
flags, making it redundant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: main actor crash in VPhoneControl + IPA extraction failures

VPhoneControl: pending request handlers are @MainActor-isolated closures
but were called from DispatchQueue.global() in the read loop and timeout
handler, causing dispatch_assert_queue_fail crashes. Wrap all
pending.handler() calls in DispatchQueue.main.async.

unarchive: the recent ARCHIVE_EXTRACT_SECURE_* hardening (ef02d50) broke
IPA extraction on iOS because:
- SECURE_NOABSOLUTEPATHS: we set absolute output paths on entries
- SECURE_SYMLINKS: iOS system paths (/var, /tmp) are symlinks
- archive_write_header failures were silently swallowed due to if/else if
  structure, making extraction report success with no files extracted

Fix by keeping only SECURE_NODOTDOT, resolving symlinks in extraction
path, fixing header error handling, removing unnecessary ACL/FFLAGS
flags, and surfacing libarchive errors in the install response.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* remove dropbear SSH daemon from guest

Drop all dropbear setup: LaunchDaemon plist injection, host key
generation, daemon deployment, and SSH availability messages.
Guest communication is handled by vphoned over vsock.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: liblaunch compat stub + automatic JB first-boot setup

liblaunch_compat.dylib: stub exporting _launch_active_user_switch
(missing from PCC VM's libSystem.B.dylib) so procursus binaries
like launchctl can load. Deployed to /cores/, loaded via
DYLD_INSERT_LIBRARIES in LaunchDaemon environment and JB profile.

vphone_jb_setup.sh: first-boot script replacing the SSH-based
cfw_install_jb_post.sh. Runs as a LaunchDaemon on first normal
boot and performs all JB finalization: /var/jb symlink,
prep_bootstrap, markers, Sileo, apt setup, TrollStore Lite.
Idempotent with done marker. Logs to /var/log/vphone_jb_setup.log.

Removes the cfw_install_jb_finalize make target and the entire
SSH/iproxy/sshpass-based post-boot flow from setup_machine.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: update AGENTS.md firmware table, gitignore build artifacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: launchctl wrapper uses absolute path + timeout to prevent hangs

- Use absolute path to launchctl.real instead of relative dirname,
  fixing "not found" when called via /var/jb/bin/launchctl symlink
- Add 5s timeout so launchctl doesn't hang when launchd is
  unresponsive on PCC VMs — always exits 0 for dpkg postinst compat
- Symlink /var/jb/bin/launchctl -> /var/jb/usr/bin/launchctl so both
  paths work (openssh postinst uses the /bin/ path)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: replace liblaunch_compat dylib stub with iosbinpack64 launchctl symlink

Procursus launchctl crashes on PCC VMs due to missing
_launch_active_user_switch symbol. Rather than a custom dylib stub,
simply symlink iosbinpack64's launchctl into /var/jb — it talks to
launchd fine and always exits 0, which is all dpkg scripts need.

- Remove liblaunch_compat.c, its build target, signing, and deployment
- Remove DYLD_INSERT_LIBRARIES from setup script and plist
- Replace launchctl wrapper with symlinks to /iosbinpack64/bin/launchctl
- Both /var/jb/usr/bin/launchctl and /var/jb/bin/launchctl are covered

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 12:54:00 +08:00
Lakr
5921cba2ba Update cfw_install_jb.sh 2026-03-08 02:29:38 +08:00
Lakr
142b651c61 Update cfw_install_jb.sh 2026-03-08 02:27:16 +08:00
Lakr
ef02d50244 Harden libarchive extraction: secure flags for path traversal, NULL pathname guard 2026-03-08 00:48:13 +08:00
Lakr
d4ea43c7db Strip vendored libarchive headers to only the API surface used by unarchive.m 2026-03-08 00:46:46 +08:00
Lakr
ed55716def Clean up libarchive extraction: fix resource leak, rename to vp_ convention 2026-03-08 00:45:45 +08:00
LiBr
b2a17f3cd1 use libarchive (#134) 2026-03-08 00:41:53 +08:00
Lakr
5f525452c1 Remove dead code from PR #127 IPA install feature
- Remove unused installIPAWithTrollStoreLite() and bundleIdentifier(fromIPA:)
  (host only uses built-in installer path now)
- Remove canInstallIPA / ipaInstallUnavailableMessage (redundant with isConnected)
- Inline vp_resolve_ldid_path() trivial wrapper in vphoned_install.m
- Drop tslite_install from host-side timeout table
2026-03-07 23:56:32 +08:00
LiBr
56451c4d53 Merge pull request #127 from lbr77/main
ipa install
2026-03-07 23:51:33 +08:00
Lakr
34e628b494 Update cfw_install_jb_post.sh 2026-03-07 20:08:02 +08:00
Lakr
990b2c4769 Update cfw_install_jb_post.sh 2026-03-07 19:50:49 +08:00
Lakr
46eb61f51d JB finalize: randomize SSH port via iproxy instead of hardcoded 22222
Use pick_random_ssh_port + iproxy to forward a random local port to
guest:22222 for isolation, matching the ramdisk stage pattern.
2026-03-07 19:04:31 +08:00
Lakr
c0fda232e0 Fix marker creation using shell builtin instead of touch
After prep_bootstrap.sh changes the login shell to bash, `touch` is
not available in the remote PATH. Use `: >` (shell builtin) to create
empty marker files without depending on an external binary.
2026-03-07 19:03:18 +08:00
Lakr
9a25b6958c Update setup_machine.sh 2026-03-07 18:40:02 +08:00
Lakr
cfee3ea076 Add JB finalizer script; remove IPA signing UI
Add scripts/cfw_install_jb_post.sh — an idempotent SSH-based finalizer to complete JB bootstrap on a normally-booted vphone (creates /var/jb symlink, fixes ownership, runs prep_bootstrap, creates markers, installs Sileo, and runs apt; requires sshpass). Add Makefile help, .PHONY and target cfw_install_jb_finalize to invoke the script. Remove host-side IPA signing/installing and related UI: delete VPhoneSigner, VPhoneIPAInstaller, VPhoneMenuInstall and remove signer/ipaInstaller fields and menu items/callbacks from the vphone-cli UI (also removed the DevMode enable WIP flow). Misc: minor table/formatting tweaks in AGENTS.md and research docs.
2026-03-07 18:34:49 +08:00
Lakr
048f4c7cc1 docs: fix outdated patch counts, remove process investigation notes
- Update firmware variant table (CLAUDE.md, AGENTS.md): correct patch
  totals to 51/64/126, add VPhoneMenuBattery.swift, setup_venv_linux.sh,
  tail_jb_patch_logs.sh to architecture tree
- kernel_patcher_verification.md: 25→26 patches (patch_apfs_get_dev_by_role)
- kernel_patch_sandbox.py: docstring 16-25→17-26
- kernel_patch_sandbox_hooks: consolidate to single 17-26 validation file
- txm_jb_patches.md: fix txm_jb.py references → txm_dev.py
- 0_binary_patch_comparison.md: split kernel counts (28 base + 59 JB methods)
- kernel_jb_patch_notes.md: add 2026-03-06 retarget notes for bsd_init_auth,
  io_secure_bsd_root, vm_fault_enter_prepare
- Remove 7 boot investigation process notes (boot_*.md)
2026-03-07 18:23:34 +08:00
Lakr
b3ed19232b Update resources 2026-03-07 18:07:46 +08:00
Lakr
b9b462d23f JB install: use external insert_dylib, preserve launchd entitlements, deploy pre-built dylibs
- Replace Python cfw_inject_dylib.py with tyilo/insert_dylib (built by setup_tools)
- Use --weak flag for LC_LOAD_WEAK_DYLIB injection (avoids crash on missing dylib)
- Preserve original launchd entitlements on re-sign (fixes "operation not permitted")
- Deploy dylibs from pre-built basebin payload instead of building from source
- Remove launchdhook, systemhook, treblehook sources (no longer needed)
- Print GDB debug stub port after VM starts
- Cleanup: remove test scripts, rename patch comparison doc
2026-03-07 18:07:27 +08:00
Lakr
73bc732349 Squash JB patch retarget and matcher cleanup 2026-03-06 23:06:32 +08:00
Lakr
fd8e8d184c Squash merge iunctqwiocmfxhigkcunamxoi into main
Included commits:

- f8a54b8 Update JB kernel patch research notes
  Refresh and revalidate jailbreak kernel-patcher documentation and runtime-verification notes. Key updates: re-analyzed B13 (patch_bsd_init_auth) and retargeted recommended site to the FSIOC_KERNEL_ROOTAUTH return check in bsd_init rather than the old ldr/cbz/bl heuristic; clarified preferred NOP-of-CBNZ vs forcing ioctl return. Reworked C21 (patch_cred_label_update_execve) to preserve AMFI exec-time flow and instead clear restrictive csflags in a success-tail trampoline; disabled in default schedule until boot validation. Documented that C23 (patch_hook_cred_label_update_execve) was mis-targeting the wrapper (sub_FFFFFE00093D2CE4) instead of the real hook body (_hook_cred_label_update_execve), explaining boot failures and recommending retargeting. Noted syscallmask and vm_fault matcher problems (patch_syscallmask_apply_to_proc historical hit targeted _profile_syscallmask_destroy; patch_vm_fault_enter_prepare matcher resolves to pmap_lock_phys_page path), and updated the runtime-verification summary with follow-up findings and which methods are temporarily commented out/disabled in the default KernelJBPatcher schedule pending staged re-validation.
- 6ebac65 fix: patch_bsd_init_auth
- 5b224d3 fix: patch_io_secure_bsd_root
- e6806bf docs: update patch notes
- 0d89c5c Retarget vm_fault_enter_prepare jailbreak patch
- 6b9d79b Rework C21 late-exit cred_label patch
- ece8cc0 Clean C21 mov matcher encodings
- ad2ea7c enabled fixed patch_cred_label_update_execve
- c37b6b1 Rebuild syscallmask C22 patch
- 363dd7a Rebuild JB C23 as faithful upstream trampoline
- 129e648 Disable IOUC MACF; rebuild kcall10 & C22 docs
  Re-evaluate and rework several JB kernel patches and docs: mark patch_iouc_failed_macf as reverted/disabled (repo-local, over-broad early-return) and replace its patcher with a no-op implementation to emit zero writes by default; update research notes to explain the reanalysis and rationale. Rebuild patch_kcall10: replace the historical 10-arg design with an ABI-correct syscall-439 cave (target + 7 args -> uint64 return), add a new cave builder and munge32 reuse logic in the kcall10 patcher, and enable the method in KernelJBPatcher group. Clarify syscallmask (C22) semantics in docs: upstream C22 is an all-ones-mask retarget (not a NULL install) and keep the rebuilt all-ones wrapper as the authoritative baseline. Misc: minor refactors and helper additions (chained-pointer helpers, cave size/constants, validation and dry-run safeguards) to improve correctness and alignment with IDA/runtime verification.
- e1b2365 Rebuild kcall10 as ABI-correct syscall cave
- 23090d0 fix patch_iouc_failed_macf
- 0056be2 Normalize formatting in research docs
  Apply whitespace and formatting cleanup across research markdown files for consistency and readability. Adjust table alignment and spacing in 00_patch_comparison_all_variants.md, normalize list/indentation spacing in patch_bsd_init_auth.md and patch_syscallmask_apply_to_proc.md, and add/clean blank lines and minor spacing in patch_kcall10.md. These are non-functional documentation changes only.
2026-03-06 19:08:16 +08:00
Lakr
956642b8ad Update kernel_jb.py 2026-03-06 13:50:25 +08:00
Lakr
d9c93ec703 Harden ramdisk mounts and enforce strict iproxy UDID isolation 2026-03-06 13:38:42 +08:00
Lakr
4c18166be5 Automate JB patch testing workflow and update patch schedules 2026-03-06 13:31:22 +08:00
Lakr
69282a897a Wait for USBMux enumeration before iproxy target resolution 2026-03-06 13:12:26 +08:00
Lakr
40599d461d Fix ramdisk identity mismatch and add USBMux UDID patching 2026-03-06 13:02:25 +08:00
Lakr
b50b630d19 Isolate multi-VM setup with deterministic device targeting 2026-03-06 12:46:12 +08:00
Lakr
e3391d9ea2 Update kernel_jb.py 2026-03-06 03:26:11 +08:00
Lakr
4111b74d7a Refactor patch comparison doc; remove unused import
Reflow and standardize research/00_patch_comparison_all_variants.md: reorganized and simplified tables, normalized headings, clarified Kernel vs JB patch lists, updated ramdisk and CFW matrices, and refreshed aggregate counts (e.g. grand totals and kernel/JB method summaries). Minor formatting and wording improvements throughout the document for readability and consistency. Also removed an unused import (os) from scripts/patchers/kernel_jb.py to clean up the code.
2026-03-06 03:15:42 +08:00
Lakr
5388e0c9c5 Squash merge startup-hang-fix into main
Prefix research patch comparison doc and normalize root markdown names

Rename research root markdown files to scoped topic names
2026-03-06 02:42:12 +08:00
zqxwce
4cdff73e8c Merge pull request #112 from zqxwce/bugfix/debugserver-already-resigned
dev_mode: Fix exit if debugserver already patched
2026-03-06 00:01:58 +08:00
zqxwce
95a457ce30 dev_mode: Patch entitlements for debugserver 2026-03-05 11:59:46 +02:00
Lakr
d62174755f Update testing_exec.sh 2026-03-05 03:07:47 +08:00
Lakr
4669bfbd17 Update testing_exec.sh
Update testing_exec.sh

Update Makefile
2026-03-05 02:57:49 +08:00
Lakr
ba52c2274f skip C22 2026-03-05 02:08:19 +08:00
Lakr
f16a1eed37 squash: merge work-jb-next into main 2026-03-05 01:58:35 +08:00
Lakr
fdc3e28ae3 Squash merge JB kernel runtime optimizations and testing workflow 2026-03-05 00:33:18 +08:00
Lakr
89f0f698af Merge pull request #100 from TastyHeadphones/codex/setup-machine-ramdisk-panic-detect
setup_machine: fail early on ramdisk panic while waiting for SSH
2026-03-04 23:19:19 +08:00