Vulnerabilities

8 via 8 paths

Dependencies

441

Source

GitHub

Find, fix and prevent vulnerabilities in your code.

Issue type
  • 8
  • 1
Severity
  • 1
  • 2
  • 6
Status
  • 8
  • 0
  • 1

critical severity
new

Prototype Pollution

  • Vulnerable module: exceljs
  • Introduced through: exceljs@4.4.0

Detailed paths

  • Introduced through: jammusic@WebJamApps/JaMmusic exceljs@4.4.0

Overview

exceljs is a package to Read, manipulate and write spreadsheet data and styles to XLSX and JSON.

Affected versions of this package are vulnerable to Prototype Pollution through Note.model serialization in lib/utils/under-dash.js. An attacker can modify Object.prototype and influence later plain-object behavior by supplying user-controlled JSON as cell.note with a __proto__ property and triggering workbook serialization.

Notes

  • The vulnerability is still present in upstream exceljs; an unofficial fork - exceljs-hardened, carries the out-of-tree hardening mentioned in the referenced advisory.

Workarounds

  • Do not pass unvalidated or parsed JSON directly into cell.note; this prevents attacker-controlled __proto__-bearing note objects from reaching deepMerge() and polluting Object.prototype.
  • If cell.note must come from user input, allow-list only the expected keys: texts, margins, protection, and editAs; this blocks unexpected prototype-polluting properties from being merged during workbook serialization.

Details

Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.

There are two main ways in which the pollution of prototypes occurs:

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

The logic of a vulnerable recursive merge function follows the following high-level model:

merge (target, source)

  foreach property of source

    if property exists and is an object on both the target and the source

      merge(target[property], source[property])

    else

      target[property] = source[property]

When the source object contains a property named __proto__ defined with Object.defineProperty() , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of Object and the source of Object as defined by the attacker. Properties are then copied on the Object prototype.

Clone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: merge({},source).

lodash and Hoek are examples of libraries susceptible to recursive merge attacks.

Property definition by path

There are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: theFunction(object, path, value)

If the attacker can control the value of “path”, they can set this value to __proto__.myValue. myValue is then assigned to the prototype of the class of the object.

Types of attacks

There are a few methods by which Prototype Pollution can be manipulated:

Type Origin Short description
Denial of service (DoS) Client This is the most likely attack.
DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf).
The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service.
For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail.
Remote Code Execution Client Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.
For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code.
Property Injection Client The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.
For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges.

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

  1. Freeze the prototype— use Object.freeze (Object.prototype).

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

  4. Consider using objects without prototypes (for example, Object.create(null)), breaking the prototype chain and preventing pollution.

  5. As a best practice use Map instead of Object.

For more information on this vulnerability type:

Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018

Remediation

Upgrade exceljs to version 5.0.0 or higher.

References

high severity
new

External Control of File Name or Path

  • Vulnerable module: exceljs
  • Introduced through: exceljs@4.4.0

Detailed paths

  • Introduced through: jammusic@WebJamApps/JaMmusic exceljs@4.4.0

Overview

exceljs is a package to Read, manipulate and write spreadsheet data and styles to XLSX and JSON.

Affected versions of this package are vulnerable to External Control of File Name or Path via Workbook.addImage({filename}) in lib/xlsx/xlsx.js (addMedia()). An attacker can read arbitrary files accessible to the Node.js process by supplying a filename fragment that escapes the intended base directory, causing the chosen file to be embedded into the generated .xlsx download as an image.

Notes

  • The vulnerability is still present in upstream exceljs; an unofficial fork - exceljs-hardened, carries the out-of-tree hardening mentioned in the referenced advisory.

Workarounds

  • Do not build the addImage({filename}) path with path.join() from a base directory plus user input alone; resolve the final path and verify it still starts with the intended base directory before passing it to addImage(), which blocks ../ traversal into arbitrary readable files.
  • Map user-supplied image names to a fixed allowlist of known-safe file paths instead of accepting an arbitrary path fragment, which prevents attackers from selecting paths outside the intended asset set.

