Xray core: Xray-core: Pinning a CA certificate via pinnedPeerCertSha256 can lead to the success of MITM attacks
Xray-core has a vulnerability where pinning a CA certificate using pinnedPeerCertSha256 can enable man-in-the-middle (MITM) attacks if the ServerName configuration is empty. This occurs because the TLS verification does not check the hostname against the certificate when ServerName is missing and InsecureSkipVerify is true. In some code paths, ServerName is not set when using IP addresses or certain dialers, allowing an attacker to issue a leaf certificate from the pinned CA and hijack connections.
AI Analysis
Technical Summary
The vulnerability in Xray-core arises from improper TLS certificate verification when pinning a CA certificate via pinnedPeerCertSha256. If the ServerName field in the TLS configuration is empty, the certificate verification skips hostname validation, allowing an attacker who controls a leaf certificate issued by the pinned CA to impersonate any domain or IP address. This is due to the Go crypto/tls behavior where specifying pinnedPeerCertSha256 sets InsecureSkipVerify to true, disabling hostname checks unless ServerName is explicitly set. Certain code paths in Xray-core do not set ServerName, especially when the address is an IP, leaving the system vulnerable to MITM attacks.
Potential Impact
An attacker who can obtain a leaf certificate issued by the pinned CA can impersonate any server, including domains or IP addresses, to the client using Xray-core. This enables successful man-in-the-middle attacks, potentially allowing interception and manipulation of TLS-encrypted communications. The vulnerability affects scenarios where ServerName is not set and pinnedPeerCertSha256 is used, weakening TLS verification.
Mitigation Recommendations
A patch is available for this vulnerability. Users should upgrade to a fixed version of Xray-core to ensure ServerName is properly set in all TLS configurations, especially when using pinnedPeerCertSha256. Until patched, users should explicitly specify ServerName when configuring TLS to avoid empty ServerName values. Review usage of pinnedPeerCertSha256 and avoid relying solely on CA pinning without hostname verification.
Xray core: Xray-core: Pinning a CA certificate via pinnedPeerCertSha256 can lead to the success of MITM attacks
Description
Xray-core has a vulnerability where pinning a CA certificate using pinnedPeerCertSha256 can enable man-in-the-middle (MITM) attacks if the ServerName configuration is empty. This occurs because the TLS verification does not check the hostname against the certificate when ServerName is missing and InsecureSkipVerify is true. In some code paths, ServerName is not set when using IP addresses or certain dialers, allowing an attacker to issue a leaf certificate from the pinned CA and hijack connections.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in Xray-core arises from improper TLS certificate verification when pinning a CA certificate via pinnedPeerCertSha256. If the ServerName field in the TLS configuration is empty, the certificate verification skips hostname validation, allowing an attacker who controls a leaf certificate issued by the pinned CA to impersonate any domain or IP address. This is due to the Go crypto/tls behavior where specifying pinnedPeerCertSha256 sets InsecureSkipVerify to true, disabling hostname checks unless ServerName is explicitly set. Certain code paths in Xray-core do not set ServerName, especially when the address is an IP, leaving the system vulnerable to MITM attacks.
Potential Impact
An attacker who can obtain a leaf certificate issued by the pinned CA can impersonate any server, including domains or IP addresses, to the client using Xray-core. This enables successful man-in-the-middle attacks, potentially allowing interception and manipulation of TLS-encrypted communications. The vulnerability affects scenarios where ServerName is not set and pinnedPeerCertSha256 is used, weakening TLS verification.
Mitigation Recommendations
A patch is available for this vulnerability. Users should upgrade to a fixed version of Xray-core to ensure ServerName is properly set in all TLS configurations, especially when using pinnedPeerCertSha256. Until patched, users should explicitly specify ServerName when configuring TLS to avoid empty ServerName values. Review usage of pinnedPeerCertSha256 and avoid relying solely on CA pinning without hostname verification.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-5wf9-h793-w73c
- Osv Schema Version
- 1.4.0
- Ecosystems
- ["Go"]
- Database Specific Severity
- HIGH
- Cvss Version
- 4.0
Threat ID: 6ac139b5a43b0b3b89d69d13
Added to database: 10/03/2026, 17:21:57 UTC
Last enriched: 10/03/2026, 17:41:21 UTC
Last updated: 10/04/2026, 02:51:38 UTC
Views: 8
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.