xlsx Vulnerability Fix: Upgrade SheetJS and Secure Uploads

xlsx vulnerability fix: npm and Node.js marks on a navy Valletta Software cover

The xlsx package on the npm registry stops at version 0.18.5, which is affected by two advisories that GitHub rates high and that have no fixed version on npm. The fix is to install SheetJS from its own CDN, which is what its docs prescribe: npm i --save https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz. Then harden the upload path that feeds the parser.

Key takeaways

  • The xlsx vulnerability fix is a change of source, not a version bump: npm's latest xlsx is 0.18.5 (published March 2022), while the maintained SheetJS releases are on cdn.sheetjs.com. The current release is 0.20.3.
  • Two advisories affect every npm-registry version: CVE-2023-30533 (prototype pollution when reading crafted files, fixed in 0.19.3) and CVE-2024-22363 (regular expression denial of service, fixed in 0.20.2).
  • That is why npm audit reports xlsx with no fix available. GitHub's advisories say a non-vulnerable version "cannot be found via npm".
  • If xlsx arrives through another package, an overrides entry in package.json points it at the CDN tarball.
  • Upgrading closes these two CVEs. Spreadsheet uploads are still untrusted input, so add size limits, type checks and a time-limited parser, as OWASP's File Upload Cheat Sheet recommends.

Checked November 13, 2026 against the npm registry entry for xlsx, the SheetJS Node.js installation guide, SheetJS's own security advisories, the GitHub Advisory Database and NVD. Version numbers change: confirm the current release on the SheetJS installation page before you copy the commands.

Which xlsx vulnerabilities affect the npm package?

Two current advisories cover every version you can install from the npm registry. Three older ones from 2021 were fixed in 0.17.0, so 0.18.5 is not affected by those.

Advisory Problem Affected Fixed in Severity
CVE-2023-30533
GHSA-4r6h-8v6p-xvw6
Prototype pollution when reading a specially crafted file All versions through 0.19.2, including every npm release 0.19.3 (SheetJS advisory) High 7.8 (GitHub, NVD); SheetJS scores it Medium 5.3
CVE-2024-22363
GHSA-5pgg-2g8v-p4x9
Regular expression denial of service (ReDoS) All versions through 0.20.1, including every npm release 0.20.2 (SheetJS advisory) High 7.5 (GitHub and SheetJS; NVD lists the CNA score)
CVE-2021-32012, 32013, 32014 Denial of service in older parsers Versions before 0.17.0 0.17.0, on npm Medium (GitHub)

Two details matter when you decide how urgent this is. SheetJS's advisory for CVE-2023-30533 says workflows that do not read arbitrary files, for example ones that only export data to spreadsheets, are unaffected by that issue. The ReDoS advisory makes no such exception, so an export-only app still has a reason to upgrade. And the affected list in both SheetJS advisories includes third-party CDNs that copy the npm package, so a <script> tag pointing at one of those copies is affected too.

Why does npm audit say "No fix available" for xlsx?

Because the fix is not on npm. The registry's latest xlsx is 0.18.5, published on March 24, 2022. The SheetJS documentation says older releases are "technically available on the public npm registry", that "the registry is out of date", and that the SheetJS CDN is the authoritative source for SheetJS modules. The GitHub advisories put it more bluntly: "A non-vulnerable version cannot be found via npm, as the repository hosted on GitHub and the npm package xlsx are no longer maintained."

So npm audit fix has nothing to upgrade to, and the warning stays until you change where the package comes from. This is a frequent finding in apps built with AI tools, because coding assistants install the npm name they know. In one of our sample audit reports, the dependency check reported 10 vulnerabilities, 6 of them high, including xlsx, which had no fix on npm.

How do I fix the xlsx vulnerability?

Replace the registry package with the tarball from the SheetJS CDN. These are the commands from the official Node.js installation guide:

# See which packages pull in xlsx, and which version
npm ls xlsx

# Replace the npm registry copy with the current SheetJS release (0.20.3 on November 13, 2026)
npm rm --save xlsx
npm i --save https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz

# Confirm
npm ls xlsx
npm audit

The package keeps the name xlsx, so your require('xlsx') or import lines do not change. Commit the updated package.json and lockfile. The same guide gives the equivalents for other package managers: pnpm install --save with the same URL, and yarn add xlsx@https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz for newer Yarn releases that require the package name.