Remediation

Upgrade exceljs to version 5.0.0 or higher.

References

high severity
new

Improper Handling of Highly Compressed Data (Data Amplification)

  • Vulnerable module: exceljs
  • Introduced through: exceljs@4.4.0

Detailed paths

  • Introduced through: jammusic@WebJamApps/JaMmusic exceljs@4.4.0

Overview

exceljs is a package to Read, manipulate and write spreadsheet data and styles to XLSX and JSON.

Affected versions of this package are vulnerable to Improper Handling of Highly Compressed Data (Data Amplification) via Workbook.xlsx.load() in lib/xlsx/xlsx.js. An attacker can exhaust memory and crash the process by supplying a highly compressible .xlsx file that expands into a very large amount of data during ZIP decompression. Services that call load() or readFile() on untrusted uploads are affected: the workbook loader decompresses archive entries into memory before XML parsing, so a small crafted file can trigger an out-of-memory termination and deny service to users.

Notes

  • The vulnerability is still present in upstream exceljs; an unofficial fork - exceljs-hardened, carries the out-of-tree hardening mentioned in the referenced advisory.

Workarounds

  • Run load() inside a process or container with a hard memory limit, so a decompression bomb can only crash that isolated process instead of exhausting the host.
  • Pre-check the uploaded .xlsx file’s declared uncompressed sizes from the ZIP central directory before calling load(), so oversized archives are rejected before decompression begins.

Remediation

Upgrade exceljs to version 5.0.0 or higher.

References

medium severity

Use of a Cryptographic Primitive with a Risky Implementation

  • Vulnerable module: elliptic
  • Introduced through: crypto-browserify@3.12.1

Detailed paths

  • Introduced through: jammusic@WebJamApps/JaMmusic crypto-browserify@3.12.1 browserify-sign@4.2.6 elliptic@6.6.1
  • Introduced through: jammusic@WebJamApps/JaMmusic crypto-browserify@3.12.1 create-ecdh@4.0.4 elliptic@6.6.1

Overview

elliptic is a fast elliptic-curve cryptography implementation in plain javascript.

Affected versions of this package are vulnerable to Use of a Cryptographic Primitive with a Risky Implementation due to the incorrect computation of the byte-length of k value with leading zeros resulting in its truncation. An attacker can obtain the secret key by analyzing both a faulty signature generated by a vulnerable implementation and a correct signature for the same inputs.

Note:

There is a distinct but related issue CVE-2024-48948.

Remediation

There is no fixed version for elliptic.

References

medium severity

Improper Validation of Specified Index, Position, or Offset in Input

  • Vulnerable module: uuid
  • Introduced through: exceljs@4.4.0

Detailed paths

  • Introduced through: jammusic@WebJamApps/JaMmusic exceljs@4.4.0 uuid@8.3.2

Overview

uuid is a RFC4122 (v1, v4, and v5) compliant UUID library.

Affected versions of this package are vulnerable to Improper Validation of Specified Index, Position, or Offset in Input due to accepting external output buffers but not rejecting out-of-range writes (small buf or large offset). This inconsistency allows silent partial writes into caller-provided buffers.

PoC

cd /home/StrawHat/uuid
npm ci
npm run build

node --input-type=module -e "
import {v4,v5,v6} from './dist-node/index.js';
const ns='6ba7b810-9dad-11d1-80b4-00c04fd430c8';
for (const [name,fn] of [
  ['v4',()=>v4({},new Uint8Array(8),4)],
  ['v5',()=>v5('x',ns,new Uint8Array(8),4)],
  ['v6',()=>v6({},new Uint8Array(8),4)],
]) {
  try { fn(); console.log(name,'NO_THROW'); }
  catch(e){ console.log(name,'THREW',e.name); }
}"

Remediation

Upgrade uuid to version 11.1.1, 14.0.0 or higher.

References

medium severity
new

CSV Injection

  • Vulnerable module: exceljs
  • Introduced through: exceljs@4.4.0

