Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Report the bootstrap vphoned installed as the jailbreak layout

Jacky4c2d768a05b2
diff --git a/Research/vphoned_http_api.md b/Research/vphoned_http_api.md
index 699d700c..ad8c2a9c 100644
--- a/Research/vphoned_http_api.md
+++ b/Research/vphoned_http_api.md
@@ -209,8 +209,14 @@ into memory.
`jailbreak.source`. The layout is `roothide`, `rootless`, or `rootful` when
detected. If there is no bootstrap and `/` is read-only, both `layout` and
`jbroot` are JSON `null`; `/` alone is not evidence of a rootful bootstrap.
-The daemon checks a loaded RootHide `systemhook.dylib` export and `/var/jb`
-at request time so a bootstrap created after daemon startup can be reported.
+The daemon first reports the bootstrap it installed itself, from its
+completion record (`source` is `vphoned bootstrap`). The later probes look
+for a jailbreak's own traces, and a RootHide root vphoned made has none: a
+system-installed vphoned has no `.jbroot` link or libroot library beside it,
+and vphone's SystemHook exports no `get_jbroot`. It then checks a loaded
+RootHide `systemhook.dylib` export, icli's own detection and `/var/jb`. All
+of this runs at request time so a bootstrap created after daemon startup can
+be reported.
For raw guest TCP ports, upgrade `GET /v1/ports/<port>` to WebSocket. Each
binary WebSocket message carries an unmodified chunk of the TCP byte stream
diff --git a/VPhoneDaemon/Daemon/GuestAPI.swift b/VPhoneDaemon/Daemon/GuestAPI.swift
index 6bdf60a6..bda43785 100644
--- a/VPhoneDaemon/Daemon/GuestAPI.swift
+++ b/VPhoneDaemon/Daemon/GuestAPI.swift
@@ -503,8 +503,17 @@ enum GuestAPI {
return FileManager.default.fileExists(atPath: path, isDirectory: &directory) && directory.boolValue
}
- // RootHide can expose its root through the injected hook even when a
- // system-installed vphoned has no adjacent .jbroot or libroot library.
+ // The bootstrap vphoned installed itself, by its completion record.
+ // The probes below look for a jailbreak's own traces, and a RootHide
+ // root vphoned made has none: vphoned is on the system volume, away
+ // from any .jbroot link or libroot library, and vphone's SystemHook
+ // has no get_jbroot.
+ if let installation = try? GuestIrisinInstaller.completedBootstrap(), isDirectory(installation.root) {
+ return ["layout": installation.layout, "jbroot": installation.root, "source": "vphoned bootstrap"]
+ }
+
+ // A foreign RootHide can expose its root through its injected hook even
+ // when vphoned has no adjacent .jbroot or libroot library.
if let hook = dlopen("systemhook.dylib", RTLD_NOLOAD) {
defer { dlclose(hook) }
if let symbol = dlsym(hook, "get_jbroot") {