Rule Definition
Insecure data storage vulnerabilities occur when development teams assume that users or malware will not have access to a mobile device's filesystem and subsequent sensitive information in data-stores on the device.
If the program does not ensure that the user is only requesting private files, then the user might be able to access other files on the system.
Remediation
Instead of using NSFileProtectionNone or NSURLFileProtectionNone options, please use one of the following option:
- NSFileProtectionComplete
- NSFileProtectionCompleteUnlessOpen
- NSFileProtectionCompleteUntilFirstUserAuthentication
- NSURLFileProtectionComplete
- NSURLFileProtectionCompleteUnlessOpen
- NSURLFileProtectionCompleteUntilFirstUserAuthentication
Violation Code Sample
[[NSFileManager defaultManager] createFileAtPath:PATH contents:someData attributes:@{NSFileProtectionKey:NSFileProtectionNone}];
[[NSFileManager defaultManager] createFileAtPath:PATH contents:someData attributes:@{NSURLFileProtectionKey:NSURLFileProtectionNone}];
Fixed Code Sample
[[NSFileManager defaultManager] createFileAtPath:PATH contents:someData attributes:@{NSFileProtectionKey:NSFileProtectionComplete}];
[[NSFileManager defaultManager] createFileAtPath:PATH contents:someData attributes:@{NSURLFileProtectionKey:NSURLFileProtectionComplete}];
Reference
https://www.owasp.org/index.php/Mobile_Top_10_2016-M2-Insecure_Data_Storage
Related Technologies
Technical Criterion
Secure Coding - API Abuse
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.