xlsx comes from another package

If npm ls xlsx shows it under another dependency, SheetJS documents an overrides entry in your own package.json:

{
  "overrides": {
    "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
  }
}

Run npm install again and check npm ls xlsx: every path should now show 0.20.3. Test the parent package afterwards, since it was built against an older version.

Vendor the tarball for stable builds

SheetJS strongly recommends keeping a local copy, which removes a network dependency on their CDN from every build:

curl -O https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz
mkdir -p vendor && mv xlsx-0.20.3.tgz vendor
git add vendor/xlsx-0.20.3.tgz
npm i --save file:vendor/xlsx-0.20.3.tgz

If a scanner still flags 0.19.3 or later

The SheetJS docs mention that Snyk tooling may still report the prototype pollution issue on versions where it is resolved, and call this a bug in the tooling. Check the installed version with npm ls xlsx first. If it is 0.19.3 or newer, the finding for CVE-2023-30533 does not apply, and you can document the suppression with a link to the SheetJS advisory.

How do I secure the file upload that feeds SheetJS?

Upgrading closes two known bugs. The next parser bug is not known yet, and the spreadsheet is still a file chosen by a stranger. OWASP's File Upload Cheat Sheet says there is "no silver bullet in validating user content" and recommends defence in depth. For a spreadsheet import, that means:

  1. Allow only the extensions the feature needs. If you import .xlsx, accept .xlsx, not every format the library can read.
  2. Do not trust the Content-Type header. OWASP notes it is provided by the user and trivial to spoof. Check the file signature as an extra signal; OWASP warns that a signature check should not be used alone.
  3. Limit size before parsing. OWASP adds that if you extract or process files, the limit should consider the size after decompression, and .xlsx files are ZIP archives. Capping the rows the parser reads helps too.
  4. Parse with a time and memory budget. A ReDoS or a hostile file shows up as a parser that never returns. Running it in a worker you can terminate turns that into a failed upload instead of a stuck server.
  5. Keep object keys out of the attacker's hands. Prototype pollution abuses keys like __proto__. Reading rows as arrays and mapping them to your own known column names avoids building objects from header text in the file.
  6. Store the original safely, if you store it at all. Generate the file name yourself, keep files outside the web root or on a separate storage service, allow uploads only for authenticated users, and keep libraries up to date.

Here is a sketch in Node.js that applies those points. The checks run before the parser, and the parser runs in a worker thread with a memory limit and a timeout. The read options (sheetRows, cellFormula, cellHTML) are documented in the SheetJS parsing options.

// parse-upload.js (CommonJS, as the SheetJS docs recommend for Node.js)
const { Worker } = require('node:worker_threads');
const path = require('node:path');

const MAX_BYTES = 5 * 1024 * 1024; // pick the smallest limit your feature needs

function checkUpload(buffer, originalName) {
  if (buffer.length > MAX_BYTES) throw new Error('File too large');
  if (!/\.xlsx$/i.test(originalName)) throw new Error('Only .xlsx files are accepted');
  // .xlsx files are ZIP containers, and ZIP files start with the bytes "PK"
  if (buffer[0] !== 0x50 || buffer[1] !== 0x4b) throw new Error('Not an .xlsx file');
}

function parseInWorker(buffer, timeoutMs = 10000) {
  return new Promise((resolve, reject) => {
    const worker = new Worker(path.join(__dirname, 'parse-sheet-worker.js'), {
      workerData: buffer,
      resourceLimits: { maxOldGenerationSizeMb: 256 },
    });
    const timer = setTimeout(() => {
      worker.terminate();
      reject(new Error('Spreadsheet took too long to parse'));
    }, timeoutMs);
    worker.once('message', (rows) => { clearTimeout(timer); resolve(rows); });
    worker.once('error', (err) => { clearTimeout(timer); reject(err); });
    worker.once('exit', (code) => {
      clearTimeout(timer);
      if (code !== 0) reject(new Error(`Parser exited with code ${code}`));
    });
  });
}

module.exports = { checkUpload, parseInWorker };
// parse-sheet-worker.js
const { parentPort, workerData } = require('node:worker_threads');
const XLSX = require('xlsx');

