Repository navigation
Authenticate paired devices on wireless lockdown connections - #2
Merged
Merged
Conversation
…ork discovery Address review findings on paired wireless TLS and usbmuxd network support: - Classify all rustls certificate/signature/missing-cert errors and OpenSSL cert/signature/ASN.1 errors as DeviceIdentityVerification, restrict OpenSSL TLS 1.2 ciphers to ephemeral ECDHE/DHE, verify depth-0 leaf match, and record identity failure on device_certificate public-key extraction failures - Parse X.509 v1-v3 SubjectPublicKeyInfo directly in sni.rs and verify TLS 1.2 and TLS 1.3 handshake signatures against the extracted SPKI so v1 pairing records continue working under rustls - Route CoreDeviceProxy, ScreenshotService, MobileBackup2Client, CrashReportCopyMobileClient, RemoteServerClient, RemotePairingLockdownService, and all IdeviceService::get_socket impls through awaiting_network_tls guards - Take Idevice socket safely without unwrap panics, close plaintext sockets on setup/send_plist errors, delay storing LockdownClient::session_id until TLS succeeds, and scope NetworkSession::defer_retry to unauthenticated refusals - Keep connect_service_socket crate-internal, fix empty-slice underflow in send_raw_with_progress, attach NetworkSession/require_network_tls to TcpProvider, and fail fast in WdaBridge/WdaClient on network TLS providers - Use crate::time::Instant and forward vectored writes in network_session.rs - Restore non-Darwin BSD sockaddr_in6 support, apply InterfaceIndex fallback only to link-local IPv6 addresses, and warn on skipped usbmuxd entries - Expand paired_tls integration tests to run on aws-lc, ring, rustcrypto, and openssl with X.509 v1, cross-algorithm, malformed cert, and guard coverage Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #1(由于 #1 源分支位于同级 fork,维护者无法直接推送修复提交,本 PR 完整保留原提交
3fb44ad并追加全部 review 修复提交)。背景与原始变更(保留自 #1)
配合
Derrors/iphone-control#238,在无线 lockdown 会话中基于配对记录里的设备公钥核对对端证书并验证 TLS 握手签名,强制无线服务协商加密,身份校验失败时关闭同一NetworkSession下的所有兄弟连接,保留 usbmuxd IPv6 接口编号并限制无线隧道 MTU。本次追加的 Review 修复
InvalidCertificate(_)、NoCertificatesPresented及签名/证书相关PeerMisbehaved统一归类为DeviceIdentityVerification并撤销整个NetworkSession。ECDHE:DHE)、追踪depth == 0叶子校验结果、按 OpenSSL 错误库/错误码匹配证书/签名/ASN.1 失败,并在设备公钥提取失败时记录身份失败。Idevice::{socket_mut, require_socket_mut, take_socket},将CoreDeviceProxy、ScreenshotService、MobileBackup2Client、CrashReportCopyMobileClient、RemoteServerClient、RemotePairingLockdownService及全部IdeviceService::get_socket接入awaiting_network_tls()守卫。Idevice::start_session中socket.take().unwrap()panic 风险,前置配置和StartSession发送失败时清理明文 socket,并延迟到 TLS 成功后才写入LockdownClient::session_id。NetworkSession改用crate::time::Instant(兼容wasm32),TrackedSocket转发 vectored write;defer_retry()仅作用于未完成首次认证的会话,且DeviceLocked等正常设备状态错误不再锁死整个 provider 30 秒。sockaddr_in6解析,仅在 link-local IPv6 时使用InterfaceIndex兜底sin6_scope_id(遵循 RFC 4007),并对跳过的异常设备条目输出 warning 日志。connect_service_socket收口为pub(crate);为TcpProvider接入NetworkSession与require_network_tls();在WdaBridge/WdaClient对需要无线 TLS 的 provider 快速返回UnencryptedNetworkService;修复send_raw_with_progress空切片下溢。paired_tls.rs的ring独占门控,覆盖aws-lc、ring、rustcrypto与openssl后端(含 X.509 v1、跨算法签名、畸形证书、静态 RSA 拒绝与各类守卫测试)。cargo fmt -- --check、cargo clippy -- -D warnings(idevice+idevice-tools)、全后端单元测试与集成测试及cargo check --workspace。🤖 Generated with Claude Code