# VNX-925: Broadcast receiver acts on an intent without verifying its action or sender

Reports an Android BroadcastReceiver.onReceive that reads data from the intent without checking its action or sender, in Java and Kotlin.

| Field | Value |
|---|---|
| Rule ID | `VNX-925` |
| Severity | Medium |
| SARIF level | `warning` |
| Kind | `sast` |
| Languages | Java, Kotlin |
| CWE | [CWE-925](https://cwe.mitre.org/data/definitions/925.html) |
| CAPEC | [CAPEC-66](https://capec.mitre.org/data/definitions/66.html) |
| ATT&CK | [T1190](https://attack.mitre.org/techniques/T1190/) |
| CWSS vector | `CWSS:1.0/TI:M/AP:RU/AL:S/IC:N/FC:LT/RP:RU/RL:S/AV:L/AS:N/IN:A/SC:A/BI:M/DI:H/EX:M/EC:N/P:C` |
| Tags | `android` `broadcast-receiver` `intent-verification` `cwe-925` |
| Source | [`internal/sast/rules/vnx-925.rego`](https://github.com/Vulnesis/cli/blob/main/internal/sast/rules/vnx-925.rego) |

## Overview

An Android `BroadcastReceiver.onReceive(Context, Intent)`, named or anonymous, reads data from the intent it was handed (`getStringExtra` and the other `get*Extra` calls, `getExtras()`/`extras`, `getData()`/`data`, `getDataString()`) without ever checking the action (`getAction()`/`intent.action`, `hasAction`) or the sender (`getSentFromPackage`/`getSentFromUid`). The finding is on the `onReceive` declaration.

## Why this matters

Any app that can reach the receiver can send it a forged broadcast with its own extras, and the receiver acts on them: sending an SMS, opening a URL, wiping data.

## What gets flagged

```java
@Override
public void onReceive(Context context, Intent intent) {
    String phone = intent.getStringExtra("phone");
    SmsManager.getDefault().sendTextMessage(phone, null, note, null, null);
}
```

```kotlin
override fun onReceive(context: Context, intent: Intent) {
    val url = intent.getStringExtra("url") ?: return
    context.startActivity(Intent(Intent.ACTION_VIEW).setData(Uri.parse(url)))
}
```

Not flagged: receivers that check `intent.getAction()` / `when (intent.action)` or the sender, receivers that never read the intent's data, an `onReceive` whose second parameter is not an `Intent`, test files, comments and strings. The manifest is not read: a receiver protected by a signature permission, registered with `RECEIVER_NOT_EXPORTED` or through `LocalBroadcastManager` is a false positive to suppress. Exported receivers are VNX-926.

## Remediation

Check the action against the one the receiver expects before reading anything, and limit who can send it: `android:exported="false"`, a signature-level `android:permission`, or `RECEIVER_NOT_EXPORTED` for runtime registration.

## References

- [CWE-925: Improper Verification of Intent by Broadcast Receiver](https://cwe.mitre.org/data/definitions/925.html)
- [Android: Broadcasts security considerations](https://developer.android.com/develop/background-work/background-tasks/broadcasts#security-and-best-practices)

## Suppressing this rule

Put a `nosec` comment on the line, or on line 1 to cover the whole file. Use the comment marker of the file's language (`#`, `//`, `--` or `;`):

```text
# nosec vnx-925
// nosec vnx-925
```

Or record an ignore rule: `vulnetix ignore add --rule vnx-925 --reason "..."`. See [Suppressing findings](/sast/guides/suppressing-findings.md).
