Skip to content

CVE‐2026‐58059

David Hook edited this page Aug 3, 2026 · 1 revision

Title: Quadratic-time escaping when stringifying X.500 distinguished names.

Issue affecting: BC before 1.85, BC-LTS before 2.73.12, BC-FJA before bc-fips 1.0.2.7, 2.0.2 and 2.1.3.

Fixed versions: BC 1.85, BC-LTS 2.73.12, BC-FJA bc-fips 1.0.2.7, 2.0.2 and 2.1.3.

Platform affected: Java 8 and later.

IETFUtils.valueToString(), reached from X500Name.toString()/equals()/hashCode() via AbstractX500NameStyle, escapes special characters by calling vBuf.insert(index, "\") for each match while iterating the same buffer. Because insert shifts all trailing characters, a value of N escapable bytes costs roughly N²/2 char moves. An attacker who can supply an X.509 certificate, CSR, CRL, or CMS structure with a single ~60 KB RDN of commas or plus signs controls N. Any code path that logs, pretty-prints, compares, or hashes the resulting X500Name — including JCA X509Certificate.getSubjectX500Principal().toString() and BC certificate selectors/caches — will pin a CPU core for seconds to minutes, and a few parallel submissions saturate the server.

The fix was introduced in commit 7bf20eea8c1b.

Clone this wiki locally