High, CVSS 7.6GoAmendedPublished
Xray-core: Pinning a CA certificate via pinnedPeerCertSha256 can lead to the success of MITM attacks
GHSA-5wf9-h793-w73c
- Affected
- Go github.com/xtls/xray-core >= 1.260113.0, < 1.260327.1-0.20260710210335-64fada32b5b9
- Fixed in
- 1.260327.1-0.20260710210335-64fada32b5b9· Vendor fix available
- Issue
- Pinning a CA certificate via pinnedPeerCertSha256 can lead to the success of MITM attacks in some cases. Details https://github.com/XTLS/Xray-core/blob/45cf2898ab12e97a55dd8f1f3d78d903340bdc9e/transport/internet/tls/config.go#L333-L347 If r.Config.ServerName is empty, DNSName will be empty and certs[0].Verify(opts) will not verify against dNSName or iPAddress. If a user pins a well-known and non-self-signed CA, an attacker can issue a leaf certificate through the Root CA (using the attacker's own domain name or IP address) and hijack the connections. In Go crypto/tls, either ServerName or InsecureSkipVerify must be specified in the tls.Config. If the user specifies pinnedPeerCertSha256, InsecureSkipVerify will always be true so ServerName can be empty. In most cases, if the user does not specify the serverName, Xray-core will use the server address as the r.Config.ServerName. Thanks to GetTLSConfig(tls.WithDestination(dest)), ServerName will usually not be empty. However,…
Recommended action: Upgrade to 1.260327.1-0.20260710210335-64fada32b5b9 (pre-release) or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.