Skip to content
ResilientX SecurityResearch Labs
Vulnerability disclosureHigh 7.5CVE-2026-135412

CVE-2026-135412: how one oversized certificate serial stalls an OpenVPN server

One handshake with an 8 KB certificate serial froze an OpenVPN server built with Mbed TLS for about 44 seconds, before authentication. Fixed in OpenVPN 2.7.10.

Arturs Parker, Jim Biniyaz 9 min read
On this page (16)
CVE
CVE-2026-135412
Severity
High 7.5
Affected
OpenVPN 2.6.0 to 2.7.9 built with Mbed TLS (fixed in 2.7.10)

Summary

OpenVPN 2.6.0 through 2.7.9, when built with the Mbed TLS library, could be stalled by a remote attacker who has no credentials at all. The attacker starts a TLS handshake and presents a certificate whose serial number is several kilobytes long. The certificate fails verification, and before rejecting it OpenVPN converts the serial number into a decimal string for its log message. With Mbed TLS that conversion is extremely slow: an 8,192-byte serial took about 51 seconds of CPU time in our benchmark, and in an end-to-end test a single handshake froze an OpenVPN 2.7.9 server for about 44 seconds. OpenVPN serves every client from one event loop, so nobody else is served while this runs, and the attacker can simply send the next handshake.

We reported the issue to the OpenVPN security team on 13 November 2026. It is tracked as CVE-2026-135412 and fixed in OpenVPN 2.7.10, released on 2 December 2026. The fix rejects any certificate whose serial number is longer than 40 bytes before anything else is done with it.

What to do now:

  • Upgrade to OpenVPN 2.7.10 or later if your build uses Mbed TLS. Run openvpn --version and look at the library versions line to see which TLS library your build uses.
  • If you cannot upgrade yet, enable --tls-crypt-v2, --tls-crypt or --tls-auth. They make the server drop handshake packets that do not carry a valid pre-shared key before any certificate is processed, so an outside attacker cannot reach the vulnerable code.
  • OpenVPN builds that use OpenSSL are not affected.

Background

