계: Encapsulation

캡슐화는 강력한 경계를 그리는 것입니다. 웹 브라우저에서는 사용자의 모바일 코드가 다른 모바일 코드에 의해 오용되지 않도록 하는 것을 의미합니다. 서버에서는 검증된 데이터와 검증되지 않은 데이터, 한 사용자의 데이터와 다른 사용자의 데이터, 데이터 사용자가 볼 수 있는 데이터와 볼 수 없는 데이터 간의 차별화를 의미할 수 있습니다.

104 개 항목 찾음
취약점
Abstract
식별된 메서드는 약할 가능성이 있는 암호화 설정을 사용하여 파일에 데이터를 작성합니다.
Explanation
Data Protection API는 키 집합의 항목과 파일 시스템에 저장된 파일에 접근할 수 있어야 하는 경우를 응용 프로그램이 선언할 수 있도록 설계되었습니다. 이는 NSFileManager, CoreData, NSData, SQLite를 비롯하여 대부분의 파일 및 데이터베이스 API에 사용할 수 있습니다. 개발자는 지정된 리소스에 대해 네 가지 보호 클래스 중 하나를 지정하여 기본 파일 시스템이 이를 암호화할 때 장치의 UID와 사용자의 암호 모두에서 파생된 키를 사용할 것인지, 아니면 장치의 UID만 기반으로 하는 키를 사용할 것인지, 및 자동으로 해독하는 시기를 지시할 수 있습니다.

데이터 보호 클래스는 NSFileManager 인스턴스와 연결된 NSDictionaryNSFileProtectionKey 키 값으로 할당되는 상수로 NSFileManager에 대해 정의됩니다. setAttributes:ofItemAtPath:error:, attributesOfItemAtPath:error:, createFileAtPath:contents:attributes: 등의 NSFileManager 함수를 사용하면 파일을 만들거나 파일의 데이터 보호 클래스를 수정할 수 있습니다. 또한 NSData 개체에 대해서도 해당하는 데이터 보호 상수가 NSDataWritingOptions로 정의되며, 이는 NSData 함수 writeToURL:options:error:writeToFile:options:error:options 인수로 전달할 수 있습니다. NSFileManagerNSData에 지정되는 다양한 데이터 보호 클래스 상수의 정의는 다음과 같습니다.

-NSFileProtectionComplete, NSDataWritingFileProtectionComplete:
리소스가 암호화된 형식으로 디스크에 저장되며 장치가 잠겨 있거나 부팅되는 동안에는 리소스를 읽거나 쓸 수 없습니다.
iOS 4.0 이상에서 사용 가능합니다.
-NSFileProtectionCompleteUnlessOpen, NSDataWritingFileProtectionCompleteUnlessOpen:
리소스가 암호화된 형식으로 디스크에 저장됩니다. 장치가 잠겨 있는 동안에도 리소스를 생성할 수 있지만 일단 닫힌 후에는 장치의 잠금이 해제될 때까지 다시 열 수 없습니다. 잠금이 해제되어 리소스가 열리면 사용자가 장치를 잠그더라도 계속해서 정상적으로 리소스에 접근할 수 있습니다.
iOS 5.0 이상에서 사용 가능합니다.
-NSFileProtectionCompleteUntilFirstUserAuthentication, NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication:
리소스가 암호화된 형식으로 디스크에 저장되며 장치의 부팅이 완료되기 전까지는 리소스에 접근할 수 없습니다. 사용자가 장치의 잠금을 처음 해제하고 나면 앱이 리소스에 접근할 수 있으며 사용자가 이후에 장치를 잠그더라도 계속 접근할 수 있습니다.
iOS 5.0 이상에서 사용 가능합니다.
-NSFileProtectionNone, NSDataWritingFileProtectionNone:
리소스에 연관된 특수한 보호 기능이 없으므로 언제든지 읽거나 쓸 수 있습니다.
iOS 4.0 이상에서 사용 가능합니다.

따라서 파일에 NSFileProtectionCompleteUnlessOpen 또는 NSFileProtectionCompleteUntilFirstUserAuthentication으로 표시하면 사용자의 암호 및 장치의 UID에서 파생된 키를 사용하여 암호화할 수 있으며 특정 상황에서도 계속해서 데이터에 접근할 수 있습니다. NSFileProtectionCompleteUnlessOpen 또는 NSFileProtectionCompleteUntilFirstUserAuthentication을 이와 같이 사용하는 경우 신중하게 검토하여 NSFileProtectionComplete를 통한 추가 보호가 보증되는지를 확인해야 합니다.

예제 1: 다음 예제에서는 지정된 파일이 사용자가 장치를 켜고 암호를 처음 입력할 때까지만 보호됩니다(다음 재부팅 시까지).


...
filepath = [self.GetDocumentDirectory stringByAppendingPathComponent:self.setFilename];
...
NSDictionary *protection = [NSDictionary dictionaryWithObject:NSFileProtectionCompleteUntilFirstUserAuthentication forKey:NSFileProtectionKey];
...
[[NSFileManager defaultManager] setAttributes:protection ofItemAtPath:filepath error:nil];
...
BOOL ok = [testToWrite writeToFile:filepath atomically:YES encoding:NSUnicodeStringEncoding error:&err];
...
예제 2: 다음 예제에서는 지정된 데이터가 사용자가 장치를 켜고 암호를 처음 입력할 때까지만 보호됩니다(다음 재부팅 시까지).


...
filepath = [self.GetDocumentDirectory stringByAppendingPathComponent:self.setFilename];
...
NSData *textData = [textToWrite dataUsingEncoding:NSUnicodeStingEncoding];
...
BOOL ok = [textData writeToFile:filepath options:NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication error:&err];
...
References
[1] iOS Security Guide Apple
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark complete
[8] Standards Mapping - Common Weakness Enumeration CWE ID 311
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[10] Standards Mapping - FIPS200 MP
[11] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[14] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[15] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[16] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[17] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[18] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[19] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[20] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3)
[21] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[22] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[23] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[29] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 7.1 - Use of Cryptography
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[32] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[33] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[34] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.objc.insecure_storage_insufficient_data_protection
Abstract
식별된 메서드는 약할 가능성이 있는 암호화 설정을 사용하여 파일에 데이터를 작성합니다.
Explanation
Data Protection API는 키 집합의 항목과 파일 시스템에 저장된 파일에 접근할 수 있어야 하는 경우를 응용 프로그램이 선언할 수 있도록 설계되었습니다. 이는 NSFileManager, CoreData, NSData, SQLite를 비롯하여 대부분의 파일 및 데이터베이스 API에 사용할 수 있습니다. 개발자는 지정된 리소스에 대해 네 가지 보호 클래스 중 하나를 지정하여 기본 파일 시스템이 이를 암호화할 때 장치의 UID와 사용자의 암호 모두에서 파생된 키를 사용할 것인지, 아니면 장치의 UID만 기반으로 하는 키를 사용할 것인지, 및 자동으로 해독하는 시기를 지시할 수 있습니다.

데이터 보호 클래스는 NSFileManager 인스턴스와 연결된 DictionaryNSFileProtectionKey 키 값으로 할당되는 상수로 NSFileManager에서 정의됩니다. setAttributes(_:ofItemAtPath:), attributesOfItemAtPath(_:), createFileAtPath(_:contents:attributes:) 등의 NSFileManager 함수를 사용하면 파일을 만들거나 파일의 데이터 보호 클래스를 수정할 수 있습니다. 또한 NSDataWritingOptions 열거의 NSData 개체에 대해서도 해당하는 데이터 보호 상수가 정의됩니다. 이 상수는 NSData 함수에 대한 options 인수로 전달할 수 있으며, 해당 함수는
writeToFile(_:options:)
등이 있습니다. NSFileManagerNSData에 지정되는 다양한 데이터 보호 클래스 상수의 정의는 다음과 같습니다.

-NSFileProtectionComplete, NSDataWritingOptions.DataWritingFileProtectionComplete:
리소스가 암호화된 형식으로 디스크에 저장되며 장치가 잠겨 있거나 부팅되는 동안에는 리소스를 읽거나 쓸 수 없습니다.
iOS 4.0 이상에서 사용 가능합니다.
-NSFileProtectionCompleteUnlessOpen, NSDataWritingOptions.DataWritingFileProtectionCompleteUnlessOpen:
리소스가 암호화된 형식으로 디스크에 저장됩니다. 장치가 잠겨 있는 동안에도 리소스를 생성할 수 있지만 일단 닫힌 후에는 장치의 잠금이 해제될 때까지 다시 열 수 없습니다. 잠금이 해제되어 리소스가 열리면 사용자가 장치를 잠그더라도 계속해서 정상적으로 리소스에 접근할 수 있습니다.
iOS 5.0 이상에서 사용 가능합니다.
-NSFileProtectionCompleteUntilFirstUserAuthentication, NSDataWritingOptions.DataWritingFileProtectionCompleteUntilFirstUserAuthentication:
리소스가 암호화된 형식으로 디스크에 저장되며 장치의 부팅이 완료되기 전까지는 리소스에 접근할 수 없습니다. 사용자가 장치의 잠금을 처음 해제하고 나면 앱이 리소스에 접근할 수 있으며 사용자가 이후에 장치를 잠그더라도 계속 접근할 수 있습니다.
iOS 5.0 이상에서 사용 가능합니다.
-NSFileProtectionNone, NSDataWritingOptions.DataWritingFileProtectionNone:
리소스에 연관된 특수한 보호 기능이 없으므로 언제든지 읽거나 쓸 수 있습니다.
iOS 4.0 이상에서 사용 가능합니다.

따라서 파일에 NSFileProtectionCompleteUnlessOpen 또는 NSFileProtectionCompleteUntilFirstUserAuthentication으로 표시하면 사용자의 암호 및 장치의 UID에서 파생된 키를 사용하여 암호화할 수 있으며 특정 상황에서도 계속해서 데이터에 접근할 수 있습니다. NSFileProtectionCompleteUnlessOpen 또는 NSFileProtectionCompleteUntilFirstUserAuthentication을 이와 같이 사용하는 경우 신중하게 검토하여 NSFileProtectionComplete를 통한 추가 보호가 보증되는지를 확인해야 합니다.

예제 1: 다음 예제에서는 지정된 파일이 사용자가 장치를 켜고 암호를 처음 입력할 때까지만 보호됩니다(다음 재부팅 시까지).


...
let documentsPath = NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0])
let filename = "\(documentsPath)/tmp_activeTrans.txt"
let protection = [NSFileProtectionKey: NSFileProtectionCompleteUntilFirstUserAuthentication]
do {
try NSFileManager.defaultManager().setAttributes(protection, ofItemAtPath: filename)
} catch let error as NSError {
NSLog("Unable to change attributes: \(error.debugDescription)")
}
...
BOOL ok = textToWrite.writeToFile(filename, atomically:true)
...
예제 2: 다음 예에서는 지정된 데이터가 사용자가 장치를 켜고 암호를 처음 입력할 때까지만 보호됩니다(다음 재부팅 시까지).


...
let documentsPath = NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0])
let filename = "\(documentsPath)/tmp_activeTrans.txt"
...
BOOL ok = textData.writeToFile(filepath, options: .DataWritingFileProtectionCompleteUntilFirstUserAuthentication);
...
References
[1] iOS Security Guide Apple
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark complete
[8] Standards Mapping - Common Weakness Enumeration CWE ID 311
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[10] Standards Mapping - FIPS200 MP
[11] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[14] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[15] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[16] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[17] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[18] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[19] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[20] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3)
[21] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[22] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[23] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[29] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 7.1 - Use of Cryptography
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[32] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[33] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[34] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.structural.swift.insecure_storage_insufficient_data_protection
Abstract
식별된 메서드는 암호화 설정이 충분하지 않을 수 있는 키 집합에 데이터를 저장합니다.
Explanation
키 집합 액세스 가능성 상수는 응용 프로그램이 키 집합의 항목에 액세스해야 하는 경우를 선언할 수 있도록 하기 위한 것입니다. 개발자는 지정된 키 집합 항목에 대한 액세스 가능성 상수 중 하나를 지정하여 기본 파일 시스템이 이를 암호화할 때 장치의 UID와 사용자의 암호 모두에서 파생된 키를 사용할지 아니면 장치의 UID만 기반으로 하는 키를 사용할지를(그리고 이를 자동으로 해독하는 시점) 지시할 수 있습니다.

키 집합 액세스 가능성 상수는 키 집합 특성 dictionary에서 kSecAttrAccessible 키에 대한 값으로 할당됩니다. 다양한 키 집합 액세스 가능성 상수에 대한 정의는 다음과 같습니다.

-kSecAttrAccessibleAfterFirstUnlock:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlways:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly:
장치가 잠금 해제되었을 때만 키 집합의 데이터에 액세스할 수 있습니다. 장치에 암호가 설정된 경우에만 사용할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 백업이 새 장치로 복원된 후에는 이러한 항목이 없어집니다. 암호가 없는 장치에서는 이 클래스에 항목을 저장할 수 없습니다. 장치 암호를 비활성화하면 이 클래스의 모든 항목이 삭제됩니다.
iOS 8.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlwaysThisDeviceOnly:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlocked:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
액세스 가능성 상수를 명시적으로 설정하지 않고 추가된 키 집합 항목에 대한 기본값입니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlockedThisDeviceOnly:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

따라서 키 집합 항목을 kSecAttrAccessibleAfterFirstUnlock으로 표시하면 사용자의 암호 및 장치의 UID에서 파생된 키를 사용하여 암호화할 수 있으며 특정 상황에서도 계속해서 데이터에 액세스할 수 있습니다. kSecAttrAccessibleAfterFirstUnlock의 사용을 신중하게 검토하여 추가 보호가 보증되는지 확인해야 합니다.

예제 1: 다음 예제에서는 지정된 키 집합 항목이 사용자가 처음 장치를 켜고 암호를 입력할 때까지만 보호됩니다(다음 재부팅 시까지 보호되지 않음).


...
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
NSData *token = [@"secret" dataUsingEncoding:NSUTF8StringEncoding];

// Configure KeyChain Item
[dict setObject:(__bridge id)kSecClassGenericPassword forKey:(__bridge id) kSecClass];
[dict setObject:token forKey:(__bridge id)kSecValueData];
...
[dict setObject:(__bridge id)kSecAttrAccessibleAfterFirstUnlock forKey:(__bridge id) kSecAttrAccessible];

OSStatus error = SecItemAdd((__bridge CFDictionaryRef)dict, NULL);
...
References
[1] iOS Security Guide Apple: October 2014
[2] Keychain Services Apple
[3] Keychain Item Accessibility Constants Apple
[4] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[5] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2
[6] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[7] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[8] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[9] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[10] Standards Mapping - CIS Kubernetes Benchmark complete
[11] Standards Mapping - Common Weakness Enumeration CWE ID 311, CWE ID 312, CWE ID 313, CWE ID 522
[12] Standards Mapping - Common Weakness Enumeration Top 25 2019 [13] CWE ID 287
[13] Standards Mapping - Common Weakness Enumeration Top 25 2020 [14] CWE ID 287, [18] CWE ID 522
[14] Standards Mapping - Common Weakness Enumeration Top 25 2021 [14] CWE ID 287, [21] CWE ID 522
[15] Standards Mapping - Common Weakness Enumeration Top 25 2022 [14] CWE ID 287
[16] Standards Mapping - Common Weakness Enumeration Top 25 2023 [13] CWE ID 287
[17] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[18] Standards Mapping - FIPS200 MP
[19] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[20] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[21] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[22] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[23] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[24] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[25] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[26] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[27] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[28] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 2.7.1 Out of Band Verifier Requirements (L1 L2 L3), 2.7.2 Out of Band Verifier Requirements (L1 L2 L3), 2.7.3 Out of Band Verifier Requirements (L1 L2 L3), 2.8.4 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.8.5 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.10.2 Service Authentication Requirements (L2 L3), 2.10.3 Service Authentication Requirements (L2 L3), 3.7.1 Defenses Against Session Management Exploits (L1 L2 L3), 6.1.1 Data Classification (L2 L3), 6.1.2 Data Classification (L2 L3), 6.1.3 Data Classification (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3), 8.2.2 Client-side Data Protection (L1 L2 L3), 9.2.3 Server Communications Security Requirements (L2 L3)
[29] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[30] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[31] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[32] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[33] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[34] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[35] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[36] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[37] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 7.1 - Use of Cryptography
[38] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[39] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[40] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[41] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[42] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[49] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[56] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[57] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[58] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[59] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[60] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[61] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[62] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[63] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.objc.insecure_storage_insufficient_keychain_protection
Abstract
식별된 메서드는 암호화 설정이 충분하지 않을 수 있는 키 집합에 데이터를 저장합니다.
Explanation
키 집합 액세스 가능성 상수는 응용 프로그램이 키 집합의 항목에 액세스해야 하는 경우를 선언할 수 있도록 하기 위한 것입니다. 개발자는 지정된 키 집합 항목에 대한 액세스 가능성 상수 중 하나를 지정하여 기본 파일 시스템이 이를 암호화할 때 장치의 UID와 사용자의 암호 모두에서 파생된 키를 사용할지 아니면 장치의 UID만 기반으로 하는 키를 사용할지를(그리고 이를 자동으로 해독하는 시점) 지시할 수 있습니다.

키 집합 액세스 가능성 상수는 키 집합 특성 dictionary에서 kSecAttrAccessible 키에 대한 값으로 할당됩니다. 다양한 키 집합 액세스 가능성 상수에 대한 정의는 다음과 같습니다.

-kSecAttrAccessibleAfterFirstUnlock:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlways:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly:
장치가 잠금 해제되었을 때만 키 집합의 데이터에 액세스할 수 있습니다. 장치에 암호가 설정된 경우에만 사용할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 백업이 새 장치로 복원된 후에는 이러한 항목이 없어집니다. 암호가 없는 장치에서는 이 클래스에 항목을 저장할 수 없습니다. 장치 암호를 비활성화하면 이 클래스의 모든 항목이 삭제됩니다.
iOS 8.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlwaysThisDeviceOnly:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlocked:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
액세스 가능성 상수를 명시적으로 설정하지 않고 추가된 키 집합 항목에 대한 기본값입니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlockedThisDeviceOnly:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

따라서 키 집합 항목을 kSecAttrAccessibleAfterFirstUnlock으로 표시하면 사용자의 암호 및 장치의 UID에서 파생된 키를 사용하여 암호화할 수 있으며 특정 상황에서도 계속해서 데이터에 액세스할 수 있습니다. kSecAttrAccessibleAfterFirstUnlock의 사용을 신중하게 검토하여 추가 보호가 보증되는지 확인해야 합니다.

예제 1: 다음 예제에서는 지정된 키 집합 항목이 사용자가 처음 장치를 켜고 암호를 입력할 때까지만 보호됩니다(다음 재부팅 시까지 보호되지 않음).


...
// Configure KeyChain Item
let token = "secret"
var query = [String : AnyObject]()
query[kSecClass as String] = kSecClassGenericPassword
query[kSecValueData as String] = token as AnyObject?
...
query[kSecAttrAccessible as String] = kSecAttrAccessibleAfterFirstUnlock

SecItemAdd(query as CFDictionary, nil)
...
References
[1] iOS Security Guide Apple: October 2014
[2] Keychain Services Apple
[3] Keychain Item Accessibility Constants Apple
[4] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[5] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2
[6] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[7] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[8] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[9] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[10] Standards Mapping - CIS Kubernetes Benchmark complete
[11] Standards Mapping - Common Weakness Enumeration CWE ID 311, CWE ID 312, CWE ID 313, CWE ID 522
[12] Standards Mapping - Common Weakness Enumeration Top 25 2019 [13] CWE ID 287
[13] Standards Mapping - Common Weakness Enumeration Top 25 2020 [14] CWE ID 287, [18] CWE ID 522
[14] Standards Mapping - Common Weakness Enumeration Top 25 2021 [14] CWE ID 287, [21] CWE ID 522
[15] Standards Mapping - Common Weakness Enumeration Top 25 2022 [14] CWE ID 287
[16] Standards Mapping - Common Weakness Enumeration Top 25 2023 [13] CWE ID 287
[17] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[18] Standards Mapping - FIPS200 MP
[19] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[20] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[21] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[22] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[23] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[24] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[25] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[26] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[27] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[28] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 2.7.1 Out of Band Verifier Requirements (L1 L2 L3), 2.7.2 Out of Band Verifier Requirements (L1 L2 L3), 2.7.3 Out of Band Verifier Requirements (L1 L2 L3), 2.8.4 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.8.5 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.10.2 Service Authentication Requirements (L2 L3), 2.10.3 Service Authentication Requirements (L2 L3), 3.7.1 Defenses Against Session Management Exploits (L1 L2 L3), 6.1.1 Data Classification (L2 L3), 6.1.2 Data Classification (L2 L3), 6.1.3 Data Classification (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3), 8.2.2 Client-side Data Protection (L1 L2 L3), 9.2.3 Server Communications Security Requirements (L2 L3)
[29] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[30] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[31] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[32] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[33] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[34] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[35] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[36] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[37] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 7.1 - Use of Cryptography
[38] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[39] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[40] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[41] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[42] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[49] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[56] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[57] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[58] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[59] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[60] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[61] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[62] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[63] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.swift.insecure_storage_insufficient_keychain_protection
Abstract
식별된 메서드는 충분한 암호화 설정이 없는 파일에 데이터를 작성합니다.
Explanation
Data Protection API는 키 집합의 항목과 파일 시스템에 저장된 파일에 접근할 수 있어야 하는 경우를 응용 프로그램이 선언할 수 있도록 설계되었습니다. 이는 NSFileManager, CoreData, NSData, SQLite를 비롯하여 대부분의 파일 및 데이터베이스 API에 사용할 수 있습니다. 개발자는 지정된 리소스에 대해 네 가지 보호 클래스 중 하나를 지정하여 기본 파일 시스템이 이를 암호화할 때 장치의 UID와 사용자의 암호 모두에서 파생된 키를 사용할 것인지, 아니면 장치의 UID만 기반으로 하는 키를 사용할 것인지, 및 자동으로 해독하는 시기를 지시할 수 있습니다.

데이터 보호 클래스는 NSFileManager 인스턴스와 연결된 NSDictionaryNSFileProtectionKey 키 값으로 할당되는 상수로 NSFileManager에 대해 정의됩니다. setAttributes:ofItemAtPath:error:, attributesOfItemAtPath:error:, createFileAtPath:contents:attributes: 등의 NSFileManager 함수를 사용하면 파일을 만들거나 파일의 데이터 보호 클래스를 수정할 수 있습니다. 또한 NSData 개체에 대해서도 해당하는 데이터 보호 상수가 NSDataWritingOptions로 정의되며, 이는 NSData 함수 writeToURL:options:error:writeToFile:options:error:options 인수로 전달할 수 있습니다. NSFileManagerNSData에 지정되는 다양한 데이터 보호 클래스 상수의 정의는 다음과 같습니다.

