Home
Blog
OpenSSL’s “Critical 9.8” bug: Let’s take a proper look

OpenSSL’s “Critical 9.8” bug: Let’s take a proper look

Paul Ducklin
11/24/2026
Share this article:

OpenSSL in the spotlight

As we’ve noted before, OpenSSL is almost certainly the world’s most widely-used cryptographic library.

It’s shipped as a standard package in many Linux and BSD distros, it’s present on every Mac, and it’s the go-to crypto engine of choice for many hardware products, from high-end security appliances to home routers and other IoT or embedded devices.

Security bugs in OpenSSL therefore attract attention, not least because vendors often use OpenSSL either to initiate secure connections to previously unknown and not-yet-trusted services, or to accept connections from unknown and untrusted visitors.

Unfortunately, an OpenSSL bug recently fixed in the current source code tree seems to have turned into dire and despairing warnings blurted by anyone and everyone, all over cyber-news websites and on social media.

But do the many reporters talking up this bug, dubbed CVE-2026-121481 and described in a single brief sentence in an OpenSSL advisory tagged GHSA-83xj-7xh4-4p7x, really know what they are talking about?

Part of the problem is that this bug has been presented in some reports as having a “danger score” of 9.8 out of 10, even though that score measures hazard (the worst that could happen if the bug were exploited) rather than risk (a more thoughtful combination of the likelihood that you are vulnerable to start with, that the bug could even be triggered against you, and that you might suffer a serious incident as a side-effect).

Nevertheless, CVE-2026-121481 is very definitely a bug, and code to demonstrate it on your own computer without doing any harm – if your installed version of OpenSSL is vulnerable, of course – is trivial.

This code, for example․․․

OpenSSL's "Critical 9.8" bug: Let's take a proper look - SolCyber

․․․compiled and linked against OpenSSL 4.1.0, which is the most recent release at the time of writing [2026-11-23T16:00:00Z], crashes unavoidably when run:


  $ gdb ./crash410
  GNU gdb (GDB) 18.1
  . . . .
  Reading symbols from ./crash410...
  (gdb) run
  . . . .
  Allocated heaps of RAM for any test.
  Initializing it...
  
  Starting EVP_EncodeBlock().
  Might crash...
  
  Program received signal SIGSEGV, Segmentation fault.
  0x00005555555e05a7 in encode_base64_avx2 ()
  (gdb) backtrace
  #0  0x00005555555e05a7 in encode_base64_avx2 ()
  #1  0x00005555555deddb in EVP_EncodeBlock ()
  #2  0x00005555555deabd in main ()
  (gdb) 

A closer look

NIST’s description says:

Calling EVP_EncodeBlock() with an input length close to INT_MAX may overflow the calculation of the encoded output size and write past the end of the caller-supplied output buffer.

For input lengths close to INT_MAX, the arithmetic that computes the encoded length overflows a signed integer, so the function writes more data than the documented output size. The result is a heap buffer overflow in the calling process. Reaching this requires an application to pass an input length near INT_MAX to EVP_EncodeBlock().

Usefully, NIST gives it a “danger score” of 5.9, much lower than the 9.8 some clickbaiters were trumpeting, and points out that:

OpenSSL’s TLS, QUIC and CMS implementations never encode buffers of that size.

Notably, TLS is the transport layer security encryption used by almost every website and data exchange site in the world these days, and QUIC is the latest website protocol (also known as HTTPS/3) that not only makes web traffic faster but also simplifies and speeds up the encrypted TLS part of the connection, too.

Most servers that make use of OpenSSL will be relying on OpenSSL’s TLS and QUIC interfaces, and therefore won’t be exploitable because they won’t access the buggy code in a way that could trigger the vulnerability.

Also revealed on NIST’s site is the fact that only the latest OpenSSL versions (4.0 and 4.1) are affected.

Many, if not most, Linux and BSD distros still use the 3.5 Long Term Support version, because it’s actually going to be around longer then 4.0 and 4.1 (supported until May 2027 and November 2027 respectively), with full, first-class support and patches until April 2030.

As we’ll explain, this bug is new to the 4.x release series, introduced in code that aimed to make the base64 encoding and decoding process faster on today’s computers.

But the faster, specially-crafted code introduced for raw performance is significantly longer and more complex than the code in version 3.5․․․