OpenVPN 2.x can be built against one of two TLS libraries. Most Linux distributions and the Windows installers use OpenSSL. Mbed TLS is a compact library that is popular in embedded systems, routers and appliances, and OpenVPN builds that use it ship in firmware and in some package feeds (OpenWrt's openvpn-mbedtls package, for example).

Every X.509 certificate carries a serial number, an integer assigned by the issuing certificate authority. RFC 5280 forbids conforming CAs from using serial numbers longer than 20 octets. Nothing stops anyone from creating their own certificate with a much longer one, though, and a certificate does not need to be trusted to reach the code that inspects it.

When a VPN peer presents a certificate that does not chain to the configured CA, OpenVPN rejects the connection and writes a VERIFY ERROR line to its log with the certificate's subject and its serial number. That rejection path is where the problem lies: the server does work on the fields of a certificate it is about to refuse, and an anonymous peer decides how much.

Technical analysis

The vulnerable path

In OpenVPN's Mbed TLS backend, every certificate the peer presents goes through verify_callback() in src/openvpn/ssl_verify_mbedtls.c. Mbed TLS calls it with a set of flags, which are non-zero when verification has failed, for example because the certificate is not signed by a trusted CA. In that case the callback builds an error message before it rejects the peer. Simplified, the 2.7.9 logic looks like this:

C
/* OpenVPN 2.7.9, ssl_verify_mbedtls.c, verify_callback() — simplified */
if (flags != 0) {                                  /* verification failed          */
    subject = x509_get_subject(cert);
    serial  = backend_x509_get_serial(cert);       /* serial → decimal string      */
    msg(D_TLS_ERRORS, "VERIFY ERROR: depth=%d, subject=%s, serial=%s: %s",
        depth, subject, serial, error_text);
}

backend_x509_get_serial() turns the serial's raw bytes into a decimal string. With Mbed TLS 3.x it loads the bytes into an Mbed TLS big number with mbedtls_mpi_read_binary() and prints it with mbedtls_mpi_write_string() in radix 10. With Mbed TLS 4.x, OpenVPN uses its own write_bignum() helper instead. Either way, the length of the serial comes straight from the certificate, so the attacker chooses it, and nothing on this path limited it.

CVE-2026-135412 attack flow: one oversized certificate serial stalls an OpenVPN server built with Mbed TLS An anonymous peer starts a TLS handshake and presents a self-signed certificate with an 8,192-byte serial number. Unless tls-crypt-v2, tls-crypt or tls-auth drops the packet first, OpenVPN rejects the certificate and converts the serial to decimal for its VERIFY ERROR log line, which takes about 51 seconds of CPU with Mbed TLS 3.x. OpenVPN serves every client from one event loop, so the whole server stalls, and the attacker can repeat the handshake. A chart shows the conversion time growing from 0.004 seconds for a 256-byte serial to 51 seconds for 8 KB, against under 1 millisecond in hexadecimal and about 4 milliseconds with OpenSSL. OpenVPN 2.7.10 rejects serials longer than 40 bytes before any conversion. CVE-2026-135412 · OPENVPN 2.6.0–2.7.9 BUILT WITH MBED TLS One oversized certificate serial stalls the whole server PRE-AUTH · CPU DoS 01 ATTACKER Anonymous peer No CA-signed certificate, no username, no password. X.509 certificate self-signed · 8.5 KB serial: 8,192 bytes (RFC: ≤ 20) 02 HANDSHAKE TLS handshake Certificate sent over the control channel, UDP or TCP port 1194. With tls-crypt-v2, tls-crypt or tls-auth: dropped here, before the cert is ever read 03 VERIFY_CALLBACK() Rejected, slowly Not signed by our CA, so the VERIFY ERROR line prints the serial in decimal: backend_x509_get_serial() ≈ 51 s of CPU 8 KB serial, Mbed TLS 3.x 04 IMPACT Server stalled One event loop serves every client: nothing else runs meanwhile. new handshakes time out; tunnel traffic stalls unless offloaded (DCO) FIXED IN 2.7.10 Repeat the handshake: the stall starts again, for as long as the attacker likes Decimal conversion time vs serial size conversion only · Mbed TLS 3.6.5 · log scale 1 ms 10 ms 0.1 s 1 s 10 s 100 s 256 B 0.004 s 1 KB 0.11 s 2 KB 0.85 s 4 KB 6.3 s 8 KB 51 s 8 KB hex < 1 ms 8 KB OpenSSL ≈ 4 ms THE FIX · OPENVPN 2.7.10 Serials longer than 40 bytes are rejected at the start of verify_callback(), before any conversion. Mbed TLS and OpenSSL builds both check the size. RFC 5280 caps serials at 20 octets: valid certificates pass. ResilientX Security · Research Labs Credit: Arturs Parker, Jim Biniyaz
CVE-2026-135412 attack flow: an anonymous peer sends a certificate with an 8,192-byte serial; OpenVPN with Mbed TLS spends about 51 seconds converting it to decimal for the VERIFY ERROR log, stalling every client; repeatable; fixed in OpenVPN 2.7.10, which rejects serials over 40 bytes. CVE-2026-135412 · OPENVPN + MBED TLS One oversized certificate serial stalls the whole server PRE-AUTH · CPU DoS 01 ATTACKER Anonymous peer No CA-signed certificate, no username, no password. X.509 certificate self-signed · 8.5 KB serial: 8,192 bytes (RFC: ≤ 20) 02 HANDSHAKE TLS handshake Certificate sent over the control channel, UDP or TCP port 1194. With tls-crypt-v2, tls-crypt or tls-auth: dropped here, before the cert is ever read 03 VERIFY_CALLBACK() Rejected, slowly Not signed by our CA, so the VERIFY ERROR line prints the serial in decimal. backend_x509_get_serial() ≈ 51 s of CPU 8 KB serial, Mbed TLS 3.x FIXED IN 2.7.10 04 IMPACT Server stalled One event loop serves every client: nothing else runs meanwhile. new handshakes time out; tunnel traffic stalls unless offloaded (DCO) Repeat the handshake: the stall starts again, for as long as the attacker likes Decimal conversion time vs serial size conversion only · Mbed TLS 3.6.5 · log scale 1 ms 10 ms 0.1 s 1 s 10 s 100 s 256 B 0.004 s 1 KB 0.11 s 2 KB 0.85 s 4 KB 6.3 s 8 KB 51 s 8 KB hex < 1 ms 8 KB OpenSSL ≈ 4 ms THE FIX · OPENVPN 2.7.10 Serials longer than 40 bytes are rejected at the start of verify_callback(), before any conversion. Mbed TLS and OpenSSL builds both check the size. RFC 5280 caps serials at 20 octets, so valid certificates pass. Credit: Arturs Parker, Jim Biniyaz ResilientX Security · Research Labs
Figure 1. One handshake with an oversized certificate serial stalls an OpenVPN 2.6.0–2.7.9 server built with Mbed TLS. OpenVPN 2.7.10 rejects the certificate before the conversion runs.

Why decimal is expensive

Printing a large number in hexadecimal is cheap: every byte becomes two characters, and the work grows linearly with the length. Decimal is different, because 10 is not a power of two. A conversion has to divide the whole number by 10 (or by a power of 10) again and again, and each division walks the entire number. On Mbed TLS 3.x the time roughly multiplies by eight each time the serial doubles, so it grows with about the cube of the length. OpenVPN's own helper for Mbed TLS 4.x is quadratic.

We measured the decimal conversion on its own, with Mbed TLS 3.6.5:

Serial sizeDecimal conversion time
256 bytes0.004 s
1 KB0.11 s
2 KB0.85 s
4 KB6.3 s
8 KB51 s

For comparison, the same 8 KB serial converts to hexadecimal in under a millisecond, and OpenSSL's decimal conversion of it takes about 4 milliseconds. On an Mbed TLS 4.x build, OpenVPN's quadratic helper needed about 2.1 seconds for 8 KB: far less, but still a lot of work to hand to an anonymous peer.

From a slow log message to a denial of service

Three properties of OpenVPN turn this slow conversion into an outage.

  1. It runs before authentication. The conversion happens while the certificate is being rejected. The attacker needs no certificate from the server's CA, no username and no password: a self-signed certificate with a long serial is enough. The test certificate we sent to OpenVPN is 8.5 KB in total.
  2. It blocks the whole server. OpenVPN 2.x serves all clients from a single-threaded event loop. While the conversion runs, the server process handles nothing else: new connections cannot complete, and unless the data channel is offloaded to the kernel (DCO), traffic on established tunnels stalls too. In our end-to-end test against OpenVPN 2.7.9 with Mbed TLS 3.x, a single handshake froze the server for about 44 seconds.
  3. It can be repeated. Every new handshake starts the clock again. One or two handshakes a minute from a single host keep the server unavailable for as long as the attacker wants, with almost no bandwidth.

Other places the serial is converted

OpenVPN also prints the serial in decimal when it exports the tls_serial_N variables to scripts and plugins, and when it looks up revoked certificates with --crl-verify in directory mode. Both run only for certificates that have already passed CA verification, so an outside attacker cannot reach them; a misbehaving CA could. The fix covers all three paths, because it refuses the certificate before any of them runs.

The same verification callback is used in client mode. A client built with Mbed TLS that connects to a malicious server could be stalled in the same way. That is a much weaker attack, because the attacker has to be the server the client connects to.

The fix

OpenVPN 2.7.10 checks the serial's size at the very start of the verification callback, in both the Mbed TLS and the OpenSSL backends. A certificate whose serial number is longer than 40 bytes (twice the RFC 5280 maximum) is rejected without being converted, and the server logs:

Plain text
VERIFY ERROR: depth=0, Certificate with excessively long serial, maximum is 40 bytes.

The maintainers chose to refuse such certificates outright rather than only shorten the log output. A peer that sends a serial that long is almost certainly up to no good, and refusing the certificate early protects any other code that might process it later. It is also the first remedy we suggested in our report. Certificates from a conforming CA never exceed 20 octets, so the new limit should not affect legitimate deployments.

The patch is in OpenVPN itself. Updating the Mbed TLS library alone does not change OpenVPN's behaviour.

Impact

  • Who is exposed: OpenVPN servers built with Mbed TLS that accept handshakes from untrusted networks without --tls-auth, --tls-crypt or --tls-crypt-v2.
  • What an attacker can do: make the server unavailable for as long as they keep sending handshakes. The impact is limited to availability: there is no code execution, memory corruption, data exposure or authentication bypass.
  • What the attacker needs: network access to the OpenVPN port and nothing else. On servers that use --tls-auth or --tls-crypt, the attacker would also need the shared key, which every client configuration contains.
  • Our severity assessment: CVSS 3.1 base score 7.5 (High), AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H; weakness CWE-407, Inefficient Algorithmic Complexity. The score in the official CVE record may differ.

For a remote-access VPN, availability is the whole service: while the server is stalled, nobody can connect or reconnect, whether remote employees, site links or the administrators trying to find out what is wrong.

Affected and fixed versions

BuildStatus
OpenVPN 2.6.0 to 2.7.9 with Mbed TLS 3.xAffected (about 51 s of CPU per 8 KB serial)
OpenVPN 2.7.x before 2.7.10 with Mbed TLS 4.xAffected, lower cost (about 2.1 s per 8 KB serial)
OpenVPN built with OpenSSLNot affected
OpenVPN 2.7.10 and laterFixed
OpenVPN 2.6 branchFix committed to release/2.6 on 1 December 2026; no 2.6 release contained it at the time of writing

This write-up covers OpenVPN 2.x, the community server and client. We did not assess OpenVPN 3 or commercial OpenVPN products.

Detection and mitigation

Check whether you are exposed

The library versions line of openvpn --version names the TLS library your build uses. If it says Mbed TLS and the version is older than 2.7.10, the server is affected unless every handshake is protected by --tls-auth, --tls-crypt or --tls-crypt-v2.

Look for attempts

On an unpatched server, an attempt ends with a VERIFY ERROR line whose serial= field is absurdly long. A 20-octet serial has at most 49 decimal digits; an 8 KB serial has almost 20,000. The line appears only after the stall is over. On a patched server, each attempt produces the new rejection message instead.

Shell
# Unpatched servers: serials longer than RFC 5280 allows (more than 49 decimal digits)
grep -E 'VERIFY ERROR: .*serial=[0-9]{50,}' /path/to/openvpn.log

# Patched servers (2.7.10 and later): rejected oversized serials
grep 'Certificate with excessively long serial' /path/to/openvpn.log

Other signs of an attack in progress: the openvpn process pinned at 100% of one CPU core for tens of seconds, gaps in the server log, and clients reporting TLS key negotiation failed to occur within 60 seconds.

Mitigate

  1. Upgrade to OpenVPN 2.7.10. Vendors that embed OpenVPN with Mbed TLS in routers, firewalls or appliances should ship the fix in their next firmware.
  2. Put a pre-shared key in front of the TLS stack. --tls-crypt-v2 is the best option, because each client gets its own key; --tls-crypt and --tls-auth use one key shared by all clients. With any of them, the server drops handshake packets without a valid key before certificate processing starts. These options also protect against other attacks on the TLS stack, so they are worth enabling regardless of this issue.
  3. Build against OpenSSL if you compile OpenVPN yourself and have no reason to use Mbed TLS.
  4. Restrict the OpenVPN port at the firewall when the source networks of your clients are known.

Coordinated disclosure

We reported the issue privately to security@openvpn.net on 13 November 2026, with the affected code path, benchmarks, a suggested fix and a proposed disclosure timeline, and followed up with a test certificate and a reproduction script. The OpenVPN team reproduced the problem within four days, wrote and reviewed the fix, assigned CVE-2026-135412 and released OpenVPN 2.7.10 nineteen days after our report.

We thank Max Fillinger and the OpenVPN security team for a fast and professional process.

We are not publishing the proof-of-concept certificate or the reproduction script.

Credit: Arturs Parker and Jim Biniyaz, ResilientX Security.

References

Disclosure timeline

  1. Reported to the OpenVPN security team, with a proposed coordinated-disclosure timeline
  2. OpenVPN acknowledged the report
  3. Proof-of-concept certificate sent to OpenVPN
  4. Matching key and reproduction script sent
  5. OpenVPN reproduced the issue and began tracking it privately
  6. Fix committed to OpenVPN master, release/2.7 and release/2.6
  7. CVE-2026-135412 assigned; OpenVPN 2.7.10 released with the fix
  8. ResilientX Security published this write-up
#OpenVPN#Mbed TLS#X.509#denial of service#CWE-407#coordinated disclosure