const wb = XLSX.read(Buffer.from(workerData), {
  type: 'buffer',
  sheetRows: 5001,    // header row plus at most 5,000 data rows
  cellFormula: false, // the import needs values, not formulae
  cellHTML: false,
});
const ws = wb.Sheets[wb.SheetNames[0]];

// header: 1 returns arrays of cell values, so no object keys come from the file
const rows = XLSX.utils.sheet_to_json(ws, { header: 1, defval: null });
parentPort.postMessage(rows);

After this, validate each row against the columns you expect, reject the file if the header row does not match, and treat every cell as untrusted text when you display it again. The same reasoning applies to images, PDFs and documents: our breakdown of how an image decoder bug led into OpenAI's monorepo shows where an unchecked upload path can end up, and our overview of vibe coding security risks covers the other places AI-generated code tends to trust input.

What good looks like

What good looks like

  • npm ls xlsx shows 0.20.3 (or the current SheetJS release) on every path, installed from the SheetJS CDN or a vendored tarball.
  • npm audit shows no high or critical findings, or each remaining one has a written reason and a fix date.
  • Uploads accept only the formats the feature needs, with a size limit checked before parsing.
  • The spreadsheet parser runs with a time and memory limit, and a timeout produces a clean error.
  • Rows are read as arrays and mapped to known columns, so no object keys come straight from the file.
  • The dependency check runs before every release, not only when someone remembers.

Dependency hygiene is one item on our production readiness checklist for vibe-coded apps, along with the auth, data and payment checks that usually need attention at the same time.

Get the rest of your dependencies and code checked

An outdated spreadsheet library is often the first finding, not the last. A dependency audit usually turns up other packages with known issues, and the code around file uploads deserves the same review.

Valletta Software runs a fixed-price vibe code audit, from $199, for apps built with AI tools. We read the source code, we do not touch your production systems or customer data, and you get a written report with what to fix first.

See the vibe code audit

FAQ

How do I fix the xlsx vulnerability in npm audit?

Uninstall the registry package and install the SheetJS release from its CDN: npm rm --save xlsx, then npm i --save https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz. If xlsx is a dependency of another package, add an overrides entry pointing at the same URL. Then run npm ls xlsx and npm audit again.

Why is there no fix for xlsx on npm?

SheetJS stopped publishing to the npm registry. The latest npm version is 0.18.5 from March 2022, while fixed releases are on cdn.sheetjs.com. The SheetJS documentation calls its CDN the authoritative source, and GitHub's advisories state that a non-vulnerable version cannot be found via npm.

Which SheetJS versions are vulnerable?

Every version through 0.19.2 is affected by CVE-2023-30533, prototype pollution when reading crafted files, fixed in 0.19.3. Every version through 0.20.1 is affected by CVE-2024-22363, a ReDoS, fixed in 0.20.2. All npm-registry versions are covered by both. The current SheetJS release is 0.20.3.

Is SheetJS 0.18.5 safe to use?

Not for reading untrusted files. Version 0.18.5 is affected by both CVE-2023-30533 and CVE-2024-22363. SheetJS says export-only workflows are unaffected by the prototype pollution issue, but the ReDoS advisory makes no such exception, so upgrading to the current CDN release is the safer default for any app.

Does installing xlsx from the SheetJS CDN change my code?

Usually not. The tarball installs under the same package name, so require('xlsx') keeps working. Commit the updated package.json and lockfile, run your tests, and check any package that depended on the old version. SheetJS recommends vendoring the tarball in your repository so builds do not depend on its CDN.

What else should I do to secure spreadsheet uploads?

Follow OWASP's File Upload Cheat Sheet: accept only the extensions you need, ignore the client's Content-Type, limit file size before parsing, generate your own file names, store files outside the web root, and allow uploads only for signed-in users. Parse in a worker with a timeout and memory limit, and map rows to known columns.

Vibe coded an app that needs to become a product?

We audit AI generated codebases and bring them to production quality. Book a free 30 minute call and get a senior review of your project.

Valletta.Software - Top-Rated Agency on 50Pros

Talk to the engineers behind this blog

Valletta Software builds and staffs dedicated development teams for companies across the EU and US. Tell us about your project and get a reply within one business day.