← Back to blog
TR

2026-10-15 · 7 min

MASWE-0024: the OWASP weakness with no test, and how to test it

OWASP lists “sensitive data accessible after session termination” as MASWE-0024, but no MASTG test is mapped to it. Here is a repeatable logout residue test for iOS, React Native, Flutter and Android.

Quick summary

  • • MASWE-0024 covers tokens and personal data that are still reachable after logout or a session timeout.
  • • No MASTG test is mapped to it. The closest, MASTG-TEST-0302 (iOS) and MASTG-TEST-0207 (Android), inspect the app's storage at runtime, by hand, and are not framed around logout.
  • • A logout residue test captures before and after logout, matches values by keyed hash and fails only on results you can trust.

What MASWE-0024 says

MASWE-0024, “Sensitive Data Accessible After Session Termination”, sits under MASVS-AUTH-3. The weakness is simple: after logout or a session timeout, tokens and personal data are still reachable on the device, in storage, caches, WebView data or memory.

The next person who uses the device, a backup, or a later bug can reach them. On shared devices (a clinician's tablet, a merchant terminal) the next user may be signed in to someone else's data.

Why there is no test

The OWASP MASTG has no test mapped to MASWE-0024. The closest is MASTG-TEST-0302 on iOS: a manual before/after comparison of the app's private storage and Keychain while you exercise the app. On Android, MASTG-TEST-0207 inspects data stored in the app sandbox at runtime. OWASP deprecated its process-memory test (MASTG-TEST-0060) without a replacement.

None of these is framed around logout. The question MASWE-0024 asks is not how a value is stored, but whether it is still there once the session has ended.

A repeatable logout residue test

1. Run a debug build and log in with a test account. 2. Capture the app's private storage (preferences, databases, caches, WebView data, files) and, where the result is reliable, its memory. 3. Log out the way a user would. 4. Capture again.

5. Compare by value, not by location. Hash each secret with a key so you can match it even if it moved to another file or address, without writing the value anywhere. 6. Fail on what survived on disk. Treat memory-only survivors as evidence, and fail on them only where the runtime makes the result reliable.

Use a canary when you can: a fake token that the app generates in debug builds instead of the real one. If any copy of it survives, the test fails, with no doubt about whether the string was sensitive.

Where tokens usually survive

iOS (Swift): URLCache (Cache.db), UserDefaults, Core Data and SQLite (including the -wal file), cookies, and Keychain items that logout forgot to delete.

React Native: AsyncStorage (redux-persist's persist:root), MMKV, an auth SDK's session key such as Supabase or Firebase, and Sentry's user scope.

Flutter: shared_preferences keys under flutter.*, Hive boxes, and HTTP caches such as dio's.

Android: SharedPreferences XML, DataStore, Room databases, WebView cookies and local storage, and the OkHttp cache.

Reading the result honestly

A PASS only means something when the capture covered most of the app's writable memory and every source was read. Otherwise the honest verdict is INCOMPLETE.

In React Native and Flutter, freed strings in the JavaScript or Dart heap stay until the garbage collector reuses the page. Memory-only hits there are evidence, not a failing test; the gate should rest on storage and on tracking the values you saw before logout.

Automating it

WatchMemory automates this check: residue capture before and after logout, compare, and a PASS / FAIL / INCOMPLETE verdict, on the iOS Simulator and for debuggable Android builds (beta). Results map to MASWE-0024, MASVS-STORAGE and MASVS-AUTH-3.

It gives you evidence; it doesn't make an app compliant or certified. OWASP doesn't certify apps or tools.

FAQ

Is MASWE-0024 the same as insecure storage?

They overlap. Insecure storage (MASVS-STORAGE-1) is about how data is stored; MASWE-0024 is about whether it is still there after the session ends. A token can be stored correctly in the Keychain and still survive logout.

Does the Keychain count?

Yes. A refresh token left in the Keychain after logout is a common finding. WatchMemory doesn't inspect the Keychain yet, so cover it in your logout code and tests until it does.

For more guides, visit WatchMemory Blog.

WatchMemory's Mac app is local-first: scans stay on your machine. Web analytics are privacy-friendly and used only to improve the website.