-NSFileProtectionComplete, NSDataWritingFileProtectionComplete:
리소스가 암호화된 형식으로 디스크에 저장되며 장치가 잠겨 있거나 부팅되는 동안에는 리소스를 읽거나 쓸 수 없습니다.
iOS 4.0 이상에서 사용 가능합니다.
-NSFileProtectionCompleteUnlessOpen, NSDataWritingFileProtectionCompleteUnlessOpen:
리소스가 암호화된 형식으로 디스크에 저장됩니다. 장치가 잠겨 있는 동안에도 리소스를 생성할 수 있지만 일단 닫힌 후에는 장치의 잠금이 해제될 때까지 다시 열 수 없습니다. 잠금이 해제되어 리소스가 열리면 사용자가 장치를 잠그더라도 계속해서 정상적으로 리소스에 접근할 수 있습니다.
iOS 5.0 이상에서 사용 가능합니다.
-NSFileProtectionCompleteUntilFirstUserAuthentication, NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication:
리소스가 암호화된 형식으로 디스크에 저장되며 장치의 부팅이 완료되기 전까지는 리소스에 접근할 수 없습니다. 사용자가 장치의 잠금을 처음 해제하고 나면 앱이 리소스에 접근할 수 있으며 사용자가 이후에 장치를 잠그더라도 계속 접근할 수 있습니다.
iOS 5.0 이상에서 사용 가능합니다.
-NSFileProtectionNone, NSDataWritingFileProtectionNone:
리소스에 연관된 특수한 보호 기능이 없으므로 언제든지 읽거나 쓸 수 있습니다.
iOS 4.0 이상에서 사용 가능합니다.

데이터 보호 클래스가 명시적으로 할당되지 않은 파일을 포함하여 iOS 장치의 모든 파일은 암호화된 형식으로 저장되지만 NSFileProtectionNone을 지정하면 장치의 UID만을 토대로 파생된 키를 사용하여 암호화됩니다. 이렇게 되면 암호로 잠겨 있는 경우나 부팅할 때를 비롯해 장치가 켜져 있을 때는 언제든지 이러한 파일에 접근할 수 있게 됩니다. NSFileProtectionNone을 이와 같이 사용하는 경우 신중하게 검토하여 더 엄격한 데이터 보호 클래스를 통한 추가 보호가 보증되는지를 확인해야 합니다.

예제 1: 다음 예제에서는 지정된 파일이 보호되지 않습니다(장치가 켜져 있을 때는 언제든지 접근 가능).


...
filepath = [self.GetDocumentDirectory stringByAppendingPathComponent:self.setFilename];
...
NSDictionary *protection = [NSDictionary dictionaryWithObject:NSFileProtectionNone forKey:NSFileProtectionKey];
...
[[NSFileManager defaultManager] setAttributes:protection ofItemAtPath:filepath error:nil];
...
BOOL ok = [testToWrite writeToFile:filepath atomically:YES encoding:NSUnicodeStringEncoding error:&err];
...
예제 2: 다음 예제에서는 지정된 데이터가 보호되지 않습니다(장치가 켜져 있을 때는 언제든지 접근 가능).


...
filepath = [self.GetDocumentDirectory stringByAppendingPathComponent:self.setFilename];
...
NSData *textData = [textToWrite dataUsingEncoding:NSUnicodeStingEncoding];
...
BOOL ok = [textData writeToFile:filepath options:NSDataWritingFileProtectionNone error:&err];
...
References
[1] iOS Security Guide Apple
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark complete
[8] Standards Mapping - Common Weakness Enumeration CWE ID 311
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[10] Standards Mapping - FIPS200 MP
[11] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[14] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[15] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[16] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[17] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[18] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[19] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[20] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3)
[21] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[22] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[23] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[29] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 7.1 - Use of Cryptography
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[32] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[33] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[34] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.objc.insecure_storage_lacking_data_protection
Abstract
식별된 메서드는 충분한 암호화 설정이 없는 파일에 데이터를 작성합니다.
Explanation
Data Protection API는 키 집합의 항목과 파일 시스템에 저장된 파일에 접근할 수 있어야 하는 경우를 응용 프로그램이 선언할 수 있도록 설계되었습니다. 이는 NSFileManager, CoreData, NSData, SQLite를 비롯하여 대부분의 파일 및 데이터베이스 API에 사용할 수 있습니다. 개발자는 지정된 리소스에 대해 네 가지 보호 클래스 중 하나를 지정하여 기본 파일 시스템이 이를 암호화할 때 장치의 UID와 사용자의 암호 모두에서 파생된 키를 사용할 것인지, 아니면 장치의 UID만 기반으로 하는 키를 사용할 것인지, 및 자동으로 해독하는 시기를 지시할 수 있습니다.

데이터 보호 클래스는 NSFileManager에서 NSFileManager 인스턴스와 연결된 DictionaryNSFileProtectionKey 키 값으로 할당되는 상수로 정의됩니다. setAttributes(_:ofItemAtPath:), attributesOfItemAtPath(_:), createFileAtPath(_:contents:attributes:) 등의 NSFileManager 함수를 사용하면 파일을 만들거나 파일의 데이터 보호 클래스를 수정할 수 있습니다. 또한 NSDataWritingOptions 열거의 NSData 개체에 대해서도 해당하는 데이터 보호 상수가 정의됩니다. 이 상수는 NSData 함수에 대한 options 인수로 전달할 수 있으며, 이러한 함수로는
writeToFile(_:options:)
등이 있습니다. NSFileManagerNSData에 지정되는 다양한 데이터 보호 클래스 상수의 정의는 다음과 같습니다.

-NSFileProtectionComplete, NSDataWritingOptions.DataWritingFileProtectionComplete:
리소스가 암호화된 형식으로 디스크에 저장되며 장치가 잠겨 있거나 부팅되는 동안에는 리소스를 읽거나 쓸 수 없습니다.
iOS 4.0 이상에서 사용 가능합니다.
-NSFileProtectionCompleteUnlessOpen, NSDataWritingOptions.DataWritingFileProtectionCompleteUnlessOpen:
리소스가 암호화된 형식으로 디스크에 저장됩니다. 장치가 잠겨 있는 동안에도 리소스를 생성할 수 있지만 일단 닫힌 후에는 장치의 잠금이 해제될 때까지 다시 열 수 없습니다. 잠금이 해제되어 리소스가 열리면 사용자가 장치를 잠그더라도 계속해서 정상적으로 리소스에 접근할 수 있습니다.
iOS 5.0 이상에서 사용 가능합니다.
-NSFileProtectionCompleteUntilFirstUserAuthentication, NSDataWritingOptions.DataWritingFileProtectionCompleteUntilFirstUserAuthentication:
리소스가 암호화된 형식으로 디스크에 저장되며 장치의 부팅이 완료되기 전까지는 리소스에 접근할 수 없습니다. 사용자가 장치의 잠금을 처음 해제하고 나면 앱이 리소스에 접근할 수 있으며 사용자가 이후에 장치를 잠그더라도 계속 접근할 수 있습니다.
iOS 5.0 이상에서 사용 가능합니다.
-NSFileProtectionNone, NSDataWritingOptions.DataWritingFileProtectionNone:
리소스에 연관된 특수한 보호 기능이 없으므로 언제든지 읽거나 쓸 수 있습니다.
iOS 4.0 이상에서 사용 가능합니다.

데이터 보호 클래스가 명시적으로 할당되지 않은 파일을 포함하여 iOS 장치의 모든 파일은 암호화된 형식으로 저장되지만 NSFileProtectionNone을 지정하면 장치의 UID만을 토대로 파생된 키를 사용하여 암호화됩니다. 이렇게 되면 암호로 잠겨 있는 경우나 부팅할 때를 비롯해 장치가 켜져 있을 때는 언제든지 이러한 파일에 접근할 수 있게 됩니다. NSFileProtectionNone을 이와 같이 사용하는 경우 신중하게 검토하여 더 엄격한 데이터 보호 클래스를 통한 추가 보호가 보증되는지를 확인해야 합니다.

예제 1: 다음 예제에서는 지정된 파일이 보호되지 않습니다(장치가 켜져 있을 때는 언제든지 접근 가능).


