MASWE-0055: Malware Detection Not Implemented
This note is part of our MASVS-RESILIENCE guide and covers OWASP MASWE-0055: an app that takes no notice of malware on the device it runs on. “Malware detection” here does not mean that your banking app should become an antivirus scanner. It means that the app, and above all its backend, should use the signals the platform offers about a hostile environment (Play Protect has found harmful apps, an untrusted app is capturing the screen or controlling the device, an accessibility service that is not an assistive tool is enabled, the screen is being recorded or shared during a call) and respond in proportion: warn, restrict, step up, hold, and apply the result to the account, not just to the one phone. Below you get the attack techniques this is about at a high level, every detection signal Android and iOS give an app with its version requirements and limits, three tests of our own because OWASP has none for this weakness, pointers to the overlay and accessibility best practices that sit next to it, and how to rate what you find. The UI-level defences themselves (blocking overlays, hiding views from accessibility services) are covered in depth in MASWE-0039 and MASWE-0040; device and app attestation in MASWE-0054 and MASWE-0056.
Contents
- Overview
- Modes of Introduction
- Impact
- Mitigations
- Background
- Tests
- Best practices
- Rating findings
- References
Overview
MASWE-0055 applies when an app with a high-value threat model does not detect, or does not respond to, malware and malicious components that could target it on the same device. The OWASP requirement is “The app detects attacks by malware.” It maps to MASVS-RESILIENCE-2 (“The app implements anti-tampering mechanisms”) and to CWE-693 (Protection Mechanism Failure). The weakness has no v1 mapping.
OWASP has no tests and no Knowledge pages for this weakness. MASWE-0055 links no MASTG tests, and no Knowledge item covers malware detection, so the three tests below (GT-RES-0055-1 to -3) are our own methodology and the knowledge section is called Background. The two OWASP Best Practices that matter, MASTG-BEST-0040 (overlays) and MASTG-BEST-0075 (accessibility), are documented in full in the PLATFORM notes; here they get pointers.
The weakness carries OWASP’s R profile (plus EUDIW). In practice it is about banking, payment, wallet, crypto and identity apps, and anything where on-device fraud pays: apps that banking trojans put on their target lists. For other apps a missing malware response is an observation. And as with every control in this series, the app-side part is defence in depth. A determined attacker with control of the device can defeat any local check; what makes the control worth having is the server-side decision and the account-level response.
OWASP describes the threat as MAS-THREAT-0055, “Attackers can target the app with malware running on the same device”, through two attacks:
| Attack | Description | Where the app-side defence lives |
|---|---|---|
| MAS-ATTACK-0036 | Displaying overlays or tampering with the UI to alter what the user sees while approving an action | Overlay protections (MASWE-0039); detection and risk response (this note) |
| MAS-ATTACK-0052 | Harvesting on-screen content through a malicious accessibility service the user was tricked into enabling | Accessibility data sensitivity (MASWE-0040); detection and risk response (this note) |
Note the attacker model. Unlike root detection (MASWE-0051), where the device owner is the adversary, here the user is the victim and the malware runs next to an unmodified copy of your app. Malware without root normally cannot patch your app’s process, so client-side signals are more meaningful than in the reverse-engineering scenarios. But malware with an accessibility service can read your screen and press your buttons, including “I understand the risk, continue”. A warning that one tap dismisses is not a control against an attacker who can tap.
Keep the neighbouring topics apart:
| Question | Where it lives |
|---|---|
| Can another app draw over sensitive screens or hijack taps? | MASWE-0039 |
| Can an accessibility service read passwords, OTPs or card data from the app’s views? | MASWE-0040 |
Are sensitive screens protected from screenshots and recording (FLAG_SECURE)? |
MASWE-0038 |
| Are OTPs or sensitive data shown in notifications that a listener can read? | MASWE-0037 |
| Does the backend get Google/Apple-verified device evidence? | MASWE-0054 |
| Does the app itself contain malicious code (a compromised SDK, a backdoor)? | MASWE-0048, not this note |
Modes of Introduction
No hostile-environment checks. The app never looks at Play Protect state, the Play Integrity environment signals, enabled accessibility services, screen capture state or active calls before sensitive flows.
Abuse-prone capabilities ignored. The app knows that an untrusted accessibility service is enabled or that the screen is being recorded, but this does not change anything in the payment, payee or credential flows. (The UI defences against those capabilities are missing too: see MASWE-0039 and MASWE-0040.)
No response strategy. A detection produces a log line or analytics event and nothing else.
Client-only, dismissable response. A dialog that the user (or the malware, through accessibility) closes with one tap, after which everything works as before. No signal reaches the backend.
Insufficient response strategy. The response is limited to the current device. OWASP singles this out: malware typically harvests credentials and OTPs and the criminals then onboard the account on their own, clean device, where your on-device checks find nothing. If a compromise is suspected, the risky follow-up actions (enrolling a new device, raising limits, adding payees) must be blocked or held at account level.
Over-blocking. The app refuses to run whenever any accessibility service is on. That locks out users of screen readers and switch access, pushes support teams to grant blanket exceptions, and in jurisdictions with accessibility legislation for banking services (such as the European Accessibility Act, applicable since June 2025) may itself be a compliance problem.
Signal collection without permission or visibility. QUERY_ALL_PACKAGES requested without a policy basis (and later removed after a Play rejection, silently disabling the check), or package-list scans that see nothing because of Android 11 package visibility.
Impact
- Credential and OTP theft. Accessibility services, overlays, notification listeners and screen streaming capture passwords, PINs, card data and one-time codes while the app takes no protective action.
- On-device fraud. Remote control of the real app in the victim’s real session, on the victim’s real device, which passes device checks, device binding and attestation because everything about the device and app is genuine.
- Account takeover on another device. Stolen credentials and OTPs used to onboard the account on an attacker’s device.
- Financial loss and liability. Fraud losses, reimbursement obligations (for example under UK authorised push payment reimbursement rules) and regulatory scrutiny of the bank’s fraud controls.
Mitigations
- Integrate platform threat signals on the server: Play Integrity
playProtectVerdictandappAccessRiskVerdicton Android (they come signed from Google, so malware cannot alter them); screen capture state on iOS reported with the request. - Assess risky capabilities locally before sensitive flows: enabled accessibility services that are not assistive tools, screen recording or sharing, an active call, and on Android 12+ hide third-party overlays on sensitive windows.
- Protect the UI regardless of detection with the MASWE-0039 and MASWE-0040 controls:
setHideOverlayWindows, touch filtering,accessibilityDataSensitive,FLAG_SECURE. - Respond proportionately and server-side. Warn, ask for out-of-band confirmation, add a delay, lower limits, or block; decide on the server where the response cannot be tapped away.
- Lock down the account, not just the device. After a suspected compromise, hold new-device enrolment, payee creation and limit increases across all of the user’s devices, and notify the user through a channel the malware does not control.
- Keep it current. Malware behaviour changes quickly; review signals and responses with your fraud team and your threat-intelligence sources, and measure false positives (especially among accessibility users).
Background
OWASP has no Knowledge pages for MASWE-0055. This section explains, at a high level, the techniques the weakness is about and then, in detail, the signals an app can use. We do not describe malware implementation; for the attack chain against accessibility in more depth see our MASWE-0040 note, and for overlays our MASWE-0039 note.
Android: how banking malware attacks other apps
Android banking trojans and remote-access fraud tools rely on a small set of platform capabilities that the user is persuaded to grant:
- Accessibility services. The core capability. An enabled service receives events about every app’s UI, reads the view tree (text, labels, sometimes passwords and OTPs), performs clicks and gestures, and can grant itself further permissions by tapping through the prompts.
- Overlays. Windows drawn over the target app (
SYSTEM_ALERT_WINDOW“display over other apps”, or overlays drawn by the accessibility service itself) to show fake login screens, hide what is happening underneath, or alter what the user approves. - SMS and notification interception.
RECEIVE_SMS/READ_SMSor a notification listener to read one-time codes, and to hide the bank’s alerts. - Screen recording and streaming. The
MediaProjectionAPI (the user sees a consent prompt and, on recent versions, a status-bar indicator) to watch the screen live, often combined with accessibility to drive it: a remote operator sees and controls the victim’s phone. - Legitimate remote-access tools. Social engineers on the phone talk victims into installing a mainstream remote-support app from the store, then use its screen sharing and control features. Nothing on the device is “malware” in the antivirus sense.
- Delivery and consent through social engineering. Smishing links, fake updates, droppers, and phone calls from someone posing as the bank’s fraud team who walks the victim through sideloading and enabling the service.
Two consequences shape the defence. First, on-device fraud happens on the genuine device in the genuine app, so attestation and device binding pass; only behaviour and environment signals can tell. Second, everything starts with the user granting a capability; the platform has been making that progressively harder (next section), and the app’s job is to notice the remaining risky states and respond.
Android: platform protections by version
| Version | Protection | What it means for an app |
|---|---|---|
| Google Play devices (Play Protect) | On-device and cloud scanning of all installed apps; harmful apps disabled or removed; warnings for non-Play installs | playProtectVerdict tells you whether it is on and what it found |
| Android 12 (API 31) | Window.setHideOverlayWindows(true) with HIDE_OVERLAY_WINDOWS hides non-system overlay windows over your window; untrusted touch blocking; AccessibilityServiceInfo.isAccessibilityTool() |
Use on sensitive screens; distinguish assistive tools from other services |
| Android 13 (API 33) | Restricted settings: the accessibility and notification-listener switches are blocked for apps installed outside session-based store installers until the user explicitly allows them in App info | Raises the bar for sideloaded malware, but social engineering includes the override step |
| Android 14 (API 34) | android:accessibilityDataSensitive / setAccessibilityDataSensitive() hides views from services that are not assistive tools; Activity.registerScreenCaptureCallback (DETECT_SCREEN_CAPTURE) reports screenshots |
See MASTG-BEST-0075; screenshot notification for sensitive screens |
| Android 15 (API 35) | WindowManager.addScreenRecordingCallback (DETECT_SCREEN_RECORDING) reports when the app’s activities are being recorded; restricted settings reported to cover more permissions |
Warn or pause sensitive flows during recording |
| Android 16 (API 36) | In-call protections: during a call with a non-contact the user cannot sideload apps or grant accessibility permissions (Play Protect cannot be turned off during such calls, from Android 6+); AdvancedProtectionManager exposes whether the user has enabled Advanced Protection |
Fewer successful scam scripts on new devices; an extra risk/assurance signal |
Google also announced a pilot in the UK in 2025 in which Android warns when a participating banking app is opened during screen sharing with an unknown caller. That is a platform feature, not an API you can test in an arbitrary app.
Android: detection signals available to an app
Play Integrity: appAccessRiskVerdict and playProtectVerdict
Both are optional Play Integrity signals that you enable in Play Console. They arrive inside the server-verified token (see MASWE-0054), so they cannot be faked by malware on the device. On Android 13+ they are only returned when Google Play installed or updated the requesting app.
environmentDetails.appAccessRiskVerdict.appsDetected lists one or more of:
| Response | Meaning |
|---|---|
KNOWN_INSTALLED, UNKNOWN_INSTALLED |
Apps are installed from Google Play or preloaded on the system partition (KNOWN_), or from other sources (UNKNOWN_) |
KNOWN_CAPTURING, UNKNOWN_CAPTURING |
Running apps hold permissions that could be used to view the screen while your app runs |
KNOWN_CONTROLLING, UNKNOWN_CONTROLLING |
Running apps hold permissions that could be used to control the device and inputs into your app |
KNOWN_OVERLAYS, UNKNOWN_OVERLAYS |
Running apps hold permissions that could be used to display overlays on your app |
| (empty) | Not evaluated: device not trustworthy enough, not a phone/tablet/foldable, Android below 6, app version unknown to Play, outdated Play Store, no Play licence, verdictOptOut used, or a library too old for app access risk in standard requests (1.4.0 or later needed) |
Verified accessibility services that passed Google Play’s enhanced accessibility review are excluded from capturing, controlling and overlay responses. Apps installed only in another profile (such as a work profile) are always reported with the UNKNOWN_ prefix. Google’s own example policy checks that appsDetected contains neither CAPTURING nor CONTROLLING, and Play offers remediation dialogs (CLOSE_UNKNOWN_ACCESS_RISK, CLOSE_ALL_ACCESS_RISK) that ask the user to close the apps responsible. Request this verdict as close as possible to the sensitive action; it describes the moment of the request.
environmentDetails.playProtectVerdict is one of NO_ISSUES (on, nothing found), NO_DATA (on, no scan yet), POSSIBLE_RISK (Play Protect is off), MEDIUM_RISK (on, potentially harmful apps found), HIGH_RISK (on, dangerous apps found) or UNEVALUATED. Google’s suggested handling: ask the user to turn Play Protect on for POSSIBLE_RISK/NO_DATA, ask them to act on Play Protect’s warnings for MEDIUM_RISK/HIGH_RISK, and block the server action if they cannot.
These are the most robust signals in this note, and they come with limits: they need Google Play and a Play-installed app, they cost quota and (for app access risk) latency, and “an app could capture the screen” includes plenty of legitimate apps. Use them as risk inputs, not as an automatic block.
Enabled accessibility services
val am = getSystemService(AccessibilityManager::class.java)
val services = am.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK)
val nonTools = services.filter { Build.VERSION.SDK_INT < 31 || !it.isAccessibilityTool }
.map { it.resolveInfo.serviceInfo.packageName }
getEnabledAccessibilityServiceList() (API 14) returns the enabled services; isAccessibilityTool() (API 31) reports the service’s android:isAccessibilityTool attribute. Keep in mind:
isAccessibilityToolis declared by the service itself. For apps on Google Play, Google’s policy and review restrict who may declare it; a sideloaded app can declare whatever it likes. Combine it with the install source where you can see it (PackageManager.getInstallSourceInfo(), API 30) and with the Play Integrity app access risk verdict, which excludes only services that passed Google’s review.- Treat the result as a risk input. TalkBack, Select to Speak, Switch Access, password managers, automation and parental-control apps are all accessibility services.
- The list describes the state now. Re-check when a sensitive screen opens, or listen with
AccessibilityManager.addAccessibilityStateChangeListener().
Overlays
An app cannot list other apps’ overlay windows. What it can do:
- Hide them:
window.setHideOverlayWindows(true)(API 31, permissionHIDE_OVERLAY_WINDOWS) on every sensitive window. - Notice them:
MotionEvent.FLAG_WINDOW_IS_OBSCUREDand (API 29)FLAG_WINDOW_IS_PARTIALLY_OBSCUREDon touches,filterTouchesWhenObscured. - Learn about them from the server:
KNOWN_OVERLAYS/UNKNOWN_OVERLAYSin the app access risk verdict.
The details and tests are in MASWE-0039.
Screen capture and recording
- Recording (Android 15+).
windowManager.addScreenRecordingCallback(executor, callback)with theDETECT_SCREEN_RECORDINGpermission returns the current state (SCREEN_RECORDING_STATE_VISIBLEorSCREEN_RECORDING_STATE_NOT_VISIBLE) and calls back on changes. Per the documentation the app counts as visible “if any activities owned by the registering process’s UID are being recorded”. Remove the callback withremoveScreenRecordingCallback()inonStop(). - Screenshots (Android 14+).
Activity.registerScreenCaptureCallback()withDETECT_SCREEN_CAPTUREreports screenshot attempts of that activity. - Prevention.
FLAG_SECUREon sensitive windows blacks them out in recordings, screenshots, casts and the recents screen; see MASWE-0038. Detection is for telling the user and the backend;FLAG_SECUREis what keeps the content out of the capture.
Not every capture path necessarily goes through MediaProjection; tools that capture over ADB, for example, may not trigger the callback. On a test device, record which capture paths the app notices (GT-RES-0055-2).
Calls and remote assistance
Scam-driven fraud usually happens while the victim is on the phone with the scammer. Apps can learn that a call is active:
AudioManager.getMode()returnsMODE_IN_CALLorMODE_IN_COMMUNICATIONduring telephony and VoIP calls, without a runtime permission.TelephonyManager.registerTelephonyCallback()with aTelephonyCallback.CallStateListener(API 31+) reports call state changes but requiresREAD_PHONE_STATE.
Combined with “screen is being recorded or shared” or “an app is controlling the device”, an active call on a payment screen is one of the strongest scam indicators available on the device. It needs careful UX: a warning that names the scam (“Is someone on the phone asking you to move money?”) works better than an error.
Installed packages and package visibility
Scanning the installed package list for known malicious package names was a common technique. Since Android 11 (API 30) package visibility filtering hides most other apps unless the app declares them in <queries> or holds QUERY_ALL_PACKAGES. Google Play treats QUERY_ALL_PACKAGES as a restricted permission: permitted uses include device search, antivirus apps, file managers and browsers, and there is an exception for apps whose verifiable core purpose is facilitating transactions with financially regulated instruments (dedicated banking and digital wallet apps), “solely for security-based purposes”. Other apps have to remove it. Even where it is allowed:
- package names are trivial for malware authors to randomise, so a name list catches yesterday’s samples;
- lists of signing-certificate digests or hashes are better but need a maintained threat feed;
- the inventory is sensitive personal data that must be declared in the Data safety section and must not be used for anything else.
Most apps are better served by the Play Integrity environment signals plus the capability checks above.
SafetyNet Verify Apps API
The SafetyNet Verify Apps API (SafetyNet.getClient(context)) is still available and lets an app check whether Google’s app verification is on (isVerifyAppsEnabled()), ask the user to turn it on (enableVerifyApps()) and list known potentially harmful apps with their package name, SHA-256 and category (listHarmfulApps(), for the current user). Google now recommends using the Play Integrity API to check Play Protect status instead. The key difference for testers: Verify Apps results come back to the app and are reported to the backend by the app, while playProtectVerdict reaches the backend inside a Google-signed token. Do not confuse it with the SafetyNet Attestation API, which was turned down in January 2025.
Advanced Protection mode
On Android 16, AdvancedProtectionManager.isAdvancedProtectionEnabled() (permission QUERY_ADVANCED_PROTECTION_MODE) tells the app whether the user has opted into Android’s Advanced Protection mode, which turns on a set of platform restrictions for at-risk users. It is a signal that the device is in a hardened configuration, useful to relax friction rather than to detect malware.
iOS: threat model and available signals
iOS does not have Android’s malware landscape. Third-party apps cannot read other apps’ screens, there is no equivalent of accessibility-service malware, and apps cannot draw over other apps. The realistic threats for a high-value iOS app are:
- Screen sharing and recording driven by social engineering: a scammer on a call persuades the victim to share their screen (through a video-call app’s screen-sharing feature, which uses a ReplayKit broadcast extension) and reads codes and balances as they appear.
- Phishing and credential harvesting outside the app, followed by onboarding on the attacker’s device: the account-level response matters as much as on Android.
- Malicious configuration profiles or device management that install root certificates or VPNs, and apps distributed outside the App Store (enterprise certificates; in the EU, alternative distribution since iOS 17.4, which still requires Apple’s notarisation).
- Jailbroken devices, where anything goes; see MASWE-0051.
The signals an iOS app has:
| Signal | API | Notes |
|---|---|---|
| Screen is captured (recorded, mirrored, AirPlay, or otherwise cloned) | UIScreen.main.isCaptured (iOS 11) and UIScreen.capturedDidChangeNotification |
Apple’s documentation marks isCaptured as deprecated from iOS 27 in favour of the per-scene trait |
| Scene capture state | UITraitCollection.sceneCaptureState (iOS 17), observe trait changes |
UISceneCaptureState .active / .inactive per scene |
| Screenshot taken | UIApplication.userDidTakeScreenshotNotification |
After the fact; cannot prevent it |
| Active phone or VoIP call | CXCallObserver().calls (CallKit, iOS 10) and its delegate |
No numbers or contacts, just call state |
| Other installed apps | canOpenURL(_:) for URL schemes listed in LSApplicationQueriesSchemes (limited to 50 entries for apps linked against current SDKs) |
A weak, easily evaded and privacy-sensitive signal; not a malware scan |
| Device and app genuineness | App Attest and DeviceCheck | See MASWE-0054 |
There is no API to list installed apps, enabled assistive features in other apps, or installed configuration profiles. A sensible iOS response therefore focuses on capture state plus call state on sensitive screens (hide or blur codes, pause the flow, warn) and on the server-side account response.
Third-party mobile threat defence SDKs
Many banks embed a commercial mobile threat defence or in-app protection SDK instead of building signals themselves. Typical features: known-malware detection by package and certificate (on Android), accessibility and overlay risk scoring, screen-sharing and call detection, root and hook detection, and a backend console that receives the signals. In a review treat them like any other component:
- Find out which signals are collected and whether they reach your backend’s decision or only the vendor’s dashboard.
- Check the response configuration: many deployments run in “report only” mode for years.
- Check the Play policy side: an SDK that scans packages needs a valid
QUERY_ALL_PACKAGESjustification and Data safety declarations. - Test the effect, not the vendor’s claims, with the dynamic test below. Vendor neutrality matters here; this note names no products.
Tests
OWASP has no tests for MASWE-0055 and no legacy v1 test covers it; all tests below are our own methodology. They use benign stand-ins for malware capabilities (TalkBack, a no-op test accessibility service, the built-in screen recorder, a legitimate remote-support app, a phone call) on a test device you control. No malware samples or malicious code are used or needed: what you measure is how the app reacts to the capabilities malware relies on.
Before you start: test devices and benign stand-ins
- Android test device on a recent release (Android 15 or 16 to cover screen recording detection and in-call protections), with Google Play, the app installed from Google Play (Play Integrity environment signals are only returned for Play-installed apps), and a test account. A second device for the account-level test.
- iOS test device with the App Store build and a test account.
- Benign stand-ins on Android: TalkBack (an assistive tool, so a well-designed app should not block it); a no-op test accessibility service that declares
isAccessibilityTool="false"(below); an app with “display over other apps” permission (the test overlay app from our MASWE-0039 note or any legitimate overlay app); the built-in screen recorder and casting; a mainstream remote-support app from Google Play; a second phone to call the test device. On iOS: Control Center screen recording, AirPlay or display mirroring, screen sharing in a video-call app, a phone call. - Proxy and Frida set up as in our traffic interception lab, to see which signals are sent to the backend and to trace the app’s own checks.
A minimal no-op accessibility service for the test device (it receives no event types and does nothing; build and install it with adb install):
<!-- AndroidManifest.xml of the test app -->
<service android:name=".NoopService" android:exported="true"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter><action android:name="android.accessibilityservice.AccessibilityService" /></intent-filter>
<meta-data android:name="android.accessibilityservice" android:resource="@xml/noop_service" />
</service>
<!-- res/xml/noop_service.xml -->
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="0" android:isAccessibilityTool="false"
android:description="@string/noop_description" />
class NoopService : AccessibilityService() {
override fun onAccessibilityEvent(event: AccessibilityEvent?) = Unit
override fun onInterrupt() = Unit
}
Enable and disable services on the test device:
adb shell settings get secure enabled_accessibility_services # note the current value first
adb shell settings put secure enabled_accessibility_services com.example.noop/.NoopService
adb shell settings put secure accessibility_enabled 1
adb shell dumpsys accessibility | grep -iE 'enabled|bound' | head # confirm
adb shell settings delete secure enabled_accessibility_services # or put back the saved value
settings put replaces the whole list; to enable several services, separate them with :. If you enable the test service through the Settings UI instead, Android 13+ may show “Restricted setting” for a sideloaded app; allow it from the app’s App info menu on your test device.
GT-RES-0055-1: Hostile-environment signals the app collects (Android, iOS)
Guler Tech methodology — not an OWASP test.
Overview
Static inventory of the malware-related signals and protections the app implements: Play Integrity environment signals (inferred from client and backend), accessibility, overlay, capture, call and package checks, SafetyNet Verify Apps, Advanced Protection, third-party threat-defence SDKs, and the matching UI protections.
Prerequisites
The APK and splits (from Google Play), decompiled with jadx and apktool; the decrypted IPA; aapt2, semgrep, otool, nm, strings, plutil.
Steps
-
Android permissions and manifest.
aapt2 dump permissions base.apk | grep -E 'QUERY_ALL_PACKAGES|HIDE_OVERLAY_WINDOWS|DETECT_SCREEN_RECORDING|DETECT_SCREEN_CAPTURE|READ_PHONE_STATE|QUERY_ADVANCED_PROTECTION_MODE' aapt2 dump xmltree base.apk --file AndroidManifest.xml | grep -A3 -E 'queries|package\(' | head -40 -
Android code. Search the decompiled sources:
jadx -d out base.apk grep -rnE 'getEnabledAccessibilityServiceList|isAccessibilityTool|addAccessibilityStateChangeListener' out/sources | head grep -rnE 'setHideOverlayWindows|FLAG_WINDOW_IS(_PARTIALLY)?_OBSCURED|filterTouchesWhenObscured' out/sources | head grep -rnE 'addScreenRecordingCallback|registerScreenCaptureCallback|FLAG_SECURE|setAccessibilityDataSensitive' out/sources | head grep -rnE 'getInstalledPackages|getInstalledApplications|getInstallSourceInfo|getInstallerPackageName' out/sources | head grep -rnE 'isVerifyAppsEnabled|listHarmfulApps|enableVerifyApps|AdvancedProtectionManager' out/sources | head grep -rnE 'MODE_IN_CALL|MODE_IN_COMMUNICATION|CallStateListener' out/sources | head grep -rn 'accessibilityDataSensitive' out/resources 2>/dev/null | headOr as a semgrep rule over the jadx output (
semgrep --config malware-signals.yaml out/sources):rules: - id: malware-signal-apis languages: [java] severity: INFO message: Hostile-environment signal or protection used pattern-either: - pattern: $X.getEnabledAccessibilityServiceList(...) - pattern: $X.isAccessibilityTool() - pattern: $X.setHideOverlayWindows(...) - pattern: $X.addScreenRecordingCallback(...) - pattern: $X.registerScreenCaptureCallback(...) - pattern: $X.getInstalledPackages(...) - pattern: $X.getInstalledApplications(...) - pattern: $X.listHarmfulApps() - pattern: $X.isVerifyAppsEnabled()Map each hit to the screen or flow that uses it. A check in a utility class that nothing calls is not a control.
-
Play Integrity. Confirm the Play Integrity client library (see MASWE-0054, GT-RES-0054-1). Whether
appAccessRiskVerdictandplayProtectVerdictare enabled is a Play Console setting; ask the client or check with the backend team. For standard requests, look forverdictOptOutusage that switches app access risk off for specific requests. -
Third-party SDKs. List packages under
out/sourcesand native libraries underlib/and identify any threat-defence or in-app protection SDK; note its configuration files inassets/. -
iOS.
nm -u Payload/App.app/App | grep -iE 'isCaptured|sceneCaptureState|CXCallObserver|UIScreenCapturedDidChange|UserDidTakeScreenshot' strings -a Payload/App.app/App | grep -E 'isCaptured|sceneCaptureState|capturedDidChange' | sort -u otool -L Payload/App.app/App | grep -iE 'CallKit|DeviceCheck' plutil -p Payload/App.app/Info.plist | grep -A60 LSApplicationQueriesSchemes | head -70Swift code often references these through Objective-C selectors or notification name strings, so check both symbol imports and strings.
Observation
A table: signal or protection → present (where) → which flows use it → whether the result is sent to the backend (to be confirmed in GT-RES-0055-3).
Evaluation
- Fail (R-profile app with on-device fraud exposure): none of the signals is used and the server does not use Play Integrity environment signals; or detection exists only for one capability (for example a package-name list) while accessibility, overlay and capture states are ignored.
- Weak: signals collected but only logged or sent to analytics;
QUERY_ALL_PACKAGESused for a name list as the main control; checks run once at start-up rather than on sensitive screens. - Pass: the app uses server-verified environment signals (Android) and capability checks on sensitive flows, with the UI protections of MASWE-0039/0040 in place.
- Info: non-R apps; iOS apps that implement capture and call checks where Android-style signals do not exist.
Demo
Illustrative output from the grep sweep of a banking app that only scans package names:
out/sources/com/example/bank/security/a.java:41: List<PackageInfo> l = pm.getInstalledPackages(0);
out/sources/com/example/bank/security/a.java:44: if (BLOCKLIST.contains(p.packageName)) { ... }
# no getEnabledAccessibilityServiceList, setHideOverlayWindows, addScreenRecordingCallback or FLAG_SECURE hits
# aapt2: uses-permission: name='android.permission.QUERY_ALL_PACKAGES'
GT-RES-0055-2: App response to risky capabilities on a test device (Android, iOS)
Guler Tech methodology — not an OWASP test.
Overview
Put the test device into each risky state that malware relies on, using benign stand-ins, and observe what the app does in its sensitive flows: nothing, a dismissable warning, a restriction, a block, or a server-side step-up. Also check that legitimate assistive tools are not blocked.
Prerequisites
The test devices and stand-ins from “Before you start”, the proxy, Frida, and the list of sensitive flows (login, OTP entry, adding a payee, payment approval, card details display, limit change).
Steps
- Baseline. Clean device state. Run each sensitive flow, record the screens and the requests.
-
Trace the app’s own checks while you run the scenarios, to see which state the app actually reads:
frida-trace -U -f com.example.bank \ -j 'android.view.accessibility.AccessibilityManager!getEnabledAccessibilityServiceList' \ -j 'android.accessibilityservice.AccessibilityServiceInfo!isAccessibilityTool' \ -j 'android.view.WindowManagerImpl!addScreenRecordingCallback' \ -j 'android.view.Window!setHideOverlayWindows' \ -j 'android.app.ApplicationPackageManager!getInstalledPackages' \ -j 'android.media.AudioManager!getMode' # if a WindowManager method does not show up, the implementing class differs on your build: use -j '*!addScreenRecordingCallback' # iOS frida-trace -U -f com.example.bank -m '-[UIScreen isCaptured]' -m '-[UITraitCollection sceneCaptureState]' -m '-[CXCallObserver calls]' - Assistive tool (false-positive check). Enable TalkBack, run the flows. Expected: the app works (it may still hide sensitive views from non-tool services).
- Non-tool accessibility service. Disable TalkBack, enable the no-op test service, run the flows.
- Overlay-capable app. Grant “display over other apps” to the overlay test app (
adb shell appops set <pkg> SYSTEM_ALERT_WINDOW allow), show its overlay, open the sensitive screens. Check whether the overlay disappears over sensitive windows (Android 12+) and whether the app reacts. - Screen recording and sharing. Start the built-in screen recorder, then casting, then screen sharing from a video-call app, then (for comparison)
adb shell screenrecord /sdcard/t.mp4. For each, open the sensitive screens. Note which capture paths the app notices and whether sensitive content is blacked out (FLAG_SECURE). - Remote-support app. Install a mainstream remote-support app from Google Play on the test device and start a session from a second device. Run the flows.
- Active call. Call the test device from another phone, keep the call open, and run the payment and payee flows. Repeat in combination with step 6.
- Play Protect off. In Play Store → Play Protect → settings, turn off “Scan apps with Play Protect” on the test device, run the flows, and turn it back on.
- Can the response be automated away? For every warning you see, note how many taps dismiss it and whether it requires anything an accessibility service could not do for the user (an out-of-band confirmation, a delay, a call-back).
- iOS. Start screen recording from Control Center, then AirPlay or cable mirroring, then screen sharing in a video-call app, then a phone call, and run the flows. Check that codes and card data are hidden or blurred while captured, and what the app says.
Observation
Per scenario and flow: the app’s visible reaction (screenshot), the traced checks, the requests sent (are signals included?), and whether the operation completed. Record Android version and patch level, because several signals are version-dependent.
Evaluation
- Fail: in an R-profile app, no reaction in any scenario while sensitive flows complete; or the only reaction is a dismissable dialog and no signal reaches the backend; or TalkBack users are blocked (accessibility regression).
- Weak: reactions in some scenarios only (for example screen recording but not non-tool accessibility services); detection at app start but not when the state changes mid-flow; sensitive content visible in recordings because
FLAG_SECUREis missing (report that under MASWE-0038 as well). - Pass: risky states are detected on sensitive flows, sensitive content is protected, the user gets a clear explanation, legitimate assistive tools keep working, and the state is reported to the backend for a server-side decision (verified in GT-RES-0055-3).
Demo
Illustrative trace and result for scenario 4 (no-op service enabled):
2210 ms AccessibilityManager.getEnabledAccessibilityServiceList(-1)
2211 ms AccessibilityServiceInfo.isAccessibilityTool() => false (com.example.noop/.NoopService)
2214 ms AccessibilityServiceInfo.isAccessibilityTool() => true (none; TalkBack disabled)
POST /v3/payments/initiate {"env":{"a11yNonTool":["com.example.noop"],"rec":false,"call":false}, ...}
<- 202 {"status":"PENDING_STEP_UP","reason":"ENV_RISK"}
GT-RES-0055-3: Server-side use of the signals and account-level response (Android, iOS)
Guler Tech methodology — not an OWASP test.
Overview
Check that the backend, not just the app, uses the hostile-environment signals, and that a suspected compromise leads to an account-level response that also holds on a different, clean device. This is the “Insufficient Response Strategy” mode of introduction.
Prerequisites
Results of GT-RES-0055-1 and -2, two test devices, two test accounts, the proxy, and a backend contact who can tell you which rules exist and confirm server-side decisions from logs.
Steps
- Which signals reach the server? From the GT-RES-0055-2 traffic, list client-reported environment fields and whether Play Integrity tokens with
environmentDetailsaccompany the sensitive requests. Ask whetherappAccessRiskVerdictandplayProtectVerdictare enabled and used in the policy. - Client-reported vs verified. On your own test account, in a clean environment, replay a risky-state request with the client-reported environment fields set to “clean” values, and a clean-state request with them set to “risky”. The point is not that malware would edit them (it usually cannot), but to learn whether the server decides on these fields or ignores them. Where Play Integrity environment signals are used, the server decision should follow the Google-signed verdict, not the client fields.
- Server decision. In each risky scenario from GT-RES-0055-2, record whether the server added friction (step-up, out-of-band confirmation, delay, lower limit, hold for review) or the decision was purely client-side.
- Account-level response. After triggering a risky state on device 1 during a sensitive flow, use device 2 (clean) with the same test account to: log in as a new device, enrol it as trusted, add a payee, raise a limit. Expected for a high-value app: the account carries a risk flag for a period, and these actions require stronger verification or are held, with a notification to the user.
- Notification channel. Check how the user is told about a suspected compromise and how they recover. An SMS or push to the compromised device alone may be suppressed or read by the malware.
- Rule review. With the backend or fraud team, walk through the rules: which signal combinations matter (for example
UNKNOWN_CONTROLLINGplus an active call on a payment), how long a risk flag lasts, how false positives are handled for accessibility users, and how rules are updated when malware behaviour changes.
Observation
The list of signals the server receives and uses, the server’s decisions in each scenario, the result of the account-level test on device 2, and the documented rules.
Evaluation
- Fail: the server ignores all environment signals and every response is client-side; or a risky state on device 1 has no effect on new-device enrolment, payee creation or limit changes from device 2.
- Weak: the server uses client-reported fields only and no Google-signed signals where Play Integrity is available; risk flags are set but expire immediately or only affect the session; notifications only to the possibly compromised device.
- Pass: server-side decisions based on verified signals where available, tiered responses, and an account-level hold on risky follow-up actions with notification through an independent channel.
Demo
Illustrative account-level check:
device 1 POST /v3/payments/initiate env=UNKNOWN_CONTROLLING + call -> 202 PENDING_STEP_UP (flag: ENV_RISK, 72h)
device 2 POST /v1/devices/enrol (password + SMS OTP) -> 200 OK <- fail: flag ignored
device 2 POST /v1/payees new payee -> 200 OK <- fail
Best practices
OWASP links no Best Practices to MASWE-0055 directly. Two practices from the PLATFORM category are the UI half of this weakness and are documented in our PLATFORM notes; here is what they say and where to find the detail.
MASTG-BEST-0040: Preventing Overlay Attacks
MASTG-BEST-0040 (Android): hide third-party overlays on sensitive windows with setHideOverlayWindows(true) on Android 12+, filter touches when the window is obscured, check the partial-occlusion flag for approval buttons, and do not rely on the platform’s untrusted-touch blocking alone. Full treatment and tests: MASWE-0039.
MASTG-BEST-0075: Restricting Accessibility Service Access to Sensitive Views
MASTG-BEST-0075 (Android 14+, API 34): mark views that show or accept sensitive data with android:accessibilityDataSensitive="yes" or setAccessibilityDataSensitive(), so that only services declaring isAccessibilityTool can read or act on them. Full treatment and tests: MASWE-0040.
Secure patterns (Guler Tech)
Collect a small environment snapshot on sensitive screens (Android):
data class Env(val nonToolA11y: List<String>, val recording: Boolean, val inCall: Boolean)
class SensitiveActivity : AppCompatActivity() {
private var recording = false
private val recCb = Consumer<Int> { recording = it == WindowManager.SCREEN_RECORDING_STATE_VISIBLE }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
if (Build.VERSION.SDK_INT >= 31) window.setHideOverlayWindows(true) // needs HIDE_OVERLAY_WINDOWS
}
override fun onStart() {
super.onStart()
if (Build.VERSION.SDK_INT >= 35) recCb.accept(windowManager.addScreenRecordingCallback(mainExecutor, recCb))
}
override fun onStop() {
if (Build.VERSION.SDK_INT >= 35) windowManager.removeScreenRecordingCallback(recCb)
super.onStop()
}
fun snapshot(): Env {
val am = getSystemService(AccessibilityManager::class.java)
val nonTool = am.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK)
.filter { Build.VERSION.SDK_INT < 31 || !it.isAccessibilityTool }
.map { it.resolveInfo.serviceInfo.packageName }
val mode = getSystemService(AudioManager::class.java).mode
return Env(nonTool, recording, mode == AudioManager.MODE_IN_CALL || mode == AudioManager.MODE_IN_COMMUNICATION)
}
}
Send the snapshot with the sensitive request, together with a Play Integrity token whose requestHash covers the request (MASWE-0054). The DETECT_SCREEN_RECORDING and HIDE_OVERLAY_WINDOWS permissions are install-time permissions that you declare in the manifest.
Observe capture state (iOS):
final class SensitiveViewController: UIViewController {
private var observer: NSObjectProtocol?
override func viewDidLoad() {
super.viewDidLoad()
observer = NotificationCenter.default.addObserver(
forName: UIScreen.capturedDidChangeNotification, object: nil, queue: .main) { [weak self] _ in
self?.updateCapture()
}
updateCapture()
}
private var captured: Bool {
if #available(iOS 17.0, *) { return traitCollection.sceneCaptureState == .active }
return view.window?.windowScene?.screen.isCaptured ?? false
}
private func updateCapture() {
codeLabel.isHidden = captured // hide OTPs and card data while recorded or mirrored
captureBanner.isHidden = !captured
}
}
On iOS 17 and later you can also register for trait changes on the view controller to react to sceneCaptureState directly; the notification works on all versions from iOS 11.
Decide on the server, respond at account level:
signal (verified where possible) | payment / payee / limit | account
------------------------------------------------------+-------------------------------------+------------------------------
playProtectVerdict HIGH_RISK or MEDIUM_RISK | block; ask user to act on Play Protect | flag 72h
appsDetected has UNKNOWN_CONTROLLING or _CAPTURING | step-up out of band + delay | flag 24h
non-tool a11y service + active call | hold; call-back or in-branch | flag 72h, notify by email
screen captured (iOS) + active call | hold; warn about scams | flag 24h
POSSIBLE_RISK (Play Protect off) | ask user to enable; lower limits | none
flag active, any device | new-device enrolment, payees, limits held; notify via independent channel
Rating findings
The series rule applies: if the app’s threat model does not include the R profile, missing malware detection is Info. For an R-profile app, rate by the fraud the gap enables, and keep separate what belongs to MASWE-0039, MASWE-0040 and MASWE-0038 (a sensitive view readable by a non-tool accessibility service, or an approval button that can be overlaid, is rated there on its own merits).
| Rating | Conditions |
|---|---|
| High | Rarely for this weakness alone. Use it when there is evidence of active malware fraud against the app’s users (client fraud data, public threat reports naming the app) and the app and backend have no hostile-environment signals and no account-level response, so that a known, ongoing attack runs unopposed. |
| Medium | A banking, payment or wallet app (R profile) that uses no hostile-environment signals on payments, payee creation or new-device enrolment; or detection that exists but leads only to a client-side, dismissable warning with nothing sent to the server; or no account-level response, so that a compromise flagged on one device has no effect on enrolment of another. |
| Low | Signals used, but with gaps: Play Integrity environment signals available but not enabled; checks only at start-up; one capability covered (for example screen recording) but not others; package-name blocklists as the main control; TalkBack users blocked (also a usability and compliance issue). |
| Info | Non-R apps; iOS apps where only the available capture and call signals apply; recommendations such as enabling appAccessRiskVerdict, using Android 15 recording detection, or adopting Advanced Protection as a trust signal. |
A control that exists but is trivially bypassed on the device is rated by what the bypass unlocks; but note that for this weakness the relevant bypass is the malware’s, not the device owner’s (one accessibility tap on “continue”, not a Frida hook). In the report name the scenario from GT-RES-0055-2 or -3, the flow, the device and OS version, the observed response, and the server-side and account-level change that fixes it.
References
- OWASP MASWE: MASWE-0055: Malware Detection Not Implemented; related MASWE-0039, MASWE-0040, MASWE-0051, MASWE-0054 (CC BY-SA 4.0)
- OWASP MASVS: MASVS-RESILIENCE-2 (CC BY-SA 4.0)
- OWASP MASTG best practices: MASTG-BEST-0040, MASTG-BEST-0075 (CC BY-SA 4.0)
- OWASP MASTG tools: Frida (MASTG-TOOL-0031), objection (MASTG-TOOL-0038), jadx (MASTG-TOOL-0018), adb (MASTG-TOOL-0004) (CC BY-SA 4.0)
- Google Play Protect: Google Play Protect, Client protections
- Play Integrity: Overview, Integrity verdicts: environment details, Remediation dialogs
- Android APIs: AccessibilityManager, AccessibilityServiceInfo, Window.setHideOverlayWindows, WindowManager.addScreenRecordingCallback, Activity.registerScreenCaptureCallback, AudioManager, TelephonyCallback.CallStateListener, AdvancedProtectionManager, Android 15 features: screen recording detection, Package visibility filtering, SafetyNet Verify Apps API
- Google Play policy: Use of the broad package (App) visibility (QUERY_ALL_PACKAGES) permission, Allow restricted settings (Android Help)
- Google: What’s new in Android security and privacy in 2025
- Apple: UIScreen.isCaptured, UIScreen.capturedDidChangeNotification, UITraitCollection.sceneCaptureState, UIApplication.userDidTakeScreenshotNotification, CXCallObserver
- Research: Cloak and Dagger (IEEE S&P 2017)
- CWE: CWE-693
Adapted and extended from the OWASP MASWE and MASTG (https://mas.owasp.org), licensed under CC BY-SA 4.0. This note is distributed under the same licence.