MASTG-TEST-0404: Runtime Verification of Accessibility Data Sensitivity
Overview¶
This test is the dynamic counterpart to References to Accessibility Data Sensitivity APIs.
If the views that display or accept sensitive data aren't accessibility data sensitive at runtime, any enabled accessibility service can read their content or perform interactions on them, regardless of how the app's layout files and code appear to configure them. For example, the app may change the setting of a view at runtime, or a view may lose the protection inherited from a parent. Even protected views remain accessible to accessibility services declared as accessibility tools, such as screen readers (see "Accessibility Tools" in Accessibility Data Sensitivity).
This test combines two approaches:
- Hook
setAccessibilityDataSensitiveandsetFilterTouchesWhenObscuredto capture when and where the app changes these settings. - Obtain the UI hierarchy of each screen that handles sensitive data, including the effective state of each view as returned by
isAccessibilityDataSensitiveandgetFilterTouchesWhenObscured. This reveals views that inherit the protection from a parent and views for which the app never configures the protection, which the hooks alone don't show.
Run this test on a device running Android 14 (API level 34) or higher, since the protection isn't available on earlier versions.
Steps¶
- Use Installing Apps to install the app.
- Use Method Hooking to hook the relevant API calls.
- Exercise the app extensively to trigger as many flows as possible and enter sensitive data wherever you can.
- Use Inspecting the UI Hierarchy to obtain the UI hierarchy of each screen that handles sensitive data, including the effective accessibility data sensitivity of each view.
- Use Taking Screenshots to take a screenshot of each screen that handles sensitive data.
Observation¶
The output should contain:
- The calls to
setAccessibilityDataSensitiveandsetFilterTouchesWhenObscuredwith their argument values and backtraces. - The UI hierarchy of each screen that handles sensitive data, including the class, resource ID, and hint or text of each view, and the values returned by
isAccessibilityDataSensitiveandgetFilterTouchesWhenObscured. - A screenshot of each screen that handles sensitive data.
Evaluation¶
The test case fails if any view that handles sensitive data returns false from isAccessibilityDataSensitive.
Further Validation Required:
Inspect the screenshots of the screens that handle sensitive data to determine which views display or accept sensitive information, such as credentials, one-time codes, payment details, or personal information. Match these views with the UI hierarchy of the same screen to determine whether they're protected.
Using the backtraces from the hook output, inspect the code locations using Reviewing Decompiled Java Code to determine whether the app disables the protection on sensitive views, for example, by calling setAccessibilityDataSensitive with ACCESSIBILITY_DATA_SENSITIVE_NO.
Without a tester monitoring the screens, there's no reliable way to determine whether the displayed information is sensitive. Automated classification, for example with an LLM, can help, but it may miss the screens that display the data this API is intended to protect, so you must confirm the results manually.
Best Practices¶
MASTG-BEST-0075: Restricting Accessibility Service Access to Sensitive Views
Demos¶
MASTG-DEMO-0160: Runtime Accessibility Data Sensitivity of Sensitive Views with Frida