...
let documentsPath = NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0])
let filename = "\(documentsPath)/tmp_activeTrans.txt"
let protection = [NSFileProtectionKey: NSFileProtectionNone]
do {
try NSFileManager.defaultManager().setAttributes(protection, ofItemAtPath: filename)
} catch let error as NSError {
NSLog("Unable to change attributes: \(error.debugDescription)")
}
...
BOOL ok = textToWrite.writeToFile(filename, atomically:true)
...
예제 2: 다음 예에서는 지정된 데이터가 보호되지 않습니다(장치가 켜져 있을 때는 언제든지 접근 가능).


...
let documentsPath = NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0])
let filename = "\(documentsPath)/tmp_activeTrans.txt"
...
BOOL ok = textData.writeToFile(filepath, options: .DataWritingFileProtectionNone);
...
References
[1] iOS Security Guide Apple
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark complete
[8] Standards Mapping - Common Weakness Enumeration CWE ID 311
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[10] Standards Mapping - FIPS200 MP
[11] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[14] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[15] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[16] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[17] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[18] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[19] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[20] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3)
[21] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[22] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[23] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[29] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 7.1 - Use of Cryptography
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[32] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[33] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[34] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.structural.swift.insecure_storage_lacking_data_protection
Abstract
식별된 메서드는 충분한 암호화 설정이 없는 키 집합에 데이터를 저장합니다.
Explanation
키 집합 액세스 가능성 상수는 응용 프로그램이 키 집합의 항목에 액세스해야 하는 경우를 선언할 수 있도록 하기 위한 것입니다. 개발자는 지정된 키 집합 항목에 대한 액세스 가능성 상수 중 하나를 지정하여 기본 파일 시스템이 이를 암호화할 때 장치의 UID와 사용자의 암호 모두에서 파생된 키를 사용할지 아니면 장치의 UID만 기반으로 하는 키를 사용할지를(그리고 이를 자동으로 해독하는 시점) 지시할 수 있습니다.

키 집합 액세스 가능성 상수는 키 집합 특성 dictionary에서 kSecAttrAccessible 키에 대한 값으로 할당됩니다. 다양한 키 집합 액세스 가능성 상수에 대한 정의는 다음과 같습니다.

-kSecAttrAccessibleAfterFirstUnlock:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlways:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly:
장치가 잠금 해제되었을 때만 키 집합의 데이터에 액세스할 수 있습니다. 장치에 암호가 설정된 경우에만 사용할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 백업이 새 장치로 복원된 후에는 이러한 항목이 없어집니다. 암호가 없는 장치에서는 이 클래스에 항목을 저장할 수 없습니다. 장치 암호를 비활성화하면 이 클래스의 모든 항목이 삭제됩니다.
iOS 8.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlwaysThisDeviceOnly:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlocked:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
액세스 가능성 상수를 명시적으로 설정하지 않고 추가된 키 집합 항목에 대한 기본값입니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlockedThisDeviceOnly:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

키 집합 액세스 가능성 상수가 명시적으로 할당되지 않은 파일을 포함하여 iOS 장치의 모든 파일은 암호화된 형식으로 저장되지만 kSecAttrAccessibleAlways을 지정하면 장치의 UID만을 기반으로 하여 파생된 키를 사용하여 암호화됩니다. 이렇게 되면 암호로 잠겨 있는 경우나 부팅할 때를 비롯해 장치가 켜져 있을 때는 언제든지 이러한 파일에 접근할 수 있게 됩니다. kSecAttrAccessibleAlways의 사용을 신중하게 검토하여 더 엄격한 키 집합 액세스 가능성 수준으로 추가 보호가 보증되는지 확인해야 합니다.

예제 1: 다음 예제에서는 지정된 파일이 보호되지 않습니다(장치가 켜져 있을 때는 언제든지 접근 가능).


...
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
NSData *token = [@"secret" dataUsingEncoding:NSUTF8StringEncoding];

// Configure KeyChain Item
[dict setObject:(__bridge id)kSecClassGenericPassword forKey:(__bridge id) kSecClass];
[dict setObject:token forKey:(__bridge id)kSecValueData];
...
[dict setObject:(__bridge id)kSecAttrAccessibleAlways forKey:(__bridge id) kSecAttrAccessible];

OSStatus error = SecItemAdd((__bridge CFDictionaryRef)dict, NULL);
...
References
[1] iOS Security Guide Apple: October 2014
[2] Keychain Services Apple
[3] Keychain Item Accessibility Constants Apple
[4] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[5] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[6] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[7] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[8] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[9] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[10] Standards Mapping - CIS Kubernetes Benchmark complete
[11] Standards Mapping - Common Weakness Enumeration CWE ID 311, CWE ID 312, CWE ID 313, CWE ID 522
[12] Standards Mapping - Common Weakness Enumeration Top 25 2019 [13] CWE ID 287
[13] Standards Mapping - Common Weakness Enumeration Top 25 2020 [14] CWE ID 287, [18] CWE ID 522
[14] Standards Mapping - Common Weakness Enumeration Top 25 2021 [14] CWE ID 287, [21] CWE ID 522
[15] Standards Mapping - Common Weakness Enumeration Top 25 2022 [14] CWE ID 287
[16] Standards Mapping - Common Weakness Enumeration Top 25 2023 [13] CWE ID 287
[17] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[18] Standards Mapping - FIPS200 MP
[19] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[20] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[21] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[22] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[23] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[24] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[25] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[26] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[27] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[28] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 2.7.1 Out of Band Verifier Requirements (L1 L2 L3), 2.7.2 Out of Band Verifier Requirements (L1 L2 L3), 2.7.3 Out of Band Verifier Requirements (L1 L2 L3), 2.8.4 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.8.5 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.10.2 Service Authentication Requirements (L2 L3), 2.10.3 Service Authentication Requirements (L2 L3), 3.7.1 Defenses Against Session Management Exploits (L1 L2 L3), 6.1.1 Data Classification (L2 L3), 6.1.2 Data Classification (L2 L3), 6.1.3 Data Classification (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3), 8.2.2 Client-side Data Protection (L1 L2 L3), 9.2.3 Server Communications Security Requirements (L2 L3)
[29] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[30] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[31] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[32] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[33] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[34] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[35] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[36] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[37] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 7.1 - Use of Cryptography
[38] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[39] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[40] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[41] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[42] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[49] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[56] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[57] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[58] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[59] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[60] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[61] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[62] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[63] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.objc.insecure_storage_lacking_keychain_protection
Abstract
식별된 메서드는 충분한 암호화 설정이 없는 키 집합에 데이터를 저장합니다.
Explanation
키 집합 액세스 가능성 상수는 응용 프로그램이 키 집합의 항목에 액세스해야 하는 경우를 선언할 수 있도록 하기 위한 것입니다. 개발자는 지정된 키 집합 항목에 대한 액세스 가능성 상수 중 하나를 지정하여 기본 파일 시스템이 이를 암호화할 때 장치의 UID와 사용자의 암호 모두에서 파생된 키를 사용할지 아니면 장치의 UID만 기반으로 하는 키를 사용할지를(그리고 이를 자동으로 해독하는 시점) 지시할 수 있습니다.

키 집합 액세스 가능성 상수는 키 집합 특성 dictionary에서 kSecAttrAccessible 키에 대한 값으로 할당됩니다. 다양한 키 집합 액세스 가능성 상수에 대한 정의는 다음과 같습니다.

-kSecAttrAccessibleAfterFirstUnlock:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlways:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly:
장치가 잠금 해제되었을 때만 키 집합의 데이터에 액세스할 수 있습니다. 장치에 암호가 설정된 경우에만 사용할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 백업이 새 장치로 복원된 후에는 이러한 항목이 없어집니다. 암호가 없는 장치에서는 이 클래스에 항목을 저장할 수 없습니다. 장치 암호를 비활성화하면 이 클래스의 모든 항목이 삭제됩니다.
iOS 8.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlwaysThisDeviceOnly:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlocked:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
액세스 가능성 상수를 명시적으로 설정하지 않고 추가된 키 집합 항목에 대한 기본값입니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlockedThisDeviceOnly:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

