The xlsx npm vulnerability: why npm audit fix can't fix it
If your project depends on xlsx (SheetJS), npm audit reports two high-severity advisories, CVE-2023-30533 and CVE-2024-22363, and says “No fix available”. Both are fixed, just not on npm. This page explains what the advisories cover, who is exposed, and how to clear them.
Last checked against the npm registry and the GitHub Advisory Database on 2026-10-29.
Short answer
- For most projects the right fix is to install the current SheetJS (0.20.3) from the SheetJS CDN. It keeps the same API and clears both advisories. Option A.
- If you need the package to come from the npm registry, a community republish (
@e965/xlsx) exists. Option B. - If you only read spreadsheets, you can replace SheetJS with a read-only parser such as TabularJS. Option C.
What npm audit reports
A fresh install of xlsx from npm, audited with npm 11 on Node.js 24:
$ npm install xlsx
$ npm audit
# npm audit report
xlsx *
Severity: high
Prototype Pollution in sheetJS - https://github.com/advisories/GHSA-4r6h-8v6p-xvw6
SheetJS Regular Expression Denial of Service (ReDoS) - https://github.com/advisories/GHSA-5pgg-2g8v-p4x9
No fix available
node_modules/xlsx
1 high severity vulnerability
Some issues need review, and may require choosing
a different dependency.npm audit fix prints the same report and changes nothing. So doesnpm audit fix --force. The reason:
- The newest
xlsxon the npm registry is 0.18.5, published on 24 March 2022. It is still downloaded more than 12 million times a week. - SheetJS publishes newer releases only on its own CDN,
cdn.sheetjs.com. Its documentation calls the CDN “the authoritative source” and says the npm registry is out of date. - Both GitHub advisories list no patched version on npm.
npm audit fixcan only move you to another registry version, and none exists.
If xlsx comes in through another package, find out which one and which version you actually have:
$ npm ls xlsx
[email protected]
`-- [email protected]What each advisory means in practice
| Advisory | Type | Affected | Fixed in | GitHub rating |
|---|---|---|---|---|
| CVE-2023-30533 GHSA-4r6h-8v6p-xvw6 | Prototype pollution (CWE-1321) | < 0.19.3 | 0.19.3 (CDN only) | High, CVSS 7.8 |
| CVE-2024-22363 GHSA-5pgg-2g8v-p4x9 | Regular expression denial of service (CWE-1333) | < 0.20.2 | 0.20.2 (CDN only) | High, CVSS 7.5 |
CVE-2023-30533: prototype pollution
SheetJS CE up to 0.19.2 is vulnerable to prototype pollution “when reading specially crafted files”. A crafted spreadsheet can add properties toObject.prototype in the process that parses it, so every object in that process appears to have them. What an attacker can do with that depends on your code: it matters most where code checks for a property that is normally absent (anisAdmin flag, an options object, a template setting).
The 0.19.3 changelog lists the fix next to “XLSX Ensure comment address is valid”, and the code change adds that check where cell comments are read. We confirmed the path locally: an XLSX file with a crafted comment cell reference added a property to Object.prototype when read with 0.18.5, and did not with 0.20.2.
SheetJS's own advisory states that workflows that do not read arbitrary files, such as exporting data to spreadsheet files, are unaffected. It also scores the issue lower than GitHub does (CVSS 5.3, Medium, versus 7.8).
CVE-2024-22363: ReDoS
SheetJS CE before 0.20.2 uses regular expressions that can take a very long time on crafted input. Neither the GitHub advisory nor the SheetJS advisory names the exact function. The 0.20.2 changelog says “Reworked parsing methods to avoid slow regexes (CVE-2024-22363)”, and the changed code is in the file readers (XML tag, shared string, style and document property parsing). The effect is availability only: parsing one malicious file can keep the CPU busy, which blocks the Node.js event loop for every other request on that process, or freezes the browser tab.
Who is exposed
- Most exposed: servers that parse spreadsheets uploaded by users, received by email, or fetched from third-party systems.
- Less exposed: browser code that parses a file the user picked themselves. The parsing happens in that user's tab, but the file may still come from someone else.
- Not affected by CVE-2023-30533 (per SheetJS): code that only writes or exports spreadsheets. The ReDoS fix also targets the reading code.
Even if you are in the low-risk group, an audit that never goes clean hides new findings. Upgrading is cheap, so most teams should do it anyway.
Option A: install the patched SheetJS from its CDN
This is what SheetJS recommends, and it is the best fit if you write spreadsheets, use formula results, or rely on SheetJS-specific APIs. The current release is0.20.3. Check theSheetJS installation docsfor newer versions.
# npm
npm rm --save xlsx
npm i --save https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz
# pnpm
pnpm rm xlsx
pnpm install --save https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz
# Yarn (newer Yarn releases need the xlsx@ prefix)
yarn remove xlsx
yarn add xlsx@https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgzAfter the install, the audit is clean:
$ npm audit
found 0 vulnerabilities
$ npm ls xlsx
[email protected]
`-- [email protected]npm audit does check CDN installs: in our test an install of 0.19.3 from the CDN still reported the ReDoS advisory. The clean result above comes from the version, not from the URL.
What changes in package.json and the lockfile
{
"dependencies": {
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
}
}package-lock.jsonrecords the CDN URL asresolved, with anintegrityhash, sonpm cistays reproducible.- CI runners and Docker builds now download from
cdn.sheetjs.com. If your builds can only reach an internal registry mirror, allow that host or vendor the tarball (below). - Running
npm i xlsxornpm i xlsx@latestagain installs 0.18.5 from the registry. Tell your team, or add a check in CI. - Dependabot and Renovate track versions on the npm registry. Do not expect them to propose new SheetJS releases for a URL dependency. Watch the SheetJS releases and bump the URL yourself.
- Coming from 0.18.5, read the SheetJS changelog. For example, 0.20.0 switched date cells to a UTC interpretation of
Dateobjects, which SheetJS marks as potentially breaking.
Vendoring the tarball
SheetJS recommends keeping a local copy so your builds do not depend on its infrastructure:
mkdir -p vendor
curl -L -o vendor/xlsx-0.20.3.tgz https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz
npm i --save file:vendor/xlsx-0.20.3.tgz
git add vendor/xlsx-0.20.3.tgzWhen xlsx is a dependency of a dependency
Upgrade the package that pulls it in first. For example, node-xlsx 0.24.0 already depends on SheetJS 0.20.2 from the CDN and is affected by neither advisory, while 0.22.0 and earlier pull xlsx from npm and 0.23.0 pulls 0.19.3 (still affected by the ReDoS advisory). If the parent package has no fixed release, force the version with npm overrides:
{
"overrides": {
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
}
}pnpm uses pnpm.overrides and Yarn uses resolutions for the same purpose. Make sure the parent package works with the newer SheetJS before you ship.
Option B: a republished fork on npm (@e965/xlsx)
@e965/xlsx(about 1.5 million downloads a week) is not a code fork. It is a republish of SheetJS by an independent maintainer. A GitHub Actions workflow ine965/sheetjs-npm-publishertakes new releases from the SheetJS CDN and publishes them to npm. Its current version is 0.20.3, and we checked that its xlsx.js and xlsx.mjs are byte-identical to the CDN tarball. Only README.md andpackage.json differ.
# Keep "xlsx" as the import name with an npm alias
npm i xlsx@npm:@e965/xlsx
# package.json now contains:
# "xlsx": "npm:@e965/xlsx@^0.20.3"Pros
- A normal registry package: semver ranges, registry mirrors and update bots work.
- Same SheetJS code and API, so no other code changes.
Cons
- Not published or endorsed by SheetJS. You are trusting one more publisher with code that runs in your app.
- The advisories are filed against the package name
xlsx, so a cleannpm auditsays nothing about@e965/xlsx. Check the version yourself. - It only updates when the workflow runs and SheetJS releases.
Option C: if you only read spreadsheets, use TabularJS
Many projects use SheetJS for one thing: turning an uploaded file into rows. If that is you, a read-only parser can replace it. TabularJSis MIT-licensed and published on npm (tabularjs, currently 2.2.0). It has no writer. It reads XLSX, XLS, ODS, CSV, HTML tables and more than ten other formats in Node.js and the browser. It is built to parse untrusted uploads: decompressed XLSX, ODS and Numbers entries are capped against zip bombs, memory allocation for .xlsfiles is limited to the size of the container, and formulas are never evaluated. SeeSecurity and limits.
Switching libraries does not make any parser free of bugs. Choose this option because a smaller, read-only dependency fits your use case, not as a security guarantee.
Node.js
import * as XLSX from 'xlsx';
import fs from 'fs';
const workbook = XLSX.read(fs.readFileSync('./upload.xlsx'));
const sheet = workbook.Sheets[workbook.SheetNames[0]];
const rows = XLSX.utils.sheet_to_json(sheet, { header: 1 });import tabularjs from 'tabularjs';
// A path, a Buffer, a Uint8Array or an ArrayBuffer
const result = await tabularjs('./upload.xlsx');
const rows = result.worksheets[0].data; // rows[row][col]
for (const sheet of result.worksheets) {
console.log(sheet.worksheetName, sheet.data.length);
}Browser upload
input.addEventListener('change', async (e) => {
const workbook = XLSX.read(await e.target.files[0].arrayBuffer());
const sheet = workbook.Sheets[workbook.SheetNames[0]];
render(XLSX.utils.sheet_to_json(sheet, { header: 1 }));
});import tabularjs from 'tabularjs';
input.addEventListener('change', async (e) => {
const result = await tabularjs(e.target.files[0]);
render(result.worksheets[0].data);
});Rows as objects
// SheetJS: XLSX.utils.sheet_to_json(sheet) returns one object per row,
// keyed by the first row. With TabularJS, build the objects yourself:
const [header, ...rows] = result.worksheets[0].data;
const records = rows.map((row) =>
Object.fromEntries(header.map((name, i) => [name, row[i]]))
);Differences to check before you switch
- Formulas come back as text.
sheet_to_jsonreturns the value Excel saved for a formula cell. TabularJS returns the formula, for example"=SUM(A1:A3)", and never computes it. If you need calculated results, stay with SheetJS. - Empty cells are empty strings. Rows are padded to the sheet width with
""wheresheet_to_json({ header: 1 })leaves gaps or short rows. - CSV values are strings and the first row stays in
data. Convert numbers yourself, and passencoding(for example'windows-1252') for files that are not UTF-8. - No writer. If you also export files, keep SheetJS (Option A) for that path.
FAQ
Why does npm audit fix not fix the xlsx vulnerability?
The fixed SheetJS releases (0.19.3 and later, 0.20.2 and later) were never published to the npm registry. The newest xlsx on npm is 0.18.5, from March 2022, and both advisories list no patched version on npm. npm audit fix, with or without --force, only installs versions from the registry, so it has nothing to upgrade to and reports "No fix available".
Which xlsx version fixes CVE-2023-30533 and CVE-2024-22363?
CVE-2023-30533 (prototype pollution) is fixed in SheetJS 0.19.3 and CVE-2024-22363 (ReDoS) in 0.20.2. Both are distributed from the SheetJS CDN at cdn.sheetjs.com. At the time of writing the current version is 0.20.3, installed with npm i https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz.
Is xlsx 0.18.5 safe to use?
Both advisories are about reading crafted files. SheetJS states that workflows that do not read arbitrary files, such as exporting data to spreadsheets, are not affected by CVE-2023-30533. If your application parses spreadsheets that come from users or other outside sources, you are in the affected group and should upgrade. Upgrading from the SheetJS CDN also clears the npm audit report.
Is node-xlsx affected?
It depends on the node-xlsx version. node-xlsx 0.22.0 and earlier depend on xlsx from the npm registry (0.18.5 or older), so they are affected by both advisories. node-xlsx 0.23.0 depends on SheetJS 0.19.3 from the CDN, which is still affected by CVE-2024-22363. node-xlsx 0.24.0 depends on SheetJS 0.20.2 from the CDN, which is affected by neither. Upgrading node-xlsx to 0.24.0 is enough.
Is @e965/xlsx an official SheetJS package?
No. @e965/xlsx is published by an independent maintainer. A GitHub Actions workflow in the e965/sheetjs-npm-publisher repository takes new SheetJS releases from the SheetJS CDN and republishes them to npm. Its 0.20.3 release ships the same xlsx.js and xlsx.mjs files as the CDN tarball. It is convenient, but it adds a third-party publisher to your supply chain.
Can TabularJS replace SheetJS?
Only if you read spreadsheets and never write them. TabularJS is a read-only, MIT-licensed parser on npm that returns each worksheet as a 2D array. It has no writer, and it returns formulas as text such as "=SUM(A1:A3)" instead of computed values. If you export spreadsheets or need calculated results, upgrade SheetJS from its CDN instead.
Sources
- GitHub Advisory GHSA-4r6h-8v6p-xvw6 (CVE-2023-30533)
- GitHub Advisory GHSA-5pgg-2g8v-p4x9 (CVE-2024-22363)
- SheetJS security advisories
- SheetJS NodeJS installation guide
- xlsx on npm
Only reading files?
Compare TabularJS and SheetJS feature by feature, or go straight to the docs.