Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS13dmM0LWo3ZzUtNGY3Oc4AAyWJ
NATS TLS certificate common name validation bypass
The NATS official Rust clients are vulnerable to MitM when using TLS.
A fix for the nats
crate hasn't been released yet. Since the nats
crate is going to be deprecated anyway, consider switching to async-nats
>= 0.29
which already fixed this vulnerability.
The common name of the server's TLS certificate is validated against the host
name 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
INFO
message - The proxy reads the
INFO
, alters thehost
JSON field and passes the tamperedINFO
back 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
host
was set to the common name of said certificate rustls
accepts 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
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13dmM0LWo3ZzUtNGY3Oc4AAyWJ
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: over 1 year ago
Updated: about 1 year ago
Identifiers: GHSA-wvc4-j7g5-4f79
References:
- https://github.com/nats-io/nats.rs/pull/881
- https://github.com/nats-io/nats.rs/pull/887
- https://rustsec.org/advisories/RUSTSEC-2023-0029.html
- https://github.com/nats-io/nats.rs/commit/9bacb86a480803ece9d1a45aa443081cf1eb815c
- https://github.com/advisories/GHSA-wvc4-j7g5-4f79
Blast Radius: 0.0
Affected Packages
cargo:nats
Dependent packages: 32Dependent repositories: 152
Downloads: 2,056,372 total
Affected Version Ranges: >= 0.9.0, <= 0.24.0
Fixed in: 0.24.1
All affected versions: 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.9.8, 0.9.9, 0.9.10, 0.9.11, 0.9.12, 0.9.13, 0.9.14, 0.9.15, 0.9.16, 0.9.17, 0.9.18, 0.9.19, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.12.1, 0.13.0, 0.13.1, 0.14.0, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.17.0, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.20.0, 0.20.1, 0.21.0, 0.22.0, 0.23.0, 0.23.1, 0.24.0
All unaffected versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5, 0.8.6, 0.24.1, 0.25.0