async-nats vulnerable to TLS certificate common name validation bypassGHSA-f5v5-ccqc-6w36
Fix: nats-io/nats.rs@817a7b9GHSA-f5v5-ccqc-6w36 is a security vulnerability in async-nats. A fix is available for async-nats — see the affected versions and patch details below.
Real-World Exposure
async-natsReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects crates.io packages — download data is not available via public APIs for these ecosystems.
Description
The NATS official Rust clients are vulnerable to MitM when using TLS.
The common name of the server's TLS certificate is validated against the hostname provided by the server's plaintext INFO message during the initial connection setup phase. A MitM proxy can tamper with the host field's value by substituting it with the common name of a valid certificate it controls, fooling the client into accepting it.
Reproduction steps
- The NATS Rust client tries to establish a new connection
- The connection is intercepted by a MitM proxy
- The proxy makes a separate connection to the NATS server
- The NATS server replies with an
INFOmessage - The proxy reads the
INFO, alters thehostJSON field and passes the tamperedINFOback to the client - The proxy upgrades the client connection to TLS, presenting a certificate issued by a certificate authority present in the client's keychain. In the previous step the
hostwas set to the common name of said certificate rustlsaccepts the certificate, having verified that the common name matches the attacker-controlled value it was given- The client has been fooled by the MitM proxy into accepting the attacker-controlled certificate
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🦀crates.io | async-nats | all versions | 0.29.0cargo update -p async-nats --precise 0.29.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for async-nats, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update async-nats to 0.29.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-f5v5-ccqc-6w36 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Frequently Asked Questions
Is GHSA-f5v5-ccqc-6w36 in your dependencies?
Find it across crates.io, including transitive dependencies.