Detailed paths

  • Introduced through: jammusic@WebJamApps/JaMmusic exceljs@4.4.0

Overview

exceljs is a package to Read, manipulate and write spreadsheet data and styles to XLSX and JSON.

Affected versions of this package are vulnerable to CSV Injection through the CSV.write() process in lib/csv/csv.js. An attacker can trigger spreadsheet formula execution by supplying a cell value that begins with =, +, -, or @ and getting it exported through workbook.csv.write(), writeBuffer(), or writeFile(). When a victim opens the exported CSV in Excel or LibreOffice Calc, the injected value is treated as a live formula, enabling command execution tricks, external data fetches, or exfiltration of other cells in the spreadsheet.

Notes

  • The vulnerability is still present in upstream exceljs; an unofficial fork - exceljs-hardened, carries the out-of-tree hardening mentioned in the referenced advisory.

Workarounds

  • Sanitize values yourself before calling workbook.csv.write(): prefix any string beginning with =, +, -, @, tab, or CR with a single quote ('). This prevents spreadsheet applications from interpreting attacker-controlled cell data as live formulas when you open the CSV.
  • Avoid opening CSV exports of user-influenced data directly in a spreadsheet application. This prevents Excel or LibreOffice Calc from triggering formula execution on untrusted exports.

Remediation

Upgrade exceljs to version 5.0.0 or higher.

References

medium severity
ignored

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: exceljs@4.4.0
  • Ignored path

  • Expires

    in 10 months

Reason

: Dependency overridden globally in package.json, completely removing inflight package from lockfile

This issue was ignored via the project's .snyk policy file. To unignore it, update the policy file.

Detailed paths

  • Introduced through: jammusic@WebJamApps/JaMmusic exceljs@4.4.0 archiver@5.3.2 archiver-utils@2.1.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: jammusic@WebJamApps/JaMmusic exceljs@4.4.0 archiver@5.3.2 zip-stream@4.1.1 archiver-utils@3.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: jammusic@WebJamApps/JaMmusic exceljs@4.4.0 unzipper@0.10.14 fstream@1.0.12 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6

medium severity

Arbitrary File Write via Archive Extraction (Zip Slip)

  • Vulnerable module: unzipper
  • Introduced through: exceljs@4.4.0

Detailed paths

  • Introduced through: jammusic@WebJamApps/JaMmusic exceljs@4.4.0 unzipper@0.10.14

Overview

unzipper is a library for the Uzip cross-platform streaming AP.I

Affected versions of this package are vulnerable to Arbitrary File Write via Archive Extraction (Zip Slip) in the extraction path validation in lib/extract.js and lib/Open/directory.js, which check only that the resolved path begins with the destination string (extractPath.indexOf(opts.path) != 0) without enforcing a directory-separator boundary. An attacker can write files outside the intended extraction directory, enabling file overwrite or code execution, by supplying a ZIP archive whose entry resolves to a sibling path such as /tmp/dest-evil/escaped.txt that shares the destination's string prefix, which a victim then extracts. Exploitation requires the victim to extract an untrusted archive with unzipper, and it works through sibling-prefix paths since standard ../../ traversal remains blocked.

Note: This is a bypass of the fix for the vulnerability described in CVE-2018-1002203.

Details

It is exploited using a specially crafted zip archive, that holds path traversal filenames. When exploited, a filename in a malicious archive is concatenated to the target extraction directory, which results in the final path ending up outside of the target folder. For instance, a zip may hold a file with a "../../file.exe" location and thus break out of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.

The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicous file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:


+2018-04-15 22:04:29 ..... 19 19 good.txt

+2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys

Remediation

There is no fixed version for unzipper.

References

medium severity

MPL-2.0 license

  • Module: lightningcss
  • Introduced through: vite@8.2.2

Detailed paths

  • Introduced through: jammusic@WebJamApps/JaMmusic vite@8.2.2 lightningcss@1.33.0

MPL-2.0 license