Skip to content
CyberBadger
← All articles
Cybersecurity

Two 896-Byte Files That Crashed a Java HDF5 Reader: Inside the jhdf Fixes

November 16, 20266 min readNathan Cross
Security advisories
Published on GitHub by the maintainer
Fixed
Library
jhdf (io.jhdf:jhdf), by James Mudd
Affected
0.13.0 and earlier
Patched
0.14.0, November 10, 2026
Credit
Nathan Cross (CyberBadger)

jhdf, an open-source Java library for reading HDF5 data files, fixed two issues we reported in November. Each one let a file smaller than 1 KB crash the application reading it. Here's how, why a normal try/catch didn't help, and who should update.

jhdf is an open-source Java library for reading and writing HDF5 files, a common format for large scientific and engineering datasets. In November we reported two issues in it to its maintainer, James Mudd. Both are fixed in jhdf 0.14.0, and both advisories are public.

Our research doesn't stop at websites and plugins. Libraries like this one are the building blocks other software is made from, and a flaw in one is inherited by every program that uses it, often without its developers knowing the library is there.

The short version

  • Two issues, one result. Each one let a specially made HDF5 file of 896 bytes crash the program reading it.
  • No data exposure. Neither issue leaks data or lets anyone run code. They knock the reader over.
  • Fixed in jhdf 0.14.0, released November 10, 2026, on GitHub and Maven Central. If your software uses jhdf, update it.

Timeline

We sent both reports through GitHub's private vulnerability reporting early on November 4, each with a proof of concept and a suggested fix. The maintainer confirmed them three days later, merged both fixes within a day of each other and released 0.14.0 with credit in the release notes.

  1. ReportedNov 4, 1:46 AM

    Two private GitHub security advisories, each with a proof of concept and a suggested fix.

    Six days from report to release
  2. AcceptedNov 7

    The maintainer confirmed both reports and merged the recursion fix the same day.

  3. Second fix mergedNov 8

    File reads are now checked against the size of the file before any memory is set aside.

  4. FixedNov 10, 12:52 PM

    jhdf 0.14.0 released on GitHub, both issues listed as security fixes with credit, and on Maven Central about 20 minutes later. The advisories went public within the same minute as the release.

  5. Write-upNov 16

    This post. CVE IDs haven’t been assigned yet.

Times Eastern, from the GitHub advisories, the pull requests and the 0.14.0 release.

Six days from report to release is fast and careful work for an open-source project. The advisories James published describe both issues in full, so here is what was wrong, in plain terms.

Two 896-byte files, a few bytes changed
Both start from a valid test file in the jhdf repository
byte 0byte 896
Every change is inside bytes 98 to 127, in the file’s root object header.
File 1: one field changed
Message count@98
3
Size of the messages@104
24 bytes 2,130,706,432 bytes
Continuation offset@120
byte 800
File 2: two fields changed
Message count@98
3 65,535
Size of the messages@104
24 bytes
Continuation offset@120
byte 800 byte 112, its own start
Byte offsets into the file. In our tests the unchanged test file opened normally.

Issue 1: a tiny file that asks for 2 GB

An HDF5 file is built from headers that describe what comes next, including how many bytes the next block takes up. When jhdf opened a file from disk or from a stream, it read that number and set aside that much memory straight away, before reading anything and without checking that the file was even that big.

Changing one 4-byte field in a valid 896-byte file, from 24 to 2,130,706,432, made jhdf ask Java for about 2 GB of memory at once. Java refused with an OutOfMemoryError. We tested with 128 MB, 512 MB and 1 GB of memory available, and it failed every time: the size comes from the file, so more memory only raises the number an attacker writes into it.

  • The fix: jhdf now checks every read against the size of the file before setting any memory aside.
  • Severity: 7.5High CVSS 3.1, from the advisory.

Issue 2: a header that points back at itself

A header can continue in another part of the file, and jhdf followed each continuation by calling its own reading code again. It kept no record of which parts it had already visited, and the only limit was the header's own count of how many messages it holds, a number the file sets, up to 65,535.

