exceljs@0.2.27

Excel Workbook Manager - Read and Write xlsx and csv Files.

  • latest version

    4.4.0

  • first published

    11 years ago

  • latest version published

    2 years ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the exceljs package. This does not include vulnerabilities belonging to this package’s dependencies.

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable Version
    • H
    Improper Handling of Highly Compressed Data (Data Amplification)

    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.

    How to fix Improper Handling of Highly Compressed Data (Data Amplification)?

    Upgrade exceljs to version 5.0.0 or higher.

    <5.0.0
    • C
    Prototype Pollution

    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.

    How to fix Prototype Pollution?

    Upgrade exceljs to version 5.0.0 or higher.

    <5.0.0
    • M
    CSV Injection

    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.

    How to fix CSV Injection?

    Upgrade exceljs to version 5.0.0 or higher.

    <5.0.0
    • H
    External Control of File Name or Path

    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.

    How to fix External Control of File Name or Path?

    Upgrade exceljs to version 5.0.0 or higher.

    <5.0.0
    • M
    Cross-site Scripting (XSS)

    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 Cross-site Scripting (XSS).

    How to fix Cross-site Scripting (XSS)?

    Upgrade exceljs to version 1.6.0 or higher.

    <1.6.0