wolfSSL — Delimiter Injection in X509_get_name_oneline Certificate Name Output
wolfSSL_X509_get_name_oneline renders a certificate name as "type=value" pairs joined with ", " and copies each value unescaped. A certificate whose field value contains a comma, an equals sign, a NUL or CR/LF produces output with fields, a truncation point or lines that the certificate's author chose.
- Advisory
- BYTERAY-2026-0448
- CWE
- CWE-140
- CVSS
- 3.7 (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N)
- Vendor
- wolfSSL
- Product
- wolfSSL
- Reported
- 2026-09-28
- Disclosure
- 2026-12-03
- Affected
- wolfSSL 5.9.2 (tested at master commit d95483f), builds with OPENSSL_EXTRA and XSNPRINTF whose application renders a certificate name with wolfSSL_X509_get_name_oneline
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
wolfSSL_X509_get_name_oneline() turns an X.509 name into a single string such as C=US, O=Example, CN=alice. Applications use it to display or log the subject and issuer of a certificate.
The function reads each name entry's value as raw bytes and formats it with %s=%s,. It does not escape anything. When the name comes from a certificate presented by a TLS peer, the peer chose those bytes. A common name of a, O=Injected is rendered as CN=a, O=Injected, which shows an organisation field that is not in the certificate. A value with CR and LF starts a new line in a log. A value with a NUL ends its field early.
The memory handling in the function is correct, and nothing inside wolfSSL makes a security decision from this string. The effect is on applications that split, compare or log the rendered name. The function is part of the OpenSSL compatibility layer, which is not in a default build.
Affected Products and Versions
- Component:
src/x509.c,wolfSSL_X509_get_name_oneline(). - Required build:
OPENSSL_EXTRAwithXSNPRINTFavailable (src/x509.c:4069). Required use: an application that passes a peer certificate's subject or issuer name to this function and then parses or logs the result. The C# wrapper exposes the output as itsIssuerandSubjectproperties (wrapper/CSharp/wolfSSL_CSharp/X509.cs:91-97). - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- A default build is not affected. The OpenSSL compatibility layer is disabled by default (
configure.ac:3315). - Other releases were not checked.
Technical Details
For each entry the function fetches the value text into an 80-byte stack buffer (src/x509.c:4104, src/x509.c:4113) and joins it to the short name of the field:
strLen = XSNPRINTF(str, (size_t)strSz, "%s=%s, ", sn, buf);
That is the form for every entry except the last (src/x509.c:4137). The last entry uses "%s=%s" (src/x509.c:4154).
The path of a value:
- The certificate's name is decoded and each attribute value is stored in a name entry as it appears in the certificate.
wolfSSL_X509_NAME_get_text_by_NID()copies the value bytes into the caller's buffer withXMEMCPYand terminates it (src/x509.c:6392).wolfSSL_X509_get_name_oneline()formats the pair, appends it to its working buffer and, after the last entry, copies the result to the caller and terminates it (src/x509.c:4187-4188).
There is no step that inspects the value bytes. The length checks after each XSNPRINTF (src/x509.c:4138, src/x509.c:4155) protect the buffers and do nothing else. The 80-byte fetch buffer also cuts longer values short without reporting it.
The library has an escaping routine for exactly this data. wolfssl_x509_name_esc_value() implements RFC 2253 style escaping (src/x509.c:15617-15672), but it is called only from wolfSSL_X509_NAME_print_ex(). The one-line getter does not use it.
Reachability and Preconditions
- Build with
OPENSSL_EXTRA. - The application calls
wolfSSL_X509_get_name_oneline()on a name taken from a certificate it received, then splits the result on commas, compares fields, or writes it to a line-oriented log. - The attacker presents a certificate with a chosen attribute value: a client certificate to a server, or a server certificate to a client. If the application renders the name only after chain verification, the attacker needs a certificate from an accepted CA that carries the value. If it renders names of unverified certificates, any certificate works.
- No other privilege is needed.
Impact
Fields that are not in the certificate appear in the rendered name, values can be cut at a chosen point, and log output can be given extra lines. An application that derives an identity or an authorisation attribute by parsing this string can be misled. The impact is on integrity of displayed and parsed names only. There is no memory-safety impact, and wolfSSL's own certificate verification does not use this string.
ByteRay did not build a proof of concept for this issue. The analysis is from source review.
Remediation and Mitigation
ByteRay has not confirmed a fixed wolfSSL release for this issue as of 2026-12-03, and has not checked it against wolfSSL changes made after the tested commit.
The fix direction is to pass each value through the existing escaper, wolfssl_x509_name_esc_value(), before joining, as wolfSSL_X509_NAME_print_ex() already does. The escaping has to cover the comma, the equals sign, the plus sign, NUL, CR and LF. The fixed 80-byte fetch should be replaced by a fetch sized to the value so that long values are not shortened silently. Applications should treat the one-line form as display text. For any decision, read the individual entries with wolfSSL_X509_NAME_get_entry() or use wolfSSL_X509_NAME_print_ex() with RFC 2253 flags, and sanitise names before logging them.
Timeline
- 2026-09-28 — Reported to wolfSSL.
- 2026-12-03 — Public disclosure.
Credits
Discovered and reported by Mehrun P. Hunter and Shahriyar Jalayeri of ByteRay Ltd.
References
wolfSSL_X509_get_name_onelineat the tested commitwolfssl_x509_name_esc_value, the escaper that is not used on this path, at the tested commit- BYTERAY-2026-0447, delimiter injection in the ALPN peer protocol list
- BYTERAY-2026-0449, delimiter injection in
wolfSSL_X509_NAME_oneline - BYTERAY-2026-0450, delimiter injection in subjectAltName printing