Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) Affecting hfs package, versions >=3.0.0 <3.2.1


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.75% (51st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-HFS-17970393
  • published14 Jul 2026
  • disclosed13 Jul 2026
  • creditZach Hanley

Introduced: 13 Jul 2026

NewCVE-2026-61500  (opens in a new tab)
CWE-338  (opens in a new tab)

How to fix?

Upgrade hfs to version 3.2.1 or higher.

Overview

hfs is a HTTP File Server

Affected versions of this package are vulnerable to Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) via predictable randomness in the authentication/session handling code in src/index.ts and src/api.auth.ts. An attacker can forge an administrator session cookie by collecting a few login responses, reconstructing the Math.random() state used to derive the session-signing key and login handshake identifier, and then generating a valid cookie. This breaks authentication and gives the attacker full administrative access to the server. In deployments that expose the server_code configuration feature, that access leads to remote code execution.

References

CVSS Base Scores

version 4.0
version 3.1