界: Security Features
軟體安全性並非安全性軟體。我們關注驗證、Access Control、保密性、加密以及權限管理之類的主題。
Authentication Bad Practice: Missing Check against Protection Space
Abstract
NSURLConnection
委派會直接處理驗證挑戰,而不會先驗證應用程式是否瞭解如何針對特定保護空間處理驗證挑戰。Explanation
NSURLProtectionSpace
物件可代表需要驗證的伺服器或伺服器上的區域 (通常稱為領域)。建立需要驗證保護空間的 URL 連線時,將在呼叫應執行驗證的
NSURLConnectionDelegate.connection(_:didReceive:)
方法之前呼叫 NSURLConnectionDelegate.connection(_:canAuthenticateAgainstProtectionSpace:)
方法。這允許 NSURLConnectionDelegate
先檢查保護空間,然後再嘗試進行驗證。透過傳回 true
,委派表示其可處理驗證表單 (將在後續呼叫 connection(_:didReceive:)
時執行)。如果您的委派未執行此方法,而保護空間使用用戶端憑證驗證或伺服器信任驗證,則系統將嘗試使用使用者的金鑰鏈來驗證哪些可能不是想要的運作方式。References
[1] connection(_:canAuthenticateAgainstProtectionSpace:) API documentation Apple
[2] URLProtectionSpace API documentation Apple
[3] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[4] Standards Mapping - OWASP API 2023 API2 Broken Authentication
[5] Standards Mapping - OWASP Mobile 2024 M3 Insecure Authentication/Authorization
[6] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-AUTH-1
desc.structural.objc.authentication_bad_practice_missing_check_against_protection_space
Abstract
NSURLConnection
委派會直接處理驗證挑戰,而不會先驗證應用程式是否瞭解如何針對特定保護空間處理驗證挑戰。Explanation
NSURLProtectionSpace
物件可代表需要驗證的伺服器或伺服器上的區域 (通常稱為領域)。建立需要驗證保護空間的 URL 連線時,將在呼叫應執行驗證的
NSURLConnectionDelegate.connection(_:didReceive:)
方法之前呼叫 NSURLConnectionDelegate.connection(_:canAuthenticateAgainstProtectionSpace:)
方法。這允許 NSURLConnectionDelegate
先檢查保護空間,然後再嘗試進行驗證。透過傳回 true
,委派表示其可處理驗證表單 (將在後續呼叫 connection(_:didReceive:)
時執行)。如果您的委派未執行此方法,而保護空間使用用戶端憑證驗證或伺服器信任驗證,則系統將嘗試使用使用者的金鑰鏈來驗證哪些可能不是想要的運作方式。References
[1] connection(_:canAuthenticateAgainstProtectionSpace:) API documentation Apple
[2] URLProtectionSpace API documentation Apple
[3] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[4] Standards Mapping - OWASP API 2023 API2 Broken Authentication
[5] Standards Mapping - OWASP Mobile 2024 M3 Insecure Authentication/Authorization
[6] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-AUTH-1
desc.structural.swift.authentication_bad_practice_missing_check_against_protection_space