Pointing a continuation back at its own header and raising that count to 65,535 sent jhdf around the same loop until Java ran out of room to track it, a StackOverflowError. We ran it with a smaller thread stack than Java's default. The file allows 65,535 levels, so the default should overflow too, but we didn't test that.

  • The fix: jhdf now remembers which continuations it has followed, refuses to follow one twice and caps how long a chain can be.
  • Severity: 7.5High CVSS 3.1, from the advisory.

Why a normal try/catch didn't help

Java separates two kinds of failure. An Exception is a problem the program is expected to handle, like a damaged file. An Error means the Java runtime itself ran out of something, memory or stack, and most code doesn't try to handle those.

Code that reads files almost always wraps the work in a block that catches Exceptions and rejects the bad file. jhdf's own error handling did the same. Both of these failures were Errors, so they went straight past every catch block and took down the thread, often the whole program.

Why the usual safety net misses it
try { open the file } catch (Exception e) { reject it }
A damaged file the reader recognises
HdfException
An Exception: the catch block handles it
File rejected, app carries on
File 1: a 2 GB size
OutOfMemoryError
An Error: catch (Exception) doesn’t see it
Thread or process dies
File 2: a header pointing at itself
StackOverflowError
An Error: catch (Exception) doesn’t see it
Thread or process dies
On jhdf 0.13.0, opening a file by path or from a stream. The in-memory route (fromBytes) already rejected File 1 cleanly in our tests.

According to the maintainer's fix notes, in 0.14.0 both files now fail with jhdf's ordinary HdfException, so the usual safety net catches them and rejects the file like any other damaged one.

How widely jhdf is used

jhdf is a small project, but it sits inside other software. A search of public code on GitHub finds at least 69 repositories that declare or import it, including a distributed SQL query engine and a deep-learning library, each with more than 1,500 stars on GitHub. Others are desktop applications for X-ray analysis, cell biology and neural modelling, and vector-search benchmarking tools. Every one we checked still pins a version from before the fix.

That number is a floor, not an estimate. Private and in-house software doesn't show up in a public search, and Maven Central doesn't publish download counts, so nobody can say how many running systems include jhdf. We're contacting the most exposed projects directly, and we'll name them here once they've had a chance to update.

Who should care

Anything that opens HDF5 files it didn't create itself: upload services, data pipelines, research platforms, tools that process files from customers or partners. For a service like that, one small file could take a worker down, again and again, every time it's retried.

Could one file take your application down?
Only if all three are true
  • jhdf 0.13.0 or earlier
    Fixed in 0.14.0, released November 10, 2026, on Maven Central.
  • It opens HDF5 files you didn’t create
    Uploads, files from partners or customers, downloads, shared drives.
  • It opens them from a path or a stream
    new HdfFile(path) or HdfFile.fromInputStream(...), the usual ways.
All three: one small file can crash the thread or the process reading it. Update to 0.14.0 or later.

What to do

  • Update to jhdf 0.14.0 or later. It's io.jhdf:jhdf on Maven Central. The current release, 0.15.0 from November 14, includes both fixes.
  • Check whether you use it without knowing. jhdf can arrive as a dependency of another library. Run your build tool's dependency report (mvn dependency:tree for Maven, gradle dependencies for Gradle) and look for io.jhdf.
  • Keep untrusted files away from your main service. Opening uploaded files in a separate worker, with its own memory limit and automatic restarts, means a bad file costs one worker, not the whole service. That helps with every file format, not just this one.

The common thread

Both issues come down to the same thing: the reader trusted numbers the file gave it. A size was used before it was checked, and a pointer was followed without asking whether it had been followed before. It's a common mistake in software that reads files, and file formats keep producing bugs like these. The fix in both cases was small. Finding it means reading the code the way an attacker would, asking what happens when each number is a lie.

Why we look at code like this

We look for security problems in the software businesses rely on, including the open-source libraries underneath it, report them privately and publish details only once they're fixed. You can see our other credits and disclosures on our security research page.

If your business builds or runs software that handles files from outside, that's exactly what a penetration test puts under pressure.

jhdf vulnerabilityjhdf 0.14.0HDF5 JavaOutOfMemoryErrorStackOverflowErrorJava denial of service
Get in touch

Let's build something great.

On-site assessments are free for new business projects. We'll come to you, evaluate your needs, and provide a clear, no-obligation quote.

Explore services
Call