․․․and complexity and special-case tweaks are often the enemy of security, because cleaner and simpler code is typically easier to review, easier to audit, and easier to reason about.

Ironically, if understandably, most of the bug reports out there blindly repeat or embellish the original, informal words in the OpenSSL GitHub commit, insisting that the problem is that the “calculation of the encoded output size” may overflow.

The truth is that the OpenSSL code never explicitly calculates the amount of output data it will produce, but simply processes all the input data presented to it, encoding until it’s all been consumed.

Base64 converts every three-byte chunk of input into four bytes of output, essentially converting 3×8 = 24 bits of data into 4×6 = 24 bits of data, so that only 64 (26) different characters are enough to encode the output.

Regular base64 encoding sticks to the letters A to Z and a to z (52 characters), the digits 0 to 9 (a further 10), and two punctuations, usually + (plus)and / (slash), or alternatively - (hyphen) and _ (underscore), to make 64 characters in all.

The idea is that even though the data gets expanded by 33% in the process, thus increasing transmission time, it avoids the risk of it being modified or transcoded along the way, especially if the data passes through different operating systems or services that treat special characters differently.

The encoding process

If the input data isn’t an exact multiple of three bytes long, one or two extra zero bytes of implicit input data are added, to round up the input size.

The superfluous bytes at the end of the output are replaced with = (equals sign), so the decoder knows to remove those bytes from the final output:

  base64('HEL')    →  SEVM       Decodes exactly (4 back to 3)
  base64('HELL')   →  SEVMTA==   Decode then discard last 2 bytes
  base64('HELLO')  →  SEVMTE8=   Decode then discard last byte
  base64('HELLO.') →  SEVMTE8u   Decodes exactly (8 back to 6)

For good measure, OpenSSL adds a zero byte (the NUL character) at the end of the encoded output, which ensures that the output is a correctly-terminated text string in the C language, in case a programmer hands the output directly to one of C’s standard string-processing functions.

In other words, if your input is N bytes long, then the amount of output that this function can produce can be calculated in advance like this:

  Divide N by 3, then round up to the next integer if needed
  Multiply by 4, given that every 3-byte block encodes to 4 bytes.
  Add 1, to take care of the NUL byte that OpenSSL appends.

Now, the EVP_EncodeBlock() function in OpenSSL is declared in C as follows:

  int EVP_EncodeBlock(unsigned char* t, 
                      const unsigned char* f, 
                      int dlen);

Don’t worry if you aren’t a C coder – in simple terms, this means that you supply OpenSSL with three parameters, and get one number back:

  Pass in -
   The memory address to which the output will be written (t).
   The memory address from which the input will be read, (f).
   A C 'int' (integer) giving the size of the input (dlen).
  Get back -
   A C 'int' giving the amount of base64 encoded output.
   (The NUL byte is excluded from this count.)

There are problems here, including that numbers in C specified as int are stored in 32 bits, and can be positive, zero, or negative, which means their legal values are limited to the range -2147483648 to 2147483647 inclusive.

(Those numbers are -231 to 231-1. In tech-speak, you might say this out loud as “from minus-two-gig to plus-two-gig-minus-1.”)

