A random number can look perfectly unpredictable and still be a terrible secret. That distinction — between numbers that merely look scattered and numbers an attacker genuinely cannot reconstruct — is the whole story behind CVE-2026-61500, a critical flaw in Rejetto HFS that CISA added to its KEV catalog on 30 November 2026 with a federal patch deadline of 3 December.

HFS is a free, open-source web file server people self-host to share files. In versions 3.0.0 through 3.2.0, it derived the signing key for its session cookies from Math.random(), JavaScript's built-in convenience generator. Worse, its login flow disclosed outputs from that same generator to unauthenticated clients. Collect a small number of login responses, reconstruct the generator's internal state, recover the signing key, forge a valid administrator session, and use the server_code configuration feature for remote code execution. No password needed. The flaw scores 9.3 under CVSS v4.0 (9.8 under v3.1), and it is not theoretical: GreyNoise observed a group it tracks as GT13 compromise an HFS server on 2 October 2026 and use it as an operational relay in attacks that compromised two dozen Check Point Security management servers across 22 organizations between 17 October and 2 November.

The fix has existed since 13 July 2026, when Rejetto shipped HFS 3.2.1. So this is not really a story about a missing patch. It is a story about a category error that keeps recurring in real codebases — and one you can audit for in an afternoon.

01Random-looking is not unpredictable

Every PRNG — pseudo-random number generator — is a deterministic machine. It holds an internal state, and each output is computed from that state by a fixed algorithm. Feed two copies the same state and they produce the identical stream forever. That determinism is a feature for simulations, games, and shuffling a playlist: fast, reproducible, good enough.

Security needs something stronger: a CSPRNG, a cryptographically secure generator, designed so that seeing any number of outputs tells you nothing useful about the state or about past and future outputs. The difference is not statistical quality. A weak generator can pass every "does this look random?" test while still being fully reversible by someone who knows the algorithm — and the algorithm is never secret.

Math.random() sits firmly on the convenience side. In V8, the JavaScript engine behind Node.js and Chrome, it is backed by xorshift128+, a fast non-cryptographic algorithm whose outputs can be run backwards. Observe enough values and the internal state falls out; once you have the state, every other value the generator produced — including ones produced earlier — becomes computable. The documentation has warned for years that Math.random() must not be used for anything security-related. HFS used it for the one value that most needed to stay secret.

02Two mistakes that multiply

A weak generator alone is bad. HFS paired it with a leak, and the combination is what made the attack practical.

Mistake one: the secret came from the weak generator. When no signing key was configured, HFS generated one with a helper built on Math.random(). A signing key is what lets a server trust its own cookies: the cookie's contents are readable by the client, but the signature proves the server issued them. Whoever learns the key can mint cookies the server will accept as genuine — including one that says "this visitor is an administrator." Signing is not encryption, and it was never meant to hide the contents; it only works while the key stays secret.

Mistake two: the same generator talked to strangers. During the unauthenticated login handshake, HFS handed clients numeric identifiers produced by that very same generator stream. Each login attempt therefore leaked a fresh sample of the machine that had produced the signing key. An attacker did not need to guess anything or brute-force a keyspace; they just asked the server for outputs, solved for the state, and wound the stream back to the key.

Either mistake alone would have been survivable. A strong key with a leaky login page leaks harmless numbers. A weak generator whose outputs never leave the server is still wrong, but far harder to exploit. Together, they turned "random" into "reconstructable," and reconstructable into admin access. That pattern — a weak primitive plus an oracle that exposes its outputs — is worth memorizing, because it shows up far beyond this one file server.

03Why the patch gap mattered more than the bug

Rejetto fixed the flaw in 3.2.1 on 13 July 2026, replacing the predictable key generation with cryptographically secure randomness. The current release line has moved on since — 3.4.2 shipped on 24 November. Yet VulnCheck's honeypots saw probing for vulnerable servers in early October, GreyNoise watched GT13 take one over on 2 October, and Shadowserver still tracks over 900 HFS instances exposed online. CISA's KEV entry, with its three-day federal deadline and a forensic triage requirement, is essentially an official statement that unpatched servers should be assumed compromised until checked, not merely outdated.

