On this page (16)
- 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 --versionand look at thelibrary versionsline to see which TLS library your build uses. - If you cannot upgrade yet, enable
--tls-crypt-v2,--tls-cryptor--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:
/* 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.
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 size | Decimal conversion time |
|---|---|
| 256 bytes | 0.004 s |
| 1 KB | 0.11 s |
| 2 KB | 0.85 s |
| 4 KB | 6.3 s |
| 8 KB | 51 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.
- 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.
- 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.
- 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:
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-cryptor--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-author--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
| Build | Status |
|---|---|
| OpenVPN 2.6.0 to 2.7.9 with Mbed TLS 3.x | Affected (about 51 s of CPU per 8 KB serial) |
| OpenVPN 2.7.x before 2.7.10 with Mbed TLS 4.x | Affected, lower cost (about 2.1 s per 8 KB serial) |
| OpenVPN built with OpenSSL | Not affected |
| OpenVPN 2.7.10 and later | Fixed |
| OpenVPN 2.6 branch | Fix 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.
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.logOther 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
- 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.
- Put a pre-shared key in front of the TLS stack.
--tls-crypt-v2is the best option, because each client gets its own key;--tls-cryptand--tls-authuse 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. - Build against OpenSSL if you compile OpenVPN yourself and have no reason to use Mbed TLS.
- 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
- OpenVPN security announcement for CVE-2026-135412
- OpenVPN 2.7.10 release and release notes (Changes.md)
- Fix "Reject certificates with too large serial numbers": master, release/2.7, release/2.6
- OpenVPN manual:
--tls-auth,--tls-cryptand--tls-crypt-v2 - RFC 5280, section 4.1.2.2: Serial Number
- CWE-407: Inefficient Algorithmic Complexity
Disclosure timeline
- Reported to the OpenVPN security team, with a proposed coordinated-disclosure timeline
- OpenVPN acknowledged the report
- Proof-of-concept certificate sent to OpenVPN
- Matching key and reproduction script sent
- OpenVPN reproduced the issue and began tracking it privately
- Fix committed to OpenVPN master, release/2.7 and release/2.6
- CVE-2026-135412 assigned; OpenVPN 2.7.10 released with the fix
- ResilientX Security published this write-up