AnyIO TLS Certificate Spoofing via IDNA 2003 Encoding
AnyIO versions prior to 4.14.2 are vulnerable to TLS certificate spoofing when using IDNA 2003 encoded internationalized domain names, allowing an attacker who redirects traffic to present a domain-validated certificate that the client incorrectly trusts.
What's new
- 1. added coverage for AnyIO (4.14.0, 4.14.1) Sep 19, 07:44 via ghsa
AnyIO (CVE-2026-63374) contains a vulnerability in its TLSStream implementation related to the handling of internationalized domain names (IDNs). The library incorrectly relies on the deprecated IDNA 2003 standard for host name encoding. If an application uses AnyIO's connect_tcp() or TLSStream.wrap() to connect to an internationalized domain, an attacker capable of hijacking or redirecting the network connection can exploit this discrepancy. By obtaining a legitimate TLS certificate using the IDNA 2003 encoding of the intended host name, the attacker can present this certificate to the AnyIO client. The client, utilizing the same outdated encoding logic, validates the malicious certificate as authentic for the intended domain. This vulnerability facilitates potential man-in-the-middle (MITM) attacks for services relying on AnyIO for outbound connections to internationalized domains.
Impact
The vulnerability poses a critical risk to applications using AnyIO that perform outbound connections to internationalized host names. Successful exploitation allows for the complete bypass of TLS certificate validation, enabling attackers to intercept, inspect, or modify sensitive data transmitted between the client and the intended server. Organizations operating services that communicate with diverse global domains are at the highest risk.
Recommendation
- Upgrade the
anyiopackage to version 4.14.2 or later immediately. - As a temporary workaround, manually encode host names using the modern
idnapackage prior to passing them to AnyIO connection methods to ensure compatibility with modern standards. - Audit application code to identify calls to
connect_tcp()orTLSStream.wrap()that handle user-provided or dynamic internationalized host names.
Immediate actions
Upgrade anyio package to version 4.14.2 or later
Mitigations
Manually encode internationalized host names using the idna package
CVE-2026-63374