Developing a minimally HashDoS resistant, yet quickly reversible integer hash for V8
Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.
Published By From Node.js News · 1 min read
StoryDeveloping a minimally HashDoS resistant,…
What happens when a hashing scheme needs to be both HashDoS resistant and quickly reversible? That's the puzzle we tried to solve for addressing CVE-2026-21717 in the March 2026 Node.js security release . This led to the development of an integer hash that we believe is unpredictable enough to prevent a blind attacker from reliably triggering severe performance degradation in our threat model. At the same time, it is also a permutation that can be efficiently inverted to recover the original integer value by the runtime holding the secret random keys, which is important for maintaining V8's performance optimizations.
In this post, we will go into the details of this vulnerability, explain why and how the design tried to meet…
This is an excerpt. The full article is published by Node.js News.
Answers to common questions regarding this article's topic, architecture, and practical applications.
Now is the time to take a step back and think about what exactly makes a hash resistant to HashDoS attacks. It turned out that those who looked into rapidhash wondered the same and proposed the idea of "minimal HashDoS resistance", with constraints that apply to our case: In the specific context of Node.js/V8 servers, there are also a few other important factors in play: These contributed to the evaluation of high attack complexity in CVE-2026-21
General
One of the most commonly used hash tables in V8 is the string table, which is used for string internalization - deduplicating and caching strings in a global table for time and memory efficiency. The string table uses open addressing with quadratic probing to deal with collisions. The probing sequence is: The string table grows by adding 50% slack and rounding the capacity to a power of two, so hash & (capacity - 1) equals hash mod capacity, and
General
Hash tables are one of the most important data structures in software, and Node.js/V8 are no exceptions. With hash tables, there comes the problem of collisions - while hash tables are designed to have O(1) average time complexity for, e.g., single lookup and insertion, when there are so many keys whose hashed values can be mapped to the same slot that the table has to walk through many locations to insert a new key, it's theoretically possible t
General
To understand the vulnerability, let's look at how V8 stores string hashes internally. Every v8::internal::Name object (the superclass of v8::internal::String in V8) carries a 32-bit raw_hash_field. The composition of this field varies depending on the type of string. The bottom 2 bits (HashFieldTypeBits) determine the interpretation, and two of the most common types are: The layout of the hash fields looks like this (the least significant bits a
General
What happens when a hashing scheme needs to be both HashDoS resistant and quickly reversible? That's the puzzle we tried to solve for addressing CVE-2026-21717 in the March 2026 Node.js security release. This led to the development of an integer hash that we believe is unpredictable enough to prevent a blind attacker from reliably triggering severe performance degradation in our threat model. At the same time, it is also a permutation that can be efficiently inverted to recover the original inte