# VNX-523: Unprotected Transport of Credentials

Detects credentials sent to a remote host over plain http://.

| Field | Value |
|---|---|
| Rule ID | `VNX-523` |
| Severity | High |
| SARIF level | `error` |
| Kind | `sast` |
| Languages | Go, Java, JavaScript / TypeScript, Python, HTML |
| CWE | [CWE-523](https://cwe.mitre.org/data/definitions/523.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 | `unprotected-transport` `cleartext` `credentials` `cwe-523` |
| Source | [`internal/sast/rules/vnx-523.rego`](https://github.com/Vulnesis/cli/blob/main/internal/sast/rules/vnx-523.rego) |

## Overview

VNX-523 maps to [CWE-523: Unprotected Transport of Credentials](https://cwe.mitre.org/data/definitions/523.html). Credentials sent over plain HTTP can be read and replayed by anyone on the network path. The rule reports, for remote hosts only:

- a URL that embeds credentials: `http://user:pass@host`;
- an HTTP client call to an `http://` URL whose arguments carry credentials: Python requests/httpx/session/urllib3 with `auth=`, an Authorization/Cookie/X-Api-Key header, or a password, token or API-key field; `fetch`/`axios`/jQuery with the same in their options; Go `http.PostForm` with a password field;
- a request built on an `http://` URL (Go `http.NewRequest`, Java `new URL`, `URI.create`, `new HttpGet`/`HttpPost`) that is given `SetBasicAuth` or an Authorization header within the next eight lines;
- an HTML login form (a page with a password input) whose `action` is an `http://` URL.

## What gets flagged

```python
requests.get("http://orders.acme-corp.com/api/orders", auth=(user, password))  # FLAGGED
```

```go
req, err := http.NewRequest("GET", "http://inventory.acme-corp.com/items", nil) // FLAGGED
req.SetBasicAuth(user, pass)
```

```html
<form method="post" action="http://accounts.acme-corp.com/login">  <!-- FLAGGED -->
```

## What is not flagged

`https://` URLs; loopback, private-range, link-local and single-label hosts (`localhost`, `127.0.0.1`, `10.x`, `cache:6379`); reserved names (`example.com`, `.test`, `.local`, `.internal`); requests that carry no credentials (a message such as `json={"text": "Password reset requested"}` is prose, not a credential); URLs in comments or prose strings; and test code. Cleartext endpoints in general are VNX-319, and cleartext redis/amqp/ftp/ldap connection URLs are VNX-SEC-017.

## Remediation

1. Use `https://` for every request that carries a password, token, cookie or API key, and for every login form action.
2. Enable HSTS on the server so browsers never fall back to HTTP.
3. Keep credentials out of URLs entirely; send them in an Authorization header over TLS.

## References

- [CWE-523: Unprotected Transport of Credentials](https://cwe.mitre.org/data/definitions/523.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-523
// nosec vnx-523
```

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