키 집합 액세스 가능성 상수가 명시적으로 할당되지 않은 파일을 포함하여 iOS 장치의 모든 파일은 암호화된 형식으로 저장되지만 kSecAttrAccessibleAlways을 지정하면 장치의 UID만을 기반으로 하여 파생된 키를 사용하여 암호화됩니다. 이렇게 되면 암호로 잠겨 있는 경우나 부팅할 때를 비롯해 장치가 켜져 있을 때는 언제든지 이러한 파일에 접근할 수 있게 됩니다. kSecAttrAccessibleAlways의 사용을 신중하게 검토하여 더 엄격한 키 집합 액세스 가능성 수준으로 추가 보호가 보증되는지 확인해야 합니다.

예제 1: 다음 예제에서는 지정된 파일이 보호되지 않습니다(장치가 켜져 있을 때는 언제든지 접근 가능).


...
// Configure KeyChain Item
let token = "secret"
var query = [String : AnyObject]()
query[kSecClass as String] = kSecClassGenericPassword
query[kSecValueData as String] = token as AnyObject?
...
query[kSecAttrAccessible as String] = kSecAttrAccessibleAlways

SecItemAdd(query as CFDictionary, nil)
...
References
[1] iOS Security Guide Apple: October 2014
[2] Keychain Services Apple
[3] Keychain Item Accessibility Constants Apple
[4] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[5] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[6] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[7] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[8] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[9] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[10] Standards Mapping - CIS Kubernetes Benchmark complete
[11] Standards Mapping - Common Weakness Enumeration CWE ID 311, CWE ID 312, CWE ID 313, CWE ID 522
[12] Standards Mapping - Common Weakness Enumeration Top 25 2019 [13] CWE ID 287
[13] Standards Mapping - Common Weakness Enumeration Top 25 2020 [14] CWE ID 287, [18] CWE ID 522
[14] Standards Mapping - Common Weakness Enumeration Top 25 2021 [14] CWE ID 287, [21] CWE ID 522
[15] Standards Mapping - Common Weakness Enumeration Top 25 2022 [14] CWE ID 287
[16] Standards Mapping - Common Weakness Enumeration Top 25 2023 [13] CWE ID 287
[17] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[18] Standards Mapping - FIPS200 MP
[19] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[20] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[21] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[22] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[23] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[24] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[25] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[26] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[27] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[28] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 2.7.1 Out of Band Verifier Requirements (L1 L2 L3), 2.7.2 Out of Band Verifier Requirements (L1 L2 L3), 2.7.3 Out of Band Verifier Requirements (L1 L2 L3), 2.8.4 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.8.5 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.10.2 Service Authentication Requirements (L2 L3), 2.10.3 Service Authentication Requirements (L2 L3), 3.7.1 Defenses Against Session Management Exploits (L1 L2 L3), 6.1.1 Data Classification (L2 L3), 6.1.2 Data Classification (L2 L3), 6.1.3 Data Classification (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3), 8.2.2 Client-side Data Protection (L1 L2 L3), 9.2.3 Server Communications Security Requirements (L2 L3)
[29] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[30] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[31] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[32] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[33] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[34] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[35] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[36] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[37] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 7.1 - Use of Cryptography
[38] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[39] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 7.1 - Use of Cryptography, Control Objective B.2.3 - Terminal Software Design
[40] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[41] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[42] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[49] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[56] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[57] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[58] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[59] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[60] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[61] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[62] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[63] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.swift.insecure_storage_lacking_keychain_protection
Abstract
식별된 메서드는 암호화되지 않은 데이터베이스에 대한 연결을 설정합니다.
Explanation
응용 프로그램 파일은 루팅된 장치의 다른 응용 프로그램이나 암호화되지 않은 백업에서 액세스할 수 있습니다. 사용자가 자신의 장치를 탈옥하거나 암호화되지 않은 백업을 수행하기로 결정할 수 있기 때문에, 민감한 데이터가 포함된 데이터베이스는 암호화하는 것이 좋습니다.

예제 1: 다음 코드는 암호화되지 않은 Realm 데이터베이스에 대한 연결을 설정합니다.


Realm realm = Realm.getDefaultInstance();
References
[1] Realm Database Encryption Realm
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark complete
[8] Standards Mapping - Common Weakness Enumeration CWE ID 311
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002475
[10] Standards Mapping - FIPS200 MP
[11] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[14] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[15] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[16] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[17] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[18] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[19] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[20] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3)
[21] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[22] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[23] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[29] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography, Control Objective B.2.5 - Terminal Software Design
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography, Control Objective B.2.5 - Terminal Software Design
[32] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[33] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[34] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002340 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002340 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002340 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002340 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002340 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002340 CAT II
[55] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.java.insecure_storage_missing_database_encryption
Abstract
식별된 메서드는 암호화되지 않은 데이터베이스에 대한 연결을 설정합니다.
Explanation
응용 프로그램 파일은 루팅된 장치의 다른 응용 프로그램이나 암호화되지 않은 백업에서 액세스할 수 있습니다. 사용자가 자신의 장치를 탈옥하거나 암호화되지 않은 백업을 수행하기로 결정할 수 있기 때문에, 민감한 데이터가 포함된 데이터베이스는 암호화하는 것이 좋습니다.

예제 1: 다음 코드는 암호화되지 않은 Realm 데이터베이스에 대한 연결을 설정합니다.


RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];
RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];
References
[1] Realm Cocoa Tutorial: Encryption with Realm Realm
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark complete
[8] Standards Mapping - Common Weakness Enumeration CWE ID 311
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002475
[10] Standards Mapping - FIPS200 MP
[11] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[14] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[15] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[16] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[17] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[18] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[19] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[20] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3)
[21] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[22] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[23] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[29] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography, Control Objective B.2.5 - Terminal Software Design
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography, Control Objective B.2.5 - Terminal Software Design
[32] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[33] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[34] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002340 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002340 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002340 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002340 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002340 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002340 CAT II
[55] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.objc.insecure_storage_missing_database_encryption
Abstract
식별된 메서드는 암호화되지 않은 데이터베이스에 대한 연결을 설정합니다.
Explanation
응용 프로그램 파일은 탈옥된 장치의 다른 응용 프로그램이나 암호화되지 않은 백업에서 액세스할 수 있습니다. 사용자가 자신의 장치를 탈옥하거나 암호화되지 않은 백업을 수행할지 여부는 응용 프로그램 개발자가 결정할 수 없기 때문에, 민감한 데이터가 포함된 데이터베이스는 암호화하는 것이 좋습니다.

예제 1: 다음 코드는 암호화되지 않은 Realm 데이터베이스에 대한 연결을 설정합니다.


let realm = try! Realm()
References
[1] Realm Cocoa Tutorial: Encryption with Realm Realm
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark complete
[8] Standards Mapping - Common Weakness Enumeration CWE ID 311
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002475
[10] Standards Mapping - FIPS200 MP
[11] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[14] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[15] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[16] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[17] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[18] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[19] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[20] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3)
[21] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[22] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[23] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[29] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography, Control Objective B.2.5 - Terminal Software Design
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography, Control Objective B.2.5 - Terminal Software Design
[32] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[33] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[34] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002340 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002340 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002340 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002340 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002340 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002340 CAT II
[55] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.swift.insecure_storage_missing_database_encryption
Abstract
식별된 메서드는 암호화되지 않은 데이터를 iOS의 사진 앨범에 작성합니다.
Explanation
iOS의 사진 앨범에 저장된 파일은 누구나 읽을 수 있고 장치의 모든 응용 프로그램에서 접근할 수 있습니다. 이를 통해 공격자는 모바일 수표에 사용되는 수표의 사진 같은 민감한 사진을 훔칠 수 있습니다.

