CVE-2021-21353
Remote code execution in pug
A public proof of concept exists; no exploitation attested.
- Published2021-03-03
- Fixed in3.0.2 · 2.0.3
- WeaknessCWE-74 · CWE-94
Am I affected?
Debian, Ubuntu or Red Hat sometimes backport a fix without changing the upstream version number: such a version reads « to verify », never « affected ».With a domain, we read the version its public headers and pages expose. A distribution build can carry the fix under an older number.
Description
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 packages including "pug", "pug-code-gen". pug-code-gen has a backported fix at version 2.0.3. This advisory is not exploitable if there is no way for un-trusted input to be passed to pug as the `pretty` option, e.g. if you compile templates in advance before applying user input to them, you do not need to upgrade.
Timeline
dates in UTC- 2021-03-0301:50CVE publishedCNA
- 2021-03-0302:15CVE publishedNVD
Versions per branch
NVD · OSV| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 3.0 | ≥ 3.0.0, < 3.0.2 | 3.0.2 | NVD · OSV |
| 2.0 | < 2.0.3 | 2.0.3 | NVD · OSV |
| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 3.0 | < 3.0.1 | 3.0.1 | NVD · OSV |
as publishedRanges as NVD and OSV publish them; a distribution’s build can be fixed under an older number.
Products declared by the CNA1 product
As GitHub_M, the CNA that assigned this CVE, declared them in the CVE record; versions as written.
- pugjs pugAffected
- = < 3.0.1no fix stated
Source: the CNA record (CVE Program), © The MITRE Corporation,CVE terms of useCVE recordupdated 2025-04-16
Distribution builds and vendor advisories
Packages from OSV.dev and products from the vendors' CSAF advisories.
version not verifiedVersions not verified: read as OSV.dev and the vendors publish them, not checked against each vendor's release list.
Packages
- @rootio/pugRoot:npmall versions · fixed in 2.0.4-root.io.2
- @rootio/pug-code-genRoot:npmall versions · fixed in 2.0.2-root.io.1
- code-serverWolfiall versions · fixed in 0and 1 other package
- code-serverChainguardall versions · fixed in 0and 61 other packages
- commercial-gitlab-rails-ee-assets-19.1Chainguardall versions · no fixed version listedand 5 other packages
- gitlab-rails-19.1MinimOSall versions · fixed in 0and 1 other package
- pugTuxCare:npmfrom 2.0.4-tuxcare.0 · fixed in 2.0.4-tuxcare.4
- pugRoot:npmall versions · fixed in 2.0.4-aikido.2
1 more package range on OSV.dev
Vendor advisories
pug: user provided objects as input to pug templates can achieve remote code execution
openshift-logging/kibana6-rhel8 as a component of Logging Subsystem for Red Hat OpenShift
Fix
- Update Pugjs pug-code-gen to 3.0.2 · 2.0.3
- No fix available, says the vendor Red Hat Product Security CVE-2021-21353 · 1 productAffected
Advisories and patches
- github.comPatch
- github.comPatch
- github.comPatch
- github.comRelease Notes
Detection
read 2026-11-01 01:02 UTC- Nuclei template
- none so far ProjectDiscovery
- Exploit-DB
- no entry Exploit-DB
- Proof of concept
- PoC-in-GitHub1 repository, unverifiedknown since 2026-11-01jinsu9758/PUG-RCE-CVE-2021-21353-POC
- Metasploit modules
- none listed Metasploit Framework
Sources
- CISA-ADPSSVC decisionnone2026-11-02
- CNACVSS 3.16.82025-04-16
- NVDCVSS 3.19read 2026-11-02
- NVDCVSS 2.06.8read 2026-11-02
- CNAweakness (CWE)CWE-742025-04-16
- NVDweakness (CWE)CWE-94read 2026-11-02
- FIRST EPSSEPSS score4.5 %2026-12-03
- PoC-in-GitHubproof of concept1known since 2026-11-01
- OSVaffected packages—
- GitHub AdvisoriesadvisoryModerate2021-03-03
Identifiers
- CGA-23g7-fxfh-cjxcsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-287w-x769-4v87same flawChainguard · CC-BY-NC-ND-4.0
- CGA-2gw8-cw68-cf68same flawChainguard · CC-BY-NC-ND-4.0
- CGA-2j6g-gxmh-fgg4same flawChainguard · CC-BY-NC-ND-4.0
- CGA-2jqr-5cgx-gw6wsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-2jxc-r2g8-pvw5same flawChainguard · CC-BY-NC-ND-4.0
- CGA-2qvf-hvph-qpf7same flawChainguard · CC-BY-NC-ND-4.0
- CGA-2vg7-34f6-45r2same flawChainguard · CC-BY-NC-ND-4.0
- CGA-368m-rfc8-78cmsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-3c33-gc9w-hmw3same flawChainguard · CC-BY-NC-ND-4.0
- CGA-3f52-3mm3-w74qsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-3f64-xq65-5v2vsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-3fxp-xqpm-wmf5same flawChainguard · CC-BY-NC-ND-4.0
- CGA-3ggh-6v57-jhc3same flawChainguard · CC-BY-NC-ND-4.0
- CGA-45gv-jxf7-mfmgsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-45vp-9j54-r6cvsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-49rr-m6pr-3m83same flawChainguard · CC-BY-NC-ND-4.0
- CGA-4cg5-hg7p-5pfgsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-4r5g-qvqh-5jvmsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-4vc6-7x6j-chm8same flawChainguard · CC-BY-NC-ND-4.0
- CGA-4vwj-5xmh-pcjvsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-52jw-pwr7-m2c2same flawChainguard · CC-BY-NC-ND-4.0
- CGA-58qx-g5w7-hwvwsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-5cm4-rcc2-f82csame flawChainguard · CC-BY-NC-ND-4.0
- CGA-5hcq-hp5g-74g4same flawChainguard · CC-BY-NC-ND-4.0
- CGA-5hq4-96hj-49ghsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-5q72-cc7w-jmg3same flawChainguard · CC-BY-NC-ND-4.0
- CGA-5qg4-9pwq-rh25same flawChainguard · CC-BY-NC-ND-4.0
- CGA-5xcc-jg2m-cc7psame flawChainguard · CC-BY-NC-ND-4.0
- CGA-64c9-84xq-vw3wsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-64gc-vj37-vgcgsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-65c4-42m5-frxwsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-6fqf-v9g9-xfrcsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-6h79-r5h4-99qwsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-6mmp-4g6m-mmwmsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-6p9m-m3cg-gfr9same flawChainguard · CC-BY-NC-ND-4.0
- CGA-6vmv-9h3g-h38wsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-736c-4gr9-6h35same flawChainguard · CC-BY-NC-ND-4.0
- CGA-76j3-8jp6-c2r9same flawChainguard · CC-BY-NC-ND-4.0
- CGA-7c2m-pf6c-p665same flawChainguard · CC-BY-NC-ND-4.0
- CGA-7c9x-hgpv-f8fcsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-7gpq-mxhm-xg5fsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-7hg2-xhhm-g48csame flawChainguard · CC-BY-NC-ND-4.0
- CGA-7m68-2wjc-8x36same flawChainguard · CC-BY-NC-ND-4.0
- CGA-7p8g-x4g7-gh93same flawChainguard · CC-BY-NC-ND-4.0
- CGA-7vr2-jc3p-7w7fsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-84pw-3jwf-x746same flawChainguard · CC-BY-NC-ND-4.0
- CGA-89m8-vqm2-84wxsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-89q4-rw8x-96x9same flawChainguard · CC-BY-NC-ND-4.0
- CGA-8c8p-6r4h-47ggsame flawChainguard · CC-BY-NC-ND-4.0
Technical details
- CVSS v3 vector
- CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
- Published
- 2021-03-03
- Last modified
- 2026-11-02
- NVD status
- Analyzed
- GitHub advisory
- GHSA-p493-635q-r6gr
Frequently asked questions
What is CVE-2021-21353?
Is CVE-2021-21353 actively exploited?
What is the CVSS score for CVE-2021-21353?
Running pug-code-gen? Hear about its next vulnerability
Surveillance reads the versions in your stack — a domain, a lockfile or a list — checks each CVE against the ranges its sources publish, and alerts you when one you run is exploited or enters CISA KEV. A version it cannot read stays « version not verified ».
No credit card required · No monthly cap on website checks · 250 API requests/month
Go further
- Following what attackers exploit right now? The CISA KEV additions of the month, with their patch deadlines.
- Running this software? Vulnerability monitoring alerts you to new vulnerabilities in your products.
Related vulnerabilities
Same product first, then the same vendor advisory and the same publication week.
Sources for this record
- CVE Program · CVE Program Terms of Use
- FIRST EPSS · EPSS terms of use (free use, attribution requested)
- GitHub Advisory Database · CC-BY-4.0 · GHSA-p493-635q-r6gr
- NVD · Public domain (17 U.S.C. § 105) for NVD-authored data; third-party content under its own terms
- OSV.dev · Per record, as its publisher states it: each row carries the label in sourceLicense when one is served
- PoC-in-GitHub · CC0-1.0
- Red Hat Product Security (CSAF and VEX) · CC-BY-4.0
- CISA Vulnrichment · CC0-1.0