CVE-2025-9287: cipher-base Hash Rewind Vulnerability Due to Missing Type Checks

cipher-base Updated 14 Dec 2025

Summary

21/08/2025
Yes i
Critical
9.1

CVE-2025-9287: cipher-base is missing type checks, leading to hash rewind and passing on crafted data. Affects cipher-base versions < 1.0.5. Fixed in 1.0.5. How to fix ↓

Also tracked for

The same CVE-2025-9287 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

cipher-base is a widely used package in the Node.js ecosystem that provides a base class for cryptographic hash functions. It is utilized in various libraries, including create-hash and crypto-browserify, to facilitate secure data handling. However, it has been identified that cipher-base lacks proper input type checks, making it susceptible to vulnerabilities that can compromise data integrity and security.

Vulnerability Detail

The vulnerability arises from missing input type checks in the npm create-hash polyfill of Node.js createHash. This oversight allows for the calculation of invalid hash values, potentially leading to hash state rewinding and the acceptance of maliciously crafted data. Attackers can exploit this by sending specially formatted JSON data that can manipulate the hash state, resulting in collisions, denial of service, and even private key extraction in cryptographic libraries. The vulnerability can be triggered by inputs like {length: -x} or {length: '1e99', causing unexpected behavior in the hashing process.

How To Fix

Minimum fixed version

1.0.5

This is the first release that contains the fix.

npm install cipher-base@1.0.5

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

Workaround

As a temporary workaround, ensure that all inputs to the hashing functions are validated and sanitized before processing. For example, you can implement a check to confirm that inputs are instances of Buffer, TypedArray, or DataView before passing them to the hashing function. Here is a sample code snippet:

const createHash = require('create-hash/browser.js');
const { randomBytes } = require('crypto');

const sha256 = (...messages) => {
  const hash = createHash('sha256');
  messages.forEach((m) => {
    if (Buffer.isBuffer(m) || ArrayBuffer.isView(m)) {
      hash.update(m);
    } else {
      throw new Error('Invalid input type');
    }
  });
  return hash.digest('hex');
};

Conclusion

The cipher-base vulnerability CVE-2025-9287 poses significant risks due to its potential for hash state manipulation and data integrity issues. It is crucial for developers to update their packages and implement proper input validation to safeguard their applications.

See every vulnerability recorded for cipher-base →

Share this vulnerability

FAQ

CVE-2025-9287 is a vulnerability in the cipher-base package that allows for hash state rewinding due to missing input type checks.

Exploitation of this vulnerability can lead to incorrect hash calculations, denial of service, and potential exposure of sensitive data.

You should update to version 1.0.5 or later to mitigate the risk associated with this vulnerability.

Yes, you can implement input validation to ensure that only valid types are processed by the hashing functions.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. You can check your application using the Vulert playground without any signup.

How To Fix

Minimum fixed version

1.0.5

This is the first release that contains the fix.

npm install cipher-base@1.0.5

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