Free and open · new CVEs checked every 20 minutesStatusRSSOpen dataContact

CVE-2021-21353: Pug is an npm package which is a high-performance template engine

57
This week
MEDIUM 6.8REMOTEUPGRADEUPGRADE

CVE-2021-21353 is a medium-severity flaw (CVSS 6.8) affecting pug, pug-code-gen. Below: why it ranks where it does, which versions are affected, what to do, and the exact commands.

Pug is an npm package which is a high-performance template engine. In pug before version 3.0.1, if a remote attacker was able to control the `pretty` option of the pug compiler, e.g. if you spread a user provided object such as the query parameters of a request into the pug template inputs, it was possible for them to achieve remote code execution on the node.js backend. This is fixed in version 3.0.1. This advisory applies to multiple pug pack

Why this priority

  • EPSS top 9%: very likely to be exploited
  • Public exploit reference
  • Remotely exploitable, no login, no user action

A fixed release or distro patch exists.

Risk facts

CVSS score6.8 (Medium)
Attack vectorNetwork (remote)
Attack complexityHigh
Privileges neededNone
User interactionNone
EPSS exploit chance4.3% (top 9%)
CISA exploited listNo
WeaknessCWE-74, CWE-94
Published2021-03-03
Last modified2026-06-17
Publisher (CNA): GitHub, Inc. · Vendor: pugjs

Share: LinkedIn · X · Reddit

Last updated 2026-06-17 · Sources: CVE Program, NVD, CISA KEV, EPSS and vendor advisories · How we score

Am I affected?

Timeline

pugjs pug UPGRADE
Affected: < 3.0.1
Fixed in: 3.0.1
Safe to downgrade to: no unaffected older release
1. Check installed version
npm ls pug
2. UPGRADE to 3.0.1
npm install pug@">=3.0.1"
pugjs pug-code-gen UPGRADE
Affected: < 2.0.3 · >= 3.0.0 and < 3.0.2
Fixed in: 2.0.3, 3.0.2
Safe to downgrade to: a release before 3.0.0
1. Check installed version
npm ls pug-code-gen
2. UPGRADE to 2.0.3
npm install pug-code-gen@">=2.0.3"
3. If no update is available yet, DOWNGRADE to a release before 3.0.0
npm view pug-code-gen versions npm install pug-code-gen@"<3.0.0"
Downgrade risk
Downgrading can break dependent software and may reopen older bugs. Read the distro advisory first and test on a non-production host.
After downgrade
Restart the service, and keep the package held until a fixed release ships.
Verify at the official source NVD · CVE Program · Report a problem with this page
Scores and fixes here are computed automatically from those and other public sources. Confirm with the vendor advisory before changing production systems.

Quick answers

How do I fix CVE-2021-21353?

pug: upgrade to 3.0.1; pug-code-gen: upgrade to 2.0.3, 3.0.2. Exact commands for each OS are on this page.

Is CVE-2021-21353 being exploited?

CVE-2021-21353 is not on the CISA Known Exploited Vulnerabilities list at the time of the last update. Check again, as this can change.

What does CVE-2021-21353 affect?

CVE-2021-21353 affects pug, pug-code-gen. Severity is medium (CVSS 6.8). Pug is an npm package which is a high-performance template engine. In pug before version 3.0.1, if a remote attacker was able to control the `pretty` option of the pug compiler, e.g. if you spread a user provided object such as the query p

How urgent is CVE-2021-21353?

Priority 57/100. EPSS top 9%: very likely to be exploited; Public exploit reference; Remotely exploitable, no login, no user action

Software pages

Node.js vulnerabilities · npm packages vulnerabilities

References

← Back to latest CVEs

Get the weekly exploited-CVE digest by emailThe CVEs being attacked this week and how to fix them. No spam, unsubscribe any time.