You can therefore encode at most 2147483647 bytes of input at a time (a negative count of input bytes clearly doesn’t make sense), which means you need to allocate an output buffer at least this big:

  2147483647 / 3 → 715827882⅓
  Round up to 715827883
  715827883 × 4 → 2863311532
  2863311532 + 1 → 2863311533 (don't forget the NUL!)

As you can probably see already, even if you use OpenSSL 3.5.9, which doesn’t have this buffer overflow bug (assuming you correctly allocated 2.67GB of memory buffer for the output), you’ve got a problem, namely that the function is supposed to tell you how much output it actually created, in case you want to check that the amount is what you expected.

But the number 2863311532 can’t be represented as a C int, because it’s not between -2147483648 to 2147483647 inclusive, and if you treat it as an int, it ends up representing a huge negative number, as shown by this code, which is using OpenSSL 3.5.9 and therefore doesn’t crash:

OpenSSL's "Critical 9.8" bug: Let's take a proper look - SolCyber

  About to encode 2147483647 bytes into 2863311532.
  EVP_EncodeBlock() says it did -1431655764 bytes

  By the way, as unsigned hexadecimals, we get:
   olen = 0xAAAAAAAC
   O    = 0xAAAAAAAC

In other words, the interface to, and the specification for, this function should really be changed in all supported versions of OpenSSL, so that for any legal input value, the return value of the function will return a correct count of the output size.

In fact, that’s achieved by the fix already suggested for OpenSSL 4.x, as seen in the code changes visible on GitHub, added directly to the start of the EVP_EncodeBlock() function:

OpenSSL's "Critical 9.8" bug: Let's take a proper look - SolCyber

There’s worse

There’s worse, however, in the OpenSSL 4.x series.

As you can see in the diff screenshot above, there are two different ways that the 4.x code can handle the base64 encoding, either by calling old-style code that uses a straightforward internal function named evp_encodeblock_int(), or a code path not implemented until 4.x named encode_base64_avx2().

The latter aims to squeeze out extra performance if your computer’s processor supports Advanced Vector Extensions 2 (AVX2) instructions, which allow you to work on up to 256 bits (32 bytes) of input data at a time, not merely the 64 bits you’d expect from a 64-bit processor.

Intel and AMD processors from about 2011 onwards support AVX2, so this complex-but-quicker code path will be taken almost all the time.

And, to be fair, this alternative code path does provide a significant improvement – on my laptop, the AVX2 version runs more than three times faster than the plain integer version.

However, the code is not terribly well organized.

Firstly, despite the many reports saying that the bug is a fault in calculating the output size, the code never actually works out in advance how much output data it’s supposed to produce, and therefore has no way of checking whether it’s gone haywire and is about to emit too much.

Secondly, to speed things up, the AVX2 version churns through 96 bytes at a time, which corresponds to 32 chunks of three input bytes each time, instead of handling just three bytes every time round the loop, as a traditional implementations do.

But the fancy AVX2 code doesn’t correctly check whether it still has enough input data left for the next 96-byte chunk, and that’s the nature of the bug.

If it miscalculates how much input data remains to be processed, it ends up churning out ever more output data in an infinite loop, corrupting program memory at high speed until the program crashes, as depicted above.

And crash it definitely does, if you ask it to encode 2147483620 or more bytes in one go, even if you have plenty of extra space in the output buffer.

We’ll explain why the bug starts only at an input size of 2147483620 (0x7FFFFFFE4 in hexadecimal) in the next section.

Integer miscalculation

Every time the AVX2 encoder is about to go round its 96-bytes-in-each-iteration loop, it checks that there are still at least 96 bytes plus an extra 4 bytes (100 in total) left in the input buffer, using a logical test that we can write in pseudocode like this, where usedup denotes the number of bytes processed so far:

   IF (usedup + 100) > (inputlength) THEN exit the loop

But this code goes horribly wrong if the value of usedup reaches or exceeds 2147483548, because 2147483548 + 100 is exactly 2147483648 (231> – one larger than the maximum positive number you can represent using a C int variable, as we explained earlier.

As soon as usedup+100 works out to be 231 or above, you get what’s known as an integer overflow, and the answers suddenly start coming out as negative numbers, as shown in this chart:

  value        value+100     (in hex)    as C 'int'
  ----------   ----------   ----------   ----------
  2147483544   2147483644   0x7FFFFFFC   2147483644
  2147483545   2147483645   0x7FFFFFFD   2147483645
  2147483546   2147483646   0x7FFFFFFE   2147483646
  2147483547   2147483647   0x7FFFFFFF   2147483647
  2147483548   2147483648   0x80000000  -2147483648
  2147483549   2147483649   0x80000001  -2147483647
  2147483550   2147483650   0x80000002  -2147483646
  2147483551   2147483651   0x80000003  -2147483645

As you can see, once usedup+100 turns into a negative number, the test (usedup+100) > (inputlength) can never be true, because inputlength is a fixed value that’s positive, and a negative number will always be less than a positive one, by definition.

From this point on, the loop runs forever, because the terminating condition is never reached, and each time round the loop, another 96 superfluous bytes are appended to the output buffer, so a buffer overflow is guaranteed.

The program will unavoidably crash, if it doesn’t go off the rails in a controllable way first and lead to what’s known as RCE, or remote code execution.


If you’re a LinkedIn user and you’re not yet following @SolCyber, do so now to keep up with the delightfully useful Amos The Armadillo’s Almanac series. SolCyber’s lovable mascot Amos provides regular, amusing, and easy-to-digest explanations of cybersecurity jargon, from MiTMs and IDSes to DDoSes and RCEs.

OpenSSL's "Critical 9.8" bug: Let's take a proper look - SolCyber

Even if you know all the jargon yourself, Amos will help you explain it to colleagues, friends, and family in an unpretentious, unintimidating way.


In real life, usedup takes a predictable sequence of values: 0, 96, 192, 288 and so on, eventually heading towards 2147483424, 2147483520, 2147483616, etc.

If the chosen input length is exactly 2147483619 (0x7FFFFFE3), then when usedup reaches 2147483520, usedup+100 is 2147483620 and so the code correctly detects that (usedup+100) > (inputlength), meaning we’ve reached the end, and the loop exits correctly.

But that’s the highest possible input length that works, because increasing the input length by one to 2147483620 (0x7FFFFFE4) means going round the loop once more, at which point usedup will be 2147483616, so (usedup+100) will be 2147483616 (0x80000044), which the C code interprets as the negative number -214748358.

The value (usedup+100) will always be less than inputlength, and the code will keep looping forever.

The extent and speed of this buffer overflow, where 96 extra bytes are spammed into memory as fast as the base64 encoder can produce them, which is very fast indeed, suggests that this bug won’t be easy to exploit in a controllable way, if if can be controlled at all. Once it triggers, the buffer overflow is likely to destroy the entire memory space of the affected process before any other part of the program gets a chance to be tricked or attacked. But even if an RCE is unlikely or impossible, a denial of service caused by the abrupt termination of the offending program is inevitable, because the error kicks off an infinite buffer-spraying loop.

What to do?

  • If you don’t use OpenSSL 4.0 or 4.1, this bug can’t be triggered. Most users, whether on a laptop or a server, will be using the OpenSSL 3.5 series, because it’s officially supported for longer than any other official release, and is the one that comes with most Linux distros.
  • If you use OpenSSL to support encrypted web connections using TLS and QUIC, you probably aren’t affected. Unless you use OpenSSL to do base64 encoding for yourself, directly in your app, the bug won’t be triggered. Any base64 encoding carried out inside OpenSSL as a side-effect of other functions will use an input buffer far smaller than the multigigabyte hard limits explained above.
  • If your own code never directly encodes more than 161061273 (1.6GB) at a time, you aren’t affected. Few, if any, network-based programs would ever process truly huge data buffers in one go, for reliabiltiy reasons. Encoding 2GB in 2000 separate calls of 1MB each would massively reduce memory pressure, but not affect performance in any measurable way.
  • Watch out for the next OpenSSL patch, which is currently expected on 2026-12-01. Just to be clear, if you haven’t yet switched to 4.0 or 4.1, you should be using 3.5, because the 3.6 version is already out of support. (3.5 has the special status of LTS, short for long-term support.)
  • Don’t overreact to media reports that hype up vulnerabilities. Check with a reputable source such as this blog first. The cybersecurity industry is in a vulnerability hype-phase at the moment, so don’t be distracted by drama.

Why not ask how SolCyber can help you do cybersecurity in the most human-friendly way? Don’t get stuck behind an ever-expanding convoy of security tools that leave you at the whim of policies and procedures that are dictated by the tools, even though they don’t suit your IT team, your colleagues, or your customers!

OpenSSL's "Critical 9.8" bug: Let's take a proper look - SolCyber

Paul Ducklin
Paul Ducklin
11/24/2026
Share this article:

Table of contents:

The world doesn’t need another traditional MSSP 
or MDR or XDR.

What it requires is practicality and reason.

Related articles

Choose identity-first managed security.

We start with identity and end with transparency — protecting where attacks begin and keeping you informed, with as much visibility as you want. No black boxes, just clear, expert-driven security.
No more paying for useless bells and whistles.
No more time wasted on endless security alerts.
No more juggling multiple technologies and contracts.

Follow us!

Subscribe

Join our newsletter to stay up to date on features and releases.

By subscribing you agree to our Privacy Policy and provide consent to receive updates from our company.

©
2026
SolCyber. All rights reserved
|
Made with
by
Jason Pittock

I am interested in
SolCyber DPM++

I am interested in
SolCyber XDR++™

I am interested in
SolCyber MDR++™

I am interested in
SolCyber Extended Coverage™

I am interested in
SolCyber Foundational Coverage™

I am interested in a
Free Demo

15452