Keychain State Integrity Manipulation
keychain_state_integrity_manipulation HARD
| Category | Insecure Data Storage |
| OWASP Mobile (2024) | M9 |
| MASVS | MASVS-STORAGE-1MASVS-CRYPTO-2 |
| MASWE | MASWE-0001 |
| MASTG (v2 tests) | iOSMASTG-TEST-0387AndroidMASTG-TEST-0338 |
| MASTG demos | iOSMASTG-DEMO-0150AndroidMASTG-DEMO-0101 |
| CWE | CWE-345CWE-565CWE-472 |
| Platform | iOS |
Description
The app TRUSTS a Keychain/Keystore item as authoritative but a local attacker can MODIFY that stored state (not merely read it), so tampering with the item alters what the app authorizes or trusts - an integrity/state-manipulation failure distinct from secret confidentiality (iOS Keychain state-modification CVE-2026-28860 class).
How it works
The app treats a Keychain/Keystore item as an authoritative source of truth and acts on it, granting an admin privilege, with no integrity check. A local attacker who can modify the stored item (not merely read it) rewrites the entitlement blob to “role=admin” and is silently escalated. This is an integrity/state-manipulation failure distinct from secret confidentiality (iOS Keychain state-modification CVE-2026-28860 class). On device the trusted entitlement blob and its weak integrity tag are persisted to a Keychain/UserDefaults item, so a local attacker can edit the value via a device backup or a jailbroken device. The secure path recomputes and verifies the MAC over the stored value and rejects the tampered item.
How to exercise it. DVMA is the harness - open this module from the home index and tap the demo action. The screen ships the malicious input and simulates the attacker (e.g. the companion app, crafted intent, or scanned payload) in-process, and the evidence panel prints the proof. The Tools (optional) and Attack inputs below are only needed to reproduce the exploit end-to-end on a real device.
Exploit steps
- Set up. Build DVMA with a flavor that enables the Insecure Data Storage category (e.g.
--dart-define-from-file=config/flavors/dev.json) and run on an iOS simulator / a device you control. The demo needs no external tooling; for the optional on-device reproduction the relevant tools are:objection,frida,r2frida,keychain-dumper,plutil,xxd. - Locate the target. From the home index, open Keychain State Integrity Manipulation (
keychain_state_integrity_manipulation). The How it works section above describes this module’s specific weakness; the screen states the intended-secure behavior and exposes the vulnerable action. - Exploit. Exercise the flow that persists data, then inspect the app sandbox (
objection’sios nsuserdefaults/ios plist cat/ios keychain dumphelpers, or pull the container overifuse) and confirm the sensitive value is present in cleartext or without hardware backing. - Observe the evidence. Trigger the vulnerable action and read the evidence panel - it prints the concrete proof (leaked value, accepted replay, executed payload, or unauthorized result).
- Contrast with the secure path. Run the module’s secure/hardened action (where provided) and confirm the same attack is rejected - this is what a correct implementation should do.
- Map it back. Cross-reference the MASTG v2 test(s) MASTG-TEST-0387, MASTG-TEST-0338 for the canonical procedure and remediation.
Tools (optional)
Real-world references
Concrete public disclosures that match this vulnerability class: