CVE-2023-28321 Overview
An improper certificate validation vulnerability exists in curl versions prior to v8.1.0 that affects how wildcard patterns are matched when listed as "Subject Alternative Name" in TLS server certificates. When curl is built to use its own name matching function for TLS rather than one provided by a TLS library, the private wildcard matching function incorrectly matches IDN (International Domain Name) hosts, potentially accepting patterns that should otherwise mismatch.
IDN hostnames are converted to punycode before being used for certificate checks. Punycode names always start with xn-- and should not be allowed to pattern match. However, the wildcard check in curl could still check for patterns like x*, which would match even though the IDN name most likely contained nothing resembling an x. This flaw could allow attackers to present fraudulent certificates that would be incorrectly validated.
Critical Impact
An attacker could exploit this certificate validation bypass to perform man-in-the-middle attacks against applications using affected curl versions, potentially intercepting or modifying sensitive data in transit.
Affected Products
- Haxx curl versions prior to 8.1.0
- Debian Linux 10.0
- Fedora 37 and 38
- NetApp Clustered Data ONTAP
- NetApp ONTAP Antivirus Connector
- NetApp H300S, H500S, H700S, H410S (firmware and hardware)
- Apple macOS (multiple versions)
Discovery Timeline
- 2023-05-26 - CVE-2023-28321 published to NVD
- 2025-01-15 - Last updated in NVD database
Technical Details for CVE-2023-28321
Vulnerability Analysis
This vulnerability (CWE-295: Improper Certificate Validation) resides in curl's internal certificate name matching implementation. When curl is compiled to use its own wildcard matching function instead of relying on the underlying TLS library's implementation, a logic flaw occurs during the validation of Subject Alternative Names (SANs) in TLS certificates.
The core issue stems from how punycode-encoded Internationalized Domain Names are processed during wildcard pattern matching. Domain names containing non-ASCII characters are converted to punycode format, which prefixes them with xn--. The security assumption is that punycode domains should not participate in wildcard matching due to the complexity of ensuring accurate comparisons across different character encodings.
However, curl's internal wildcard matching function failed to properly exclude punycode domains from pattern matching. As a result, a wildcard pattern like x* in a certificate's SAN field could incorrectly match punycode domains starting with xn--, even when the original IDN bore no resemblance to the pattern.
Root Cause
The root cause is a logic error in curl's custom wildcard matching function used for TLS certificate validation. The function did not properly handle the special case of punycode-encoded International Domain Names, allowing wildcard patterns to match against the xn-- prefix that all punycode domains share. This implementation oversight created a gap between expected security behavior and actual certificate validation logic.
Attack Vector
This vulnerability is exploitable over the network and requires an attacker to be in a position to intercept TLS connections (man-in-the-middle position). The attack scenario involves:
- An attacker obtains a valid certificate with a wildcard SAN pattern (e.g., x*.attacker.com)
- The victim attempts to connect to a legitimate IDN domain that gets converted to punycode (e.g., xn--example.com)
- The attacker intercepts the connection and presents their certificate
- Vulnerable curl versions incorrectly validate the certificate because x* matches xn--example.com
- The TLS connection is established with the attacker's server instead of the legitimate destination
The vulnerability requires no user interaction and no privileges, but exploitation complexity is high as it requires the attacker to be positioned for a man-in-the-middle attack and the target to be using curl's internal certificate matching function.
Detection Methods for CVE-2023-28321
Indicators of Compromise
- Unexpected TLS certificate warnings or errors in application logs that were subsequently ignored
- Network traffic showing TLS connections to unexpected endpoints for IDN domains
- Evidence of certificate substitution in proxy or network monitoring logs
- Applications connecting to IDN domains exhibiting unexpected behavior or data leakage
Detection Strategies
- Audit systems to identify curl installations with versions below 8.1.0
- Review build configurations to determine if curl is using its internal certificate matching function
- Implement network monitoring to detect certificate mismatches for IDN domain connections
- Enable verbose logging in applications using libcurl to capture certificate validation details
Monitoring Recommendations
- Configure SIEM rules to alert on TLS certificate validation anomalies involving punycode domains
- Monitor for connections to domains with xn-- prefixes that resolve to unexpected IP addresses
- Implement certificate transparency log monitoring for wildcard certificates that could be used in exploitation
- Enable endpoint detection to identify applications using vulnerable curl versions
How to Mitigate CVE-2023-28321
Immediate Actions Required
- Upgrade curl to version 8.1.0 or later immediately
- Review and update all applications and dependencies that bundle libcurl
- Configure curl to use TLS library-provided certificate matching where possible
- Audit systems for vulnerable versions using package managers or vulnerability scanners
- Consider implementing certificate pinning for critical connections
Patch Information
The vulnerability has been addressed in curl version 8.1.0 and later. Multiple vendors have released security updates:
- Haxx curl: Fixed in version 8.1.0 - see HackerOne Report #1950627
- Debian: Security update available via Debian LTS Announcement
- Fedora: Packages updated per Fedora Package Announcements
- NetApp: Advisory available at NetApp Security Advisory NTAP-20230609-0009
- Apple macOS: Updates available via Apple Support Document HT213843, HT213844, and HT213845
- Gentoo: Security update documented in GLSA 202310-12
Workarounds
- Configure curl builds to use TLS library certificate verification instead of curl's internal implementation
- Implement additional certificate validation at the application layer for IDN domains
- Use network-level controls to monitor and validate TLS connections to punycode domains
- Deploy web application firewalls or proxy servers that perform independent certificate validation
# Check curl version to verify if vulnerable
curl --version
# Update curl on Debian/Ubuntu systems
sudo apt update && sudo apt upgrade curl libcurl4
# Update curl on RHEL/Fedora systems
sudo dnf update curl libcurl
# Update curl on macOS via Homebrew
brew update && brew upgrade curl
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


