Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Fix Xcode installation persona lookup on iOS 27 guests

Chenx Dust15a5af7e9d1b
diff --git a/Research/0_binary_patch_comparison.md b/Research/0_binary_patch_comparison.md
index 08e2bc66..65ea5740 100644
--- a/Research/0_binary_patch_comparison.md
+++ b/Research/0_binary_patch_comparison.md
@@ -2788,3 +2788,21 @@ DeviceTree are also in Preboot and could follow the same path later.
## Optional Settings row hiding (WIP, 2026-10-07)
Two standard-blocked declarations hide Apple Account, Game Center, iCloud and Wallet in Preferences (`system-preferences-exp-root_rows`) and Software Update in GeneralSettingsUI (`dyld-exp-settings_software_update_row`). Native discovery is restricted to reviewed 24A435 inputs. The installer uses pristine executable backups and cache undo records with page re-attestation. All five rows passed guest rollback, reapplication and reboot checks. See [research report](Guest/2026-10-07_reverse-settings-rows-report.md). Broader firmware coverage and bundled deployment remain WIP; no kernel/SEP or runtime hook changes are included.
+
+## CoreDevice install proxy persona lookup (2026-10-07)
+
+`system-installcoordination_proxy-cfw-persona_lookup` is an iOS-27 guest
+compatibility patch, enabled in standard. Its root-owned marker
+`/usr/lib/vphone-installcoordination-persona-lookup` enables the existing
+launchd hook to allow only the system `installcoordination_proxy`, verified by
+executable path, signing identifier and kernel-validated audit token, to look
+up `com.apple.mobile.usermanagerd.xpc`. Other requests retain their original
+sandbox check. Disabling the patch removes the marker. Both CFW install and
+environment update reconcile its receipt. No kernel or proxy binary patch is
+needed; an experimental entitlement-only version is restored from backup.
+
+The original failure is a Protobox mach-lookup denial before UserManager's
+persona-fetch authorization. Adding a temporary exception entitlement was
+verified ineffective on the running guest and has been removed. IDA analysis
+of this guest's launchd confirms the bootstrap lookup gate and name filters
+2, 3 and 12. See [evidence, implementation and validation](Guest/ios27_xcode_persona_lookup.md).
diff --git a/Research/Guest/ios27_xcode_persona_lookup.md b/Research/Guest/ios27_xcode_persona_lookup.md
new file mode 100644
index 00000000..4a7927b8
--- /dev/null
+++ b/Research/Guest/ios27_xcode_persona_lookup.md
@@ -0,0 +1,83 @@
+# Xcode installation and UserManager on the iOS 27 hybrid guest
+
+Environment: pcc-research-01; iOS 27.0.1 (24A446), cloudOS 26.4 (23E5207q);
+Xcode 27.0 (27A266a). Investigated 2026-10-07.
+
+## Evidence
+
+Xcode Run failed with CoreDevice 3002, MIInstallerErrorDomain 4 (empty persona
+list) and NSCocoaErrorDomain 4099. The corresponding guest log was:
+
+```
+Protobox: installcoordination_proxy(404) deny(1) mach-lookup com.apple.mobile.usermanagerd.xpc
+```
+
+UserManager was running; the proxy already carried
+`com.apple.usermanagerd.persona.fetch`. The same EasyTier.app installed through
+ideviceinstaller and launched successfully. That legacy entry point uses
+mobile_installation_proxy/installd and does not test CoreDevice's preceding
+installation-coordination persona lookup. The failure was not evidence of a
+missing persona database, app provisioning failure or UserManager crash.
+
+An initial experiment appended the one UserManager mach-lookup exception to
+the proxy's entitlements and deployed it. Reading the live binary confirmed
+the entitlement was present, but Xcode still generated the identical Protobox
+denial. It is therefore insufficient for this platform profile, consistent
+with the independently investigated Control Center volume service failure in
+[ios27_cc_volume_sandbox.md](ios27_cc_volume_sandbox.md).
+
+## IDA analysis
+
+Analyzed the guest's actual `/sbin/launchd` with IDA MCP. Its
+`_sandbox_check_by_audit_token` import stub is at `0x10005e404`.
+`sub_100037028` at `0x100037028` calls it with `mach-lookup` and the service
+name; the code selects name filter 3, 2 or 12 according to the bootstrap
+domain. The 32-byte audit-token struct follows the arm64 by-value ABI (copied
+to memory), and the service name occupies the first variadic argument.
+These addresses identify this binary, not an address-based patch.
+
+## Scoped compatibility
+
+The existing launchdhook interposes this function. The new case requires:
+
+- The exact `mach-lookup` operation and name filter 2, 3 or 12.
+- Exact service `com.apple.mobile.usermanagerd.xpc`.
+- A regular, root-owned enable marker with no group/other write bits.
+- `proc_pidpath` matching the system InstallCoordination support executable.
+- `csops_audittoken(CS_OPS_IDENTITY)` succeeding for the incoming audit token
+ and returning `com.apple.installcoordination_proxy`.
+
+The kernel checks both PID and PID version for csops_audittoken, avoiding a
+PID-only identity decision. The identity result has an eight-byte blob header
+followed by the NUL-terminated identifier. Sources:
+[Apple codesign.h](https://github.com/apple-oss-distributions/xnu/blob/main/bsd/sys/codesign.h)
+and [kern_proc.c](https://github.com/apple-oss-distributions/xnu/blob/main/bsd/kern/kern_proc.c).
+The service's own persona authorization is unchanged. There is no generic
+UserManager allowlist, sandbox disable, or host security-setting change.
+
+Patch `system-installcoordination_proxy-cfw-persona_lookup` installs/removes
+`/usr/lib/vphone-installcoordination-persona-lookup` and records the result.
+The installer restores the failed experimental proxy modification from its
+backup when migrating an already patched machine. The original VM disk and
+patch receipts were cloned to `/tmp/vphone-pre-persona-fix` before deployment.
+
+## Validation
+
+The host C harness passes the permitted filters and rejects other operations,
+services, executable paths, signing identifiers, stale audit tokens, missing
+markers, symlinks, non-root owners and writable markers. Deployment through Launchpad completed; after reboot, Xcode Run installed
+EasyTier and displayed `Running EasyTier on iPhone`. Guest `apps.foreground`
+confirmed `cn.easytier`, PID 441, `verified: true`. The hook log recorded two
+`allow mach-lookup com.apple.mobile.usermanagerd.xpc` entries.
+
+The live installation proxy was pulled back and compared with the pre-change
+binary: both SHA-256 hashes were
+`acc3676f9b1d56eec0278a64cbd53fc0b1c54d1c2b8f56d91b7570f049d5b87c`.
+Thus the successful Xcode install did not depend on the failed entitlement
+experiment. The bundle build and its validation passed, as did all 50 tests
+in the six required patch model/catalogue suites.
+
+LLDB warned that the host lacked the device's on-disk shared cache and was
+reading symbols from process memory; Xcode subsequently asked to continue
+waiting. This is separate from installation and can delay initial debugger
+startup. Continue was selected; no claim of breakpoint/step validation yet.
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
index 27113f56..e034e764 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
@@ -19,6 +19,9 @@ public enum FirmwareGuestSystemPatchSet {
public static let settingsSoftwareUpdate = "dyld-exp-settings_software_update_row"
public static let settingsRowPatches: Set<String> = [settingsRootRows, settingsSoftwareUpdate]
+ public static let installCoordinationPersona = "system-installcoordination_proxy-cfw-persona_lookup"
+ public static let installCoordinationPersonaMarker = "/usr/lib/vphone-installcoordination-persona-lookup"
+
private static let ios27 = VPhonePatchApplicability(iOSBase: .major(27))
/// The bases where short-circuiting `checkTrustAndAuthorization` in the
@@ -159,6 +162,14 @@ public enum FirmwareGuestSystemPatchSet {
applicability: ios27,
),
+ VPhonePatchDeclaration(
+ identifier: installCoordinationPersona,
+ title: "Xcode installation persona lookup",
+ summary: "Allows only the CoreDevice installation proxy to look up UserManager through the launchd hook on the hybrid guest.",
+ target: .guestFile(path: installCoordinationPersonaMarker),
+ applicability: ios27,
+ ),
+
// MARK: Guest Payload
VPhonePatchDeclaration(
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift
index b852afa4..c19ebeb3 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift
@@ -17,6 +17,17 @@ import VPhonePatchKit
@Suite("Bundled patch set catalogue")
struct FirmwarePatchSetCatalogTests {
+ @Test func `CoreDevice persona lookup is selected only for iOS 27`() throws {
+ for base in ["26.4", "27.0.1", "28.0"] {
+ let plan = try VPhonePatchPlan.resolve(
+ preset: FirmwarePatchSetCatalog.standardPreset,
+ patchSets: FirmwarePatchSetCatalog.bundled,
+ iOSBase: VPhoneVersion(base), cloudOS: VPhoneVersion("26.4")
+ )
+ #expect(plan.isEnabled(FirmwareGuestSystemPatchSet.installCoordinationPersona) == base.hasPrefix("27."))
+ }
+ }
+
@Test
func `Every bundled set has a unique identifier and no duplicate patches`() {
let setIdentifiers = FirmwarePatchSetCatalog.bundled.map(\.identifier)
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift
index e3a64a1a..44de3aed 100644
--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift
+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift
@@ -1327,6 +1327,24 @@ struct VPhoneCustomFirmwareInstaller {
}
}
+ let personaPatch = FirmwareGuestSystemPatchSet.installCoordinationPersona
+ let personaMarker = String(FirmwareGuestSystemPatchSet.installCoordinationPersonaMarker.dropFirst())
+ isolate([personaPatch]) {
+ // Undo the experimental entitlement-only patch if this machine
+ // received it. Platform Protobox profiles ignore that exception.
+ let proxy = "System/Library/PrivateFrameworks/InstallCoordination.framework/Support/installcoordination_proxy"
+ if priorGuest.contains(personaPatch), try revertMachO(system: system, work: work, path: proxy) {
+ print(" [+] \(personaPatch): restored proxy before enabling launchd compatibility")
+ }
+ if version.hasPrefix("27."), on(personaPatch) {
+ try system.writeFile(personaMarker, contents: Data("1\n".utf8), mode: 0o644, owner: Self.guestOwner)
+ live.insert(personaPatch)
+ print(" [+] \(personaPatch): enabled scoped UserManager lookup")
+ } else {
+ try system.removeItem(personaMarker)
+ }
+ }
+
if !failures.isEmpty {
print("[!] \(failures.count) guest patch(es) failed and were left in their prior state: \(Set(failures).sorted().joined(separator: ", "))")
}
diff --git a/VPhoneGuestComponents/LaunchHook/InstallCoordinationPersona.h b/VPhoneGuestComponents/LaunchHook/InstallCoordinationPersona.h
new file mode 100644
index 00000000..89191e5a
--- /dev/null
+++ b/VPhoneGuestComponents/LaunchHook/InstallCoordinationPersona.h
@@ -0,0 +1,33 @@
+#pragma once
+
+// The hybrid kernel also rejects CoreDevice's installation proxy looking up
+// UserManager. Keep this exception scoped to the exact executable and signing
+// identity, with the requesting audit token checked by the kernel to reject
+// stale/reused PIDs. See Research/Guest/ios27_xcode_persona_lookup.md.
+#define VP_PERSONA_MARKER "/usr/lib/vphone-installcoordination-persona-lookup"
+#define VP_PERSONA_SERVICE "com.apple.mobile.usermanagerd.xpc"
+#define VP_INSTALL_PROXY "/System/Library/PrivateFrameworks/InstallCoordination.framework/Support/installcoordination_proxy"
+extern int proc_pidpath(int pid, void *buffer, uint32_t buffersize);
+extern int csops_audittoken(pid_t pid, unsigned int operations, void *buffer,
+ size_t size, vp_audit_token_t *token);
+
+static int vpInstallProxyPersonaAllowed(vp_audit_token_t token, const char *operation,
+ unsigned int filter, const void *name) {
+ // IDA: launchd sub_100037028 uses name filters 2, 3 and 12 for lookup.
+ if (!operation || (filter != 2 && filter != 3 && filter != 12) || !name ||
+ strcmp(operation, "mach-lookup") || strcmp(name, VP_PERSONA_SERVICE))
+ return 0;
+ struct stat marker;
+ if (lstat(VP_PERSONA_MARKER, &marker) || !S_ISREG(marker.st_mode) ||
+ marker.st_uid != 0 || (marker.st_mode & 022))
+ return 0;
+ pid_t pid = (pid_t)token.val[5];
+ char path[PATH_MAX] = {0};
+ if (pid <= 0 || proc_pidpath(pid, path, sizeof(path)) <= 0 || strcmp(path, VP_INSTALL_PROXY))
+ return 0;
+ // CS_OPS_IDENTITY returns an 8-byte blob header followed by a NUL string.
+ unsigned char identity[256] = {0};
+ if (csops_audittoken(pid, 11, identity, sizeof(identity), &token))
+ return 0;
+ return strcmp((const char *)identity + 8, "com.apple.installcoordination_proxy") == 0;
+}
diff --git a/VPhoneGuestComponents/LaunchHook/launchdhook-vphone.c b/VPhoneGuestComponents/LaunchHook/launchdhook-vphone.c
index 37c95d6a..c3340622 100644
--- a/VPhoneGuestComponents/LaunchHook/launchdhook-vphone.c
+++ b/VPhoneGuestComponents/LaunchHook/launchdhook-vphone.c
@@ -1,6 +1,7 @@
#include "../Shared/InjectionEnvironment.h"
#include "../Shared/RootHideLoaderLinks.h"
#include <fcntl.h>
+#include <stdint.h>
#include <limits.h>
#include <spawn.h>
#include <stdarg.h>
@@ -180,6 +181,8 @@ static void vpLogVolumeAllow(const char *name) {
close(fd);
}
+#include "InstallCoordinationPersona.h"
+
static int vpSandboxCheckByAuditToken(vp_audit_token_t token, const char *operation,
unsigned int filter, ...) {
va_list arguments;
@@ -194,6 +197,10 @@ static int vpSandboxCheckByAuditToken(vp_audit_token_t token, const char *operat
vpLogVolumeAllow((const char *)first);
return 0;
}
+ if (vpInstallProxyPersonaAllowed(token, operation, filter, first)) {
+ vpLogVolumeAllow((const char *)first);
+ return 0;
+ }
return sandbox_check_by_audit_token(token, operation, filter, first);
}
diff --git a/VPhoneGuestComponents/Makefile b/VPhoneGuestComponents/Makefile
index 5c348465..b60a847a 100644
--- a/VPhoneGuestComponents/Makefile
+++ b/VPhoneGuestComponents/Makefile
@@ -266,3 +266,10 @@ test-vcam-prewarm:
-o $(OUT)/VCamPrewarmScanTests \
Tests/VCamPrewarmScanTests.c VCamCaptured/Prewarm/VCamPrewarmScan.c
@$(OUT)/VCamPrewarmScanTests
+
+.PHONY: test-installcoordination-persona
+test-installcoordination-persona:
+ @mkdir -p $(OUT)
+ xcrun --sdk macosx clang -Wall -Wextra -Werror \
+ -o $(OUT)/InstallCoordinationPersonaTests Tests/InstallCoordinationPersonaTests.c
+ @$(OUT)/InstallCoordinationPersonaTests
diff --git a/VPhoneGuestComponents/Tests/InstallCoordinationPersonaTests.c b/VPhoneGuestComponents/Tests/InstallCoordinationPersonaTests.c
new file mode 100644
index 00000000..ee764398
--- /dev/null
+++ b/VPhoneGuestComponents/Tests/InstallCoordinationPersonaTests.c
@@ -0,0 +1,59 @@
+#include <assert.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+typedef struct { unsigned int val[8]; } vp_audit_token_t;
+static int test_stat(const char *, struct stat *);
+#define lstat test_stat
+#define proc_pidpath test_path
+#define csops_audittoken test_csops
+#include "../LaunchHook/InstallCoordinationPersona.h"
+static int markerMissing, wrongPath, staleToken, wrongIdentity;
+static mode_t markerMode = S_IFREG | 0644;
+static uid_t markerOwner;
+static int test_stat(const char *path, struct stat *info) {
+ assert(!strcmp(path, VP_PERSONA_MARKER));
+ memset(info, 0, sizeof(*info));
+ info->st_mode = markerMode;
+ info->st_uid = markerOwner;
+ return markerMissing ? -1 : 0;
+}
+int test_path(int pid, void *buffer, uint32_t size) {
+ assert(pid == 404);
+ return snprintf(buffer, size, "%s", wrongPath ? "/tmp/installcoordination_proxy" : VP_INSTALL_PROXY);
+}
+int test_csops(pid_t pid, unsigned int op, void *buffer, size_t size, vp_audit_token_t *token) {
+ assert(pid == 404 && op == 11 && token->val[7] == 42);
+ if (staleToken) return -1;
+ snprintf((char *)buffer + 8, size - 8, "%s", wrongIdentity ? "other" : "com.apple.installcoordination_proxy");
+ return 0;
+}
+int main(void) {
+ vp_audit_token_t token = {{0}};
+ token.val[5] = 404;
+ token.val[7] = 42;
+ for (unsigned int filter = 0; filter < 32; filter++)
+ assert(vpInstallProxyPersonaAllowed(token, "mach-lookup", filter, VP_PERSONA_SERVICE) ==
+ (filter == 2 || filter == 3 || filter == 12));
+ assert(!vpInstallProxyPersonaAllowed(token, NULL, 2, VP_PERSONA_SERVICE));
+ assert(!vpInstallProxyPersonaAllowed(token, "mach-register", 2, VP_PERSONA_SERVICE));
+ assert(!vpInstallProxyPersonaAllowed(token, "mach-lookup", 2, NULL));
+ assert(!vpInstallProxyPersonaAllowed(token, "mach-lookup", 2, "com.apple.other"));
+ int *failures[] = {&markerMissing, &wrongPath, &staleToken, &wrongIdentity};
+ for (size_t i = 0; i < sizeof(failures)/sizeof(failures[0]); i++) {
+ *failures[i] = 1;
+ assert(!vpInstallProxyPersonaAllowed(token, "mach-lookup", 2, VP_PERSONA_SERVICE));
+ *failures[i] = 0;
+ }
+ markerMode = S_IFLNK | 0644;
+ assert(!vpInstallProxyPersonaAllowed(token, "mach-lookup", 2, VP_PERSONA_SERVICE));
+ markerMode = S_IFREG | 0664;
+ assert(!vpInstallProxyPersonaAllowed(token, "mach-lookup", 2, VP_PERSONA_SERVICE));
+ markerMode = S_IFREG | 0644;
+ markerOwner = 501;
+ assert(!vpInstallProxyPersonaAllowed(token, "mach-lookup", 2, VP_PERSONA_SERVICE));
+ puts("InstallCoordination persona lookup scope tests passed");
+}