That is the uncomfortable arithmetic of self-hosted software: the patch existing and the patch being installed are different events, sometimes separated by months. A file server spun up for a weekend project quietly becomes permanent infrastructure, and nobody owns its update schedule. Attackers know this, which is why a compromised HFS box was valuable to GT13 not for the files on it, but as a relay — a clean-looking foothold for attacking other organizations.

04Audit your own code for this pattern

You do not need to run HFS to have this bug. Search your codebase for convenience randomness anywhere near a security decision:

grep -rn "Math.random" src/ --include="*.js" --include="*.ts"
grep -rn "random.random\|randint\|mt_rand\|rand()" src/

Then ask one question of every hit: does this value need to stay secret or unguessable? Session identifiers, password-reset tokens, API keys, signing keys, one-time codes, and password salts all fail that test if they come from a non-cryptographic generator. So do "unguessable" URLs and invite links — unguessable is a security property, and it requires real entropy.

The replacements are boring, which is the point. In Node.js:

import { randomBytes, randomUUID } from "node:crypto";

const signingKey = randomBytes(32);   // for secrets and keys
const sessionId = randomUUID();       // for identifiers

In the browser, crypto.getRandomValues() and crypto.randomUUID() do the same job. In Python, the secrets module exists precisely so you never reach for random when minting a token. Every mainstream platform ships a CSPRNG; using it costs one different function name.

Two more habits close the second half of the HFS pattern. First, never expose raw generator outputs — or anything derived reversibly from them — to unauthenticated clients; identifiers you hand out should come from the CSPRNG too, so a leak reveals nothing. Second, treat signing keys as rotatable secrets: generate them with full entropy, store them outside the codebase, and have a way to replace them that invalidates every outstanding session. If HFS operators had rotated keys on upgrade, forged cookies would have died with the patch.

05If you run HFS

Upgrade to 3.2.1 or later — ideally the current release — and restart the service, then confirm the running version rather than trusting the download. Because exploitation predates the KEV listing by nearly two months, patching alone is not the end: rotate the administrator password and any secret the server could read, and look for the traces GreyNoise described, such as bursts of unauthenticated login requests followed by administrative actions, unfamiliar SSH keys, and unexpected server_code or middleware changes. An update closes the hole; it does not evict anyone already inside.

06The rule to keep

Randomness has two jobs that look identical from the outside. One is variety: shuffle the playlist, jitter the retry timer, scatter the particles. The other is secrecy: keys, tokens, and sessions that an attacker must not be able to predict or rebuild. Math.random() was built for the first job and is quietly catastrophic at the second — not because its numbers look patterned, but because its state can be recovered from its outputs.

So keep the rule simple enough to tape to a monitor: if guessing the number would hurt, generate it with a CSPRNG, and never let the generator that made your secrets talk to strangers. HFS learned that lesson in public, at a 9.3. Your codebase can learn it from a grep.

07Sources

  • BleepingComputer — "CISA orders federal agencies to patch HFS servers by Thursday" — https://www.bleepingcomputer.com/news/security/cisa-orders-feds-to-patch-critical-hfs-flaw-exploited-in-attacks-by-thursday/
  • Ostorlab — "Rejetto HFS Session Forgery to RCE, Exploited (CVE-2026-61500)" — https://blog.ostorlab.co/rejetto-hfs-session-forgery-rce-cve-2026-61500.html
  • SecurityAffairs — "U.S. CISA adds Rejetto HTTP File Server and TYPO3 CMS flaws to its Known Exploited Vulnerabilities catalog" — https://securityaffairs.com/204439/security/u-s-cisa-adds-rejetto-http-file-server-and-typo3-cms-flaws-to-its-known-exploited-vulnerabilities-catalog.html
  • Beazley Security Labs — "Critical Remote Code Execution Vulnerability in Rejetto HTTP File Server Under Active Exploitation (CVE-2026-61500)" — https://labs.beazley.security/advisories/BSL-A1255
written by

kou documents what’s learned about threat intel, attack surface, and practical defense — from the dark side of the internet.