-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Port MASTG-TEST-0058: Testing Backups for Sensitive Data (ios) (by @guardsquare) #3039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
serek8
wants to merge
11
commits into
OWASP:master
Choose a base branch
from
serek8:port-MASTG-TEST-0058
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
14f0617
Add a deprecation note
serek8 75cf7be
Improve phrasing in the test's overview
serek8 5d065de
Improve mitigation section
serek8 46b0fe5
Simplify the overview
serek8 c3111d4
Add a new dynamic test
serek8 adb6dfa
Add the test to the new coverage array
serek8 fd33d8e
Merge branch 'master' of github.com:serek8/owasp-mstg into port-MASTG…
serek8 3d29923
Apply suggestions from code review
serek8 6adab92
Merge branch 'port-MASTG-TEST-0058' of github.com:serek8/owasp-mstg i…
serek8 03c9ef3
Convert test to Frida
serek8 f0b950d
Fix markdown issues
serek8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
platform: ios | ||
title: Runtime Use of the Keychain API to Exclude Data from Backups and Prevent Access on Other Devices | ||
id: MASTG-TEST-0x58 | ||
type: [dynamic] | ||
weakness: MASWE-0004 | ||
--- | ||
|
||
## Overview | ||
|
||
This test verifies whether your app correctly use the Keychain API to exclude sensitive data from backups, so it won't be transferred to another devices. | ||
|
||
An app can restrict the data access to the current device with [kSecAttrAccessibleWhenUnlockedThisDeviceOnly](https://developer.apple.com/documentation/security/ksecattraccessiblewhenunlockedthisdeviceonly) or [kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly](https://developer.apple.com/documentation/security/ksecattraccessiblewhenpasscodesetthisdeviceonly) flag. However, if you back up and restore on the same device, this data will also be restored. Therefore, it only prevents the data from being transferred to another device. Apple discourages storing large amounts of data in the Keychain, so it's best to store only an encryption key there and keep the rest of the files in the filesystem. | ||
|
||
## Steps | ||
|
||
1. Use runtime method hooking (see @MASTG-TECH-0095) and look for uses of [`SecAccessControlCreateWithFlags`](https://developer.apple.com/documentation/security/secaccesscontrolcreatewithflags(_:_:_:_:)) and specific flags. | ||
|
||
2. Exercise the app to trigger the creation of entries in the keychain. | ||
|
||
## Observation | ||
|
||
The output should contain a list of locations where the `SecAccessControlCreateWithFlags` function is called including all used flags. | ||
|
||
## Evaluation | ||
|
||
The test case fails if the items in the Keychain don't satisfy your app's security requirements. For example, your app might store sensitive data that you want to keep accessible only on this device. Then, such an item in the Keychain should use `kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly` or `kSecAttrAccessibleWhenUnlockedThisDeviceOnly`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.