# VNX-319: Cleartext Transmission of Sensitive Information

A real http://, ws:// or ftp:// endpoint used by code: passed to an HTTP, FTP or socket client, assigned to an endpoint-named variable or key.

| Field | Value |
|---|---|
| Rule ID | `VNX-319` |
| Severity | High |
| SARIF level | `error` |
| Kind | `sast` |
| Languages | Go, Java, JavaScript / TypeScript, PHP, Python, Ruby |
| CWE | [CWE-319](https://cwe.mitre.org/data/definitions/319.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:H/AP:A/AL:A/IC:N/FC:LT/RP:N/RL:A/AV:I/AS:N/IN:A/SC:A/BI:H/DI:H/EX:H/EC:N/P:H` |
| Tags | `cleartext-transmission` `cwe-319` |
| Source | [`internal/sast/rules/vnx-319.rego`](https://github.com/Vulnesis/cli/blob/main/internal/sast/rules/vnx-319.rego) |

## Overview

VNX-319 maps to [CWE-319: Cleartext Transmission of Sensitive Information](https://cwe.mitre.org/data/definitions/319.html). It reports a cleartext `http://` or `ftp://` URL with a registered host name on a line that uses it as an endpoint:

- passed to a client: Python `requests`, `httpx`, `urllib`, `aiohttp`; JavaScript `fetch`, `axios`, jQuery ajax, `XMLHttpRequest`, `WebSocket`, `EventSource`; Go `http.Get`/`Post`/`NewRequest`; Java `new URL`, `URI.create`, `HttpRequest`, OkHttp `.url()`, `RestTemplate`, `WebClient`, `HttpGet`; PHP `curl`, `file_get_contents`, `fopen`, Guzzle, `wp_remote_*`; Ruby `Net::HTTP`, `URI.parse`, open-uri, HTTParty, Faraday, RestClient;
- assigned to a name or key that says it is an endpoint (`url`, `uri`, `endpoint`, `host`, `server`, `base`, `api`, `webhook`, `callback`, `origin`, `proxy`, `registry`, `gateway`, `service`, `upstream`, `redirect`);
- loaded by a `<script>` or `<iframe>` `src`.

Not reported: hyperlinks (`href`, link helpers), URLs in comments, licence headers and prose strings, lists of URLs with no endpoint context (such as redirect allowlists), XML/JSON-schema namespace and SAX feature identifiers, the bare scheme in a prefix check or scheme list, loopback, private-range and reserved example hosts, a normaliser listing both the http and https form of one host, test code, and example, sample and demo directories.

## Why this matters

Anything sent over plain HTTP or FTP (credentials, tokens, personal data, the response itself) can be read and modified by anyone on the network path: public Wi-Fi, a compromised router, an ISP. A script loaded over HTTP can be replaced with an attacker's.

## What gets flagged

```python
# FLAGGED
resp = requests.post("http://payments.partner-bank.com/v1/charge", json=payload)
BASE_URL = "http://api.weather-provider.net"
```

```javascript
// FLAGGED
export const API_URL = 'http://api.shop-backend.com';
await axios.post("http://hooks.notify-service.net/events", event);
```

```go
// FLAGGED
return http.Get("http://status.cloud-vendor.io/health")
```

Not flagged: `'<li><a href="http://partner-site.com/">Partner</a></li>'`, `factory.setFeature("http://xml.org/sax/features/external-general-entities", false)`, `http.Get("http://localhost:8080/health")`.

## Remediation

1. Use `https://` (or SFTP/FTPS) for every remote endpoint and keep certificate verification on.
2. Load scripts and frames over HTTPS, ideally with Subresource Integrity.
3. Enable HSTS on services you control so clients never fall back to HTTP.

## References

- [CWE-319: Cleartext Transmission of Sensitive Information](https://cwe.mitre.org/data/definitions/319.html)
- [OWASP Transport Layer Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Transport_Layer_Security_Cheat_Sheet.html)

## 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-319
// nosec vnx-319
```

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