rustls-webpki Denial-of-Service Vulnerability via Malformed CRL BIT STRING
A denial-of-service vulnerability exists in rustls-webpki versions prior to 0.103.13 and between 0.104.0-alpha.1 and 0.104.0-alpha.7 due to a panic in `bit_string_flags()` when processing a malformed CRL BIT STRING, triggered when CRL checking is enabled and an attacker provides a crafted CRL.
A denial-of-service vulnerability has been identified in the rustls-webpki crate, specifically affecting versions prior to 0.103.13 and versions between 0.104.0-alpha.1 and 0.104.0-alpha.7. The vulnerability stems from a panic within the bit_string_flags() function located in src/der.rs. This panic occurs when the function processes a malformed Certificate Revocation List (CRL) containing a BIT STRING with a content of exactly [0x00]. The issue is triggered via the issuingDistributionPoint CRL extension when CRL revocation checking is explicitly enabled through RevocationOptions and the application loads CRL data from a source controlled by an attacker. This vulnerability allows a remote attacker to cause a denial of service in applications that rely on rustls-webpki for certificate validation.
Attack Chain
- Attacker obtains a certificate from a Certificate Authority (CA) that permits custom Certificate Distribution Point (CDP) URLs.
- Attacker sets the CDP of the certificate to point to a server they control (e.g.,
cdp). - The attacker crafts a malicious CRL with a BIT STRING in the
issuingDistributionPointextension containing the byte sequence0x00, triggering the vulnerability inbit_string_flags(). The CRL must be DER encoded and contain the following ASN.1 structure:a0 10 30 0e 30 0c 06 03 55 1d 1c 04 05 30 03 83 01 00 - The attacker hosts the crafted CRL on the server specified in the CDP.
- A vulnerable mTLS server configured to use CRL checking receives a connection request from a client presenting the attacker’s certificate.
- The mTLS server fetches the CRL from the attacker-controlled CDP server during the TLS handshake.
- The
BorrowedCertRevocationList::from_der()function parses the CRL, leading to the execution ofbit_string_flags()on the malformed BIT STRING. - The
bit_string_flags()function panics due to an index-out-of-bounds error, resulting in a denial-of-service condition on the mTLS server.
Impact
Successful exploitation of this vulnerability leads to a denial-of-service condition. Affected applications that perform mTLS, particularly servers, become unavailable when processing connections from clients presenting certificates with malicious CRL distribution points. This can disrupt services and impact availability. The severity is high because an attacker can trigger the vulnerability remotely without authentication.
Recommendation
- Upgrade to rustls-webpki version 0.103.13 or 0.104.0-alpha.7 or later to patch the vulnerability.
- Deploy the Sigma rule
Detect-Malformed-CRL-Bit-Stringto identify attempts to exploit this vulnerability by monitoring for specific byte sequences in CRL data. - Implement strict validation and sanitization of CRL data before processing it with
rustls-webpki, especially when fetching CRLs from untrusted sources.
Detection coverage 2
Detect Malformed CRL Bit String
highDetects malformed CRLs with a BIT STRING containing only 0x00 in the issuingDistributionPoint extension, which triggers a panic in rustls-webpki.
Detect Panic in rustls-webpki via Sysmon
highDetects process termination events indicative of a panic in rustls-webpki due to the malformed CRL processing vulnerability.
Detection queries are kept inside the platform. Get full rules →