CVE-2025-9288: sha.js Critical Vulnerability Due to Missing Type Checks

sha.js Updated 14 Dec 2025

Summary

21/08/2025
Yes i
Critical
9.1

CVE-2025-9288: sha.js is missing type checks leading to hash rewind and passing on crafted data. Affects sha.js versions < 2.4.12. Fixed in 2.4.12. How to fix ↓

Also tracked for

The same CVE-2025-9288 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

sha.js is a widely used JavaScript library that provides cryptographic hash functions, including SHA-256. It is commonly utilized in various applications for secure data handling and integrity verification. However, the library has a critical vulnerability that arises from missing input type checks, which can lead to severe security issues.

Vulnerability Detail

The vulnerability in sha.js stems from its lack of input type validation, allowing attackers to manipulate the hash calculation process. This can result in hash state rewinding, where a tagged hash can be transformed into an untagged hash, leading to potential data integrity issues. Additionally, attackers can exploit this flaw to generate collisions, causing different inputs to produce the same hash output. The implications of this vulnerability are significant, as it can lead to denial of service (DoS) attacks and even private key extraction in cryptographic libraries, compromising the security of the entire system.

How To Fix

Minimum fixed version

2.4.12

This is the first release that contains the fix.

npm install sha.js@2.4.12

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can implement input validation in your application to ensure that only valid data types are passed to the sha.js functions. For example, you can check the type of input before processing it:

const validateInput = (input) => {
  if (typeof input !== 'string' && !Buffer.isBuffer(input)) {
    throw new Error('Invalid input type.');
  }
};

const sha256 = (...messages) => {
  messages.forEach(validateInput);
  const hash = sha('sha256');
  messages.forEach((m) => hash.update(m));
  return hash.digest('hex');
};

Conclusion

The vulnerability identified as CVE-2025-9288 in the sha.js library poses significant security risks due to missing input type checks. It is crucial for developers to update to the patched version and implement necessary input validations to safeguard their applications.

See every vulnerability recorded for sha.js →

Share this vulnerability

FAQ

CVE-2025-9288 is a critical vulnerability in the sha.js library that allows attackers to exploit missing input type checks, leading to hash state rewinding and potential data integrity issues.

You can check if your application is affected by using Vulert, which monitors open-source vulnerabilities in your software. Visit Vulert Scanner to analyze your package-lock.json without needing to sign up.

The risks include hash state rewinding, value miscalculations, denial of service attacks, and potential private key extraction, which can compromise the security of cryptographic operations.

To fix this vulnerability, update the sha.js package to version 2.4.12 or later by running the command: npm install sha.js@2.4.12.

If immediate updates are not possible, implement input validation in your application to ensure only valid data types are processed by sha.js functions.

How To Fix

Minimum fixed version

2.4.12

This is the first release that contains the fix.

npm install sha.js@2.4.12

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback