Safeguard
Vulnerability Analysis•

CVE-2020-26311: High ReDoS in the Node.js useragent Parser

CVE-2020-26311 is a high ReDoS flaw in the npm useragent parser. Fixed on master per GitHub Security Lab, not in the npm release. Replace or pin a fork.

Safeguard Security Team
3 min read

CVE-2020-26311 is a high severity (CVSS 7.5) regular expression denial of service flaw in useragent, a user agent parser for Node.js. The record says all versions at publication are affected and no patch was available. GitHub Security Lab says the fix landed on master but not in an npm release.

What's affected

  • The useragent npm package, all versions at the time of the record.
  • The advisory says the fix is in the master branch (commit 4c3ee79), but the published npm release did not include it.
  • Fixed in a release: none known.

The record scores it 7.5 (High) with vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H. The record does not flag it as a CISA Known Exploited Vulnerability, and none of the pages I read report exploitation in the wild.

How to check if you're exposed

Run npm ls --all | grep -i useragent in your project to see whether it is a direct or transitive dependency. A lockfile search works too. You can also paste your manifest into the free scanner at gold.safeguard.sh/scan.

What to do now

  1. Search for useragent in your dependency tree.
  2. Check if a newer release now exists on npm.
  3. If not, replace it with a maintained parser or a fork that includes the master fix.
  4. Put a size limit on User-Agent header values at your edge.

After you patch, record the new version for useragent in your asset inventory, and confirm it with the same check you used above. A fix that was never verified is easy to forget, and an inventory that shows versions is what lets you answer the next advisory in minutes instead of days.

Why it matters

The record maps this to CWE-1333, inefficient regular expression complexity. A pattern that backtracks without bound can take exponential time on a crafted string, so a single request can tie up a Node.js process, which is single threaded. GitHub Security Lab found these with a CodeQL query and published the advisory in July 2021 after a disclosure deadline expired. The vulnerable expression is in a device detection pattern in lib/regexps.js.

To check open source components in your own projects for known CVEs like this one, try the free in-browser dependency scan at gold.safeguard.sh/scan, or look the CVE up in the Gold directory.

Quick check

Can a header be the trigger?

A user agent parser reads the User-Agent header, which every client controls. That makes a slow expression a request level risk, so capping header size at your proxy helps.

How do I find every place useragent is used?

Start with an inventory of installed software and versions, because you cannot patch what you have not found. Check servers, build hosts, test copies and anything a vendor bundles. For open source libraries, a dependency scan or SBOM gives the same list for your code.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

We email you a link to confirm, and only then add you to the list. Unsubscribe in one click. Privacy

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.