SSerguey Asael Shinder
Java coding notes: the JVM, and writing software that lasts

Serguey Asael Shinder: Apache's critical HTTP/2 bug is the warning printed in the HashMap javadoc

· by Serguey Asael Shinder / Serguey Shinder

On 11 November the Apache HTTP Server project released 2.4.71 to fix CVE-2026-119618, a critical bug in mod_http2. The project's vulnerability list describes it in one line of classification: concurrent execution using a shared resource with improper synchronisation, in the function assign_headers(), which can lead to remote code execution. It affects httpd from 2.4.55 through 2.4.70.

The server is written in C, but the class of bug is one every Java developer has been warned about in writing. The HashMap javadoc for Java SE 25 says plainly that the implementation is not synchronized: if multiple threads access a map concurrently and at least one of them modifies it structurally, the map must be synchronized externally. It defines a structural modification as adding or deleting a mapping, and suggests wrapping the map with Collections.synchronizedMap at creation time to prevent accidental unsynchronised access.

Serguey Asael Shinder: Apache's critical HTTP/2 bug is the warning printed in the HashMap javadoc
Apache's critical HTTP/2 bug is the warning printed in the HashMap javadoc — Serguey Asael Shinder

What I find most useful in that javadoc is the paragraph after it, about what you will see when you get it wrong. The iterators are fail-fast and throw ConcurrentModificationException if the map changes under them. But the javadoc immediately limits that promise: fail-fast behaviour cannot be guaranteed in the presence of unsynchronised concurrent modification, the exception is thrown on a best-effort basis, and it would be wrong to write a program that depends on it for correctness. It is meant only to detect bugs.

That is the uncomfortable part, in Java as in C. An unsynchronised shared structure does not fail reliably. In a test with one request at a time, it works. Under a protocol that multiplexes many streams over one connection, as HTTP/2 does, the interleavings that break it become possible, and the result depends on timing. In httpd's case, the project's own title for the bug is heap corruption and RCE. In Java, the javadoc's own description of the alternative to failing fast is arbitrary, non-deterministic behaviour at an undetermined time in the future, and nothing obliges the runtime to tell you when it happens.

The httpd fix arrived through two independent reports, one from Anthropic's OSS Scanner and one from Google Cloud researchers, according to the project's acknowledgements. That is the lesson I would take into a Java code review: for any object reachable from more than one thread, the question is not whether the tests pass, but which lock, concurrent collection or confinement rule guards every structural change to it. If nobody can name it, the javadoc has already told you what happens next.