계: Security Features

소프트웨어 보안은 보안 소프트웨어가 아닙니다. 여기서는 인증, 액세스 제어, 기밀성, 암호화, 권한 관리 등의 항목에 대해 설명합니다.

Authentication Bad Practice: Missing Host Check

Abstract
NSURLConnection 또는 NSURLSession에 대한 인증 처리 콜백이 어떤 호스트에 자격 증명을 보내는지 확인하지 못합니다.
Explanation
응용 프로그램은 NSURLConnection 또는 NSURLSession 콜백을 구현하여 인증 요청을 처리합니다. 예상 호스트에서 인증 요청이 나오도록 확인하는 것을 잊어버리면 자격 증명은 응용 프로그램이 로드하는 모든 URL에 전송됩니다. 또한, 자격 증명이 안전하게 전송될 수 있음을 확인하지 못하면 자격 증명이 도난됩니다.

예제 1: 다음 응용 프로그램은 사용자 자격 증명을 인증을 요청하는 모든 호스트에 전송합니다.


- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NS URLAuthenticationChallenge *)challenge completionHandler:(void (^)(NS URLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler {
NSString *user = [self getUser];
NSString *pass = [self getPassword];

NSURLCredential *cred = [NSURLCredential credentialWithUser:user
password:pass persistence:NSURLCredentialPersistenceForSession];
completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
}
References
[1] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[2] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[3] Standards Mapping - OWASP API 2023 API2 Broken Authentication
[4] Standards Mapping - OWASP Mobile 2024 M3 Insecure Authentication/Authorization
[5] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-AUTH-1
desc.structural.objc.authentication_bad_practice_missing_host_check
Abstract
NSURLConnection 또는 NSURLSession에 대한 인증 처리 콜백이 어떤 호스트에 자격 증명을 보내는지 확인하지 못합니다.
Explanation
응용 프로그램은 NSURLConnection 또는 NSURLSession 콜백을 구현하여 인증 요청을 처리합니다. 예상 호스트에서 인증 요청이 나오도록 확인하는 것을 잊어버리면 자격 증명은 응용 프로그램이 로드하는 모든 URL에 전송됩니다. 또한, 자격 증명이 안전하게 전송될 수 있음을 확인하지 못하면 자격 증명이 도난됩니다.

예제 1: 다음 응용 프로그램은 사용자 자격 증명을 인증을 요청하는 모든 호스트에 전송합니다.


func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {

let user = getUser()
let pass = getPassword()

let credential = URLCredential(user: user, password: pass, persistence: .none)

completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential, credential)
}
References
[1] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[2] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[3] Standards Mapping - OWASP API 2023 API2 Broken Authentication
[4] Standards Mapping - OWASP Mobile 2024 M3 Insecure Authentication/Authorization
[5] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-AUTH-1
desc.structural.swift.authentication_bad_practice_missing_host_check