예제 1: 다음 코드에서는 UIImageWriteToSavedPhotosAlbum을 사용하여 이미지를 사진 앨범에 저장합니다.


- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];

// Save image
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

...
}
References
[1] iOS Security Guide Apple
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark complete
[8] Standards Mapping - Common Weakness Enumeration CWE ID 313, CWE ID 359, CWE ID 921
[9] Standards Mapping - Common Weakness Enumeration Top 25 2019 [4] CWE ID 200
[10] Standards Mapping - Common Weakness Enumeration Top 25 2020 [7] CWE ID 200
[11] Standards Mapping - Common Weakness Enumeration Top 25 2021 [20] CWE ID 200
[12] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002475
[13] Standards Mapping - FIPS200 MP
[14] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[15] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[16] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[17] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[18] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[19] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[20] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[21] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[22] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[23] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 6.1.1 Data Classification (L2 L3), 6.1.2 Data Classification (L2 L3), 6.1.3 Data Classification (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3), 8.2.2 Client-side Data Protection (L1 L2 L3), 8.3.4 Sensitive Private Data (L1 L2 L3), 10.2.1 Malicious Code Search (L2 L3)
[24] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[25] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[26] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[29] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[30] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[31] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[32] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[33] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[34] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[35] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[36] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[37] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002340 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002340 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002340 CAT II
[55] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002340 CAT II
[56] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002340 CAT II
[57] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002340 CAT II
[58] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.structural.objc.insecure_storage_missing_encryption_on_stored_private_media
Abstract
식별된 메서드는 암호화되지 않은 데이터를 iOS의 사진 앨범에 작성합니다.
Explanation
iOS의 사진 앨범에 저장된 파일은 누구나 읽을 수 있고 장치의 모든 응용 프로그램에서 접근할 수 있습니다. 이를 통해 공격자는 모바일 수표에 사용되는 수표의 사진 같은 민감한 사진을 훔칠 수 있습니다.

예제 1: 다음 코드에서는 UIImageWriteToSavedPhotosAlbum을 사용하여 이미지를 사진 앨범에 저장합니다.


func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
imageView.contentMode = .ScaleAspectFit
imageView.image = pickedImage
}

// Save image
UIImageWriteToSavedPhotosAlbum(pickedImage!, self, nil, nil)

dismissViewControllerAnimated(true, completion: nil)
}
References
[1] iOS Security Guide Apple
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 4
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark complete
[8] Standards Mapping - Common Weakness Enumeration CWE ID 313, CWE ID 359, CWE ID 921
[9] Standards Mapping - Common Weakness Enumeration Top 25 2019 [4] CWE ID 200
[10] Standards Mapping - Common Weakness Enumeration Top 25 2020 [7] CWE ID 200
[11] Standards Mapping - Common Weakness Enumeration Top 25 2021 [20] CWE ID 200
[12] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002475
[13] Standards Mapping - FIPS200 MP
[14] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[15] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[16] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[17] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[18] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[19] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[20] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[21] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[22] Standards Mapping - OWASP Top 10 2021 A02 Cryptographic Failures
[23] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 6.1.1 Data Classification (L2 L3), 6.1.2 Data Classification (L2 L3), 6.1.3 Data Classification (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3), 8.2.2 Client-side Data Protection (L1 L2 L3), 8.3.4 Sensitive Private Data (L1 L2 L3), 10.2.1 Malicious Code Search (L2 L3)
[24] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[25] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[26] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[29] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[30] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[31] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[32] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[33] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[34] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[35] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[36] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[37] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002340 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002340 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002340 CAT II
[55] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002340 CAT II
[56] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002340 CAT II
[57] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002340 CAT II
[58] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.structural.swift.insecure_storage_missing_encryption_on_stored_private_media
Abstract
식별된 메서드는 사용자에게 이 장치의 암호를 설정하도록 강제하지 않고 키 집합에 데이터를 저장합니다.
Explanation
키 집합 액세스 가능성 수준은 키 집합 항목을 해독하고 응용 프로그램이 사용할 수 있는 경우를 정의합니다. 가능한 액세스 가능성 수준에는 다음이 포함됩니다.

-kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlways:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly:
장치가 잠금 해제되었을 때만 키 집합의 데이터에 액세스할 수 있습니다. 장치에 암호가 설정된 경우에만 사용할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 백업이 새 장치로 복원된 후에는 이러한 항목이 없어집니다. 암호가 없는 장치에서는 이 클래스에 항목을 저장할 수 없습니다. 장치 암호를 비활성화하면 이 클래스의 모든 항목이 삭제됩니다.
iOS 8.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlwaysThisDeviceOnly:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlocked:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
액세스 가능성 상수를 명시적으로 설정하지 않고 추가된 키 집합 항목에 대한 기본값입니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlockedThisDeviceOnly:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

키 집합 항목이 kSecAttrAccessibleWhenUnlocked와 같은 충분히 안전한 정책을 사용하여 저장되는 경우에는, 장치가 도난 당하더라도 암호가 설정되어 있으면 장치의 잠금을 해제해야 키 집합 항목을 해독할 수 있습니다. 올바른 암호를 입력하지 않으면 키 집합 항목을 해독할 수 없습니다. 하지만 암호를 설정하지 않은 경우에는 공격자가 손가락으로 화면을 밀어 장치를 잠금 해제한 다음 키 집합을 찾아서 해당 항목을 해독할 수 있습니다. 따라서 장치에서 암호 사용을 강제하지 않으면 키 집합 암호화 메커니즘이 취약해질 수 있습니다.

예제 1: 다음 예제에서는 키 집합 항목이 장치가 켜져 잠금 해제된 경우 이외에는 항상 보호되지만 장치에서 암호가 설정되지 않은 경우에도 사용 가능합니다.


...
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
NSData *token = [@"secret" dataUsingEncoding:NSUTF8StringEncoding];

// Configure KeyChain Item
[dict setObject:(__bridge id)kSecClassGenericPassword forKey:(__bridge id) kSecClass];
[dict setObject:token forKey:(__bridge id)kSecValueData];
...
[dict setObject:(__bridge id)kSecAttrAccessibleWhenUnlockedThisDeviceOnly forKey:(__bridge id) kSecAttrAccessible];

OSStatus error = SecItemAdd((__bridge CFDictionaryRef)dict, NULL);
...
References
[1] Keychain Services Apple
[2] Keychain Item Accessibility Constants Apple
[3] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[4] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[5] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4
[6] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[7] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[8] Standards Mapping - Common Weakness Enumeration CWE ID 311, CWE ID 312, CWE ID 313, CWE ID 522
[9] Standards Mapping - Common Weakness Enumeration Top 25 2019 [13] CWE ID 287
[10] Standards Mapping - Common Weakness Enumeration Top 25 2020 [14] CWE ID 287, [18] CWE ID 522
[11] Standards Mapping - Common Weakness Enumeration Top 25 2021 [14] CWE ID 287, [21] CWE ID 522
[12] Standards Mapping - Common Weakness Enumeration Top 25 2022 [14] CWE ID 287
[13] Standards Mapping - Common Weakness Enumeration Top 25 2023 [13] CWE ID 287
[14] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[15] Standards Mapping - FIPS200 MP
[16] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[17] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[18] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[19] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[20] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[21] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[22] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[23] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[24] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[25] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 2.7.1 Out of Band Verifier Requirements (L1 L2 L3), 2.7.2 Out of Band Verifier Requirements (L1 L2 L3), 2.7.3 Out of Band Verifier Requirements (L1 L2 L3), 2.8.4 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.8.5 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.10.2 Service Authentication Requirements (L2 L3), 2.10.3 Service Authentication Requirements (L2 L3), 3.7.1 Defenses Against Session Management Exploits (L1 L2 L3), 6.1.1 Data Classification (L2 L3), 6.1.2 Data Classification (L2 L3), 6.1.3 Data Classification (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3), 8.2.2 Client-side Data Protection (L1 L2 L3), 9.2.3 Server Communications Security Requirements (L2 L3)
[26] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[27] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[28] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[29] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[30] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[31] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[32] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[33] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[34] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[35] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[36] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[37] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[38] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[39] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[56] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[57] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[58] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[59] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[60] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.objc.insecure_storage_passcode_policy_unenforced
Abstract
식별된 메서드는 사용자에게 이 장치의 암호를 설정하도록 강제하지 않고 키 집합에 데이터를 저장합니다.
Explanation
키 집합 액세스 가능성 수준은 키 집합 항목을 해독하고 응용 프로그램이 사용할 수 있는 경우를 정의합니다. 가능한 액세스 가능성 수준에는 다음이 포함됩니다.

-kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly:
재시작 후 사용자가 장치를 한 번 잠금 해제하기 전까지는 키 집합 항목의 데이터에 액세스할 수 없습니다.
처음 잠금 해제 후에는 다음 재시작까지 계속 액세스 가능한 상태로 유지됩니다. 백그라운드 응용 프로그램이 액세스해야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlways:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly:
장치가 잠금 해제되었을 때만 키 집합의 데이터에 액세스할 수 있습니다. 장치에 암호가 설정된 경우에만 사용할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 백업이 새 장치로 복원된 후에는 이러한 항목이 없어집니다. 암호가 없는 장치에서는 이 클래스에 항목을 저장할 수 없습니다. 장치 암호를 비활성화하면 이 클래스의 모든 항목이 삭제됩니다.
iOS 8.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleAlwaysThisDeviceOnly:
장치가 잠겼는지 여부에 관계 없이 키 집합 항목의 데이터에 언제나 액세스할 수 있습니다.
응용 프로그램 사용에 권장하지 않습니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlocked:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 암호화된 백업을 사용할 때 새 장치로 마이그레이션됩니다.
액세스 가능성 상수를 명시적으로 설정하지 않고 추가된 키 집합 항목에 대한 기본값입니다.
iOS 4.0 이상에서 사용 가능합니다.

-kSecAttrAccessibleWhenUnlockedThisDeviceOnly:
사용자가 장치를 잠금 해제하고 있을 때만 키 집합 항목의 데이터에 액세스할 수 있습니다.
응용 프로그램이 전경에 있을 때만 액세스할 수 있어야 하는 항목에 권장합니다. 이 특성이 지정된 항목은 새 장치로 마이그레이션되지 않습니다. 따라서 다른 장치의 백업에서 복원된 후에는 이러한 항목이 존재하지 않습니다.
iOS 4.0 이상에서 사용 가능합니다.

키 집합 항목이 kSecAttrAccessibleWhenUnlocked와 같은 충분히 안전한 정책을 사용하여 저장되는 경우에는, 장치가 도난 당하더라도 암호가 설정되어 있으면 장치의 잠금을 해제해야 키 집합 항목을 해독할 수 있습니다. 올바른 암호를 입력하지 않으면 키 집합 항목을 해독할 수 없습니다. 하지만 암호를 설정하지 않은 경우에는 공격자가 손가락으로 화면을 밀어 장치를 잠금 해제한 다음 키 집합을 찾아서 해당 항목을 해독할 수 있습니다. 따라서 장치에서 암호 사용을 강제하지 않으면 키 집합 암호화 메커니즘이 취약해질 수 있습니다.

예제 1: 다음 예제에서는 키 집합 항목이 장치가 켜져 잠금 해제된 경우 이외에는 항상 보호되지만 장치에서 암호가 설정되지 않은 경우에도 사용 가능합니다.


...
// Configure KeyChain Item
let token = "secret"
var query = [String : AnyObject]()
query[kSecClass as String] = kSecClassGenericPassword
query[kSecValueData as String] = token as AnyObject?
...
query[kSecAttrAccessible as String] = kSecAttrAccessibleWhenUnlockedThisDeviceOnly

SecItemAdd(query as CFDictionary, nil)
...
References
[1] Keychain Services Apple
[2] Keychain Item Accessibility Constants Apple
[3] David Thiel iOS Application Security: The Definitive Guide for Hackers and Developers No Starch Press
[4] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1
[5] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4
[6] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[7] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[8] Standards Mapping - Common Weakness Enumeration CWE ID 311, CWE ID 312, CWE ID 313, CWE ID 522
[9] Standards Mapping - Common Weakness Enumeration Top 25 2019 [13] CWE ID 287
[10] Standards Mapping - Common Weakness Enumeration Top 25 2020 [14] CWE ID 287, [18] CWE ID 522
[11] Standards Mapping - Common Weakness Enumeration Top 25 2021 [14] CWE ID 287, [21] CWE ID 522
[12] Standards Mapping - Common Weakness Enumeration Top 25 2022 [14] CWE ID 287
[13] Standards Mapping - Common Weakness Enumeration Top 25 2023 [13] CWE ID 287
[14] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001350, CCI-002475
[15] Standards Mapping - FIPS200 MP
[16] Standards Mapping - General Data Protection Regulation (GDPR) Insufficient Data Protection
[17] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-28 Protection of Information at Rest (P1)
[18] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-28 Protection of Information at Rest
[19] Standards Mapping - OWASP Top 10 2004 A8 Insecure Storage
[20] Standards Mapping - OWASP Top 10 2007 A8 Insecure Cryptographic Storage
[21] Standards Mapping - OWASP Top 10 2010 A7 Insecure Cryptographic Storage
[22] Standards Mapping - OWASP Top 10 2013 A6 Sensitive Data Exposure
[23] Standards Mapping - OWASP Top 10 2017 A3 Sensitive Data Exposure
[24] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[25] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.6.3 Look-up Secret Verifier Requirements (L2 L3), 2.7.1 Out of Band Verifier Requirements (L1 L2 L3), 2.7.2 Out of Band Verifier Requirements (L1 L2 L3), 2.7.3 Out of Band Verifier Requirements (L1 L2 L3), 2.8.4 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.8.5 Single or Multi Factor One Time Verifier Requirements (L2 L3), 2.10.2 Service Authentication Requirements (L2 L3), 2.10.3 Service Authentication Requirements (L2 L3), 3.7.1 Defenses Against Session Management Exploits (L1 L2 L3), 6.1.1 Data Classification (L2 L3), 6.1.2 Data Classification (L2 L3), 6.1.3 Data Classification (L2 L3), 6.2.1 Algorithms (L1 L2 L3), 8.1.6 General Data Protection (L3), 8.2.2 Client-side Data Protection (L1 L2 L3), 9.2.3 Server Communications Security Requirements (L2 L3)
[26] Standards Mapping - OWASP Mobile 2014 M2 Insecure Data Storage
[27] Standards Mapping - OWASP Mobile 2024 M9 Insecure Data Storage
[28] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-STORAGE-1
[29] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.3
[30] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.3
[31] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.3
[32] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.3
[33] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[34] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[35] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[36] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 6.3 - Sensitive Data Protection, Control Objective 7 - Use of Cryptography
[37] Standards Mapping - SANS Top 25 2010 Porous Defenses - CWE ID 311
[38] Standards Mapping - SANS Top 25 2011 Porous Defenses - CWE ID 311
[39] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3210.1 CAT II, APP3310 CAT I, APP3340 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3210.1 CAT II, APP3340 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3210.1 CAT II, APP3340 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3210.1 CAT II, APP3340 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3210.1 CAT II, APP3340 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3210.1 CAT II, APP3340 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3210.1 CAT II, APP3340 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[55] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[56] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[57] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[58] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[59] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001350 CAT II, APSC-DV-002340 CAT II
[60] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
desc.dataflow.swift.insecure_storage_passcode_policy_unenforced