CVE-2021-21353Remote code execution in pug
- 6.8MediumCVSS base score
- 4.3%Exploitation in 30 daysEPSS · top 8.7% of all CVEs
- NoKnown exploitednot in CISA's KEV catalog
- NonePublic exploitsnone known yet
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
ID reserved
By GitHub_M
- 2 months later
· 2 months later
Published
- 6 years later
· 6 years later
Record updated
Changes after publication (a new score, a public exploit, EPSS crossing 1, 10 or 50 %, leaving KEV) are kept since November 2026; earlier ones are not known.
Scores
| Scored by | CVSS | Score | Vector |
|---|---|---|---|
| GitHub_MCNA (assigner) | 3.1 | Medium6.8 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N |
| NVDNVD · Analyzed | 3.1 | Critical9.0 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H |
- EPSS (exploitation in 30 days)
- 4.3% · top 8.7% of all CVEs (18 Nov 2026)
- CISA SSVC
- Exploitation: none · Automatable: no · Technical impact: total
The list uses the assigner's score when there is one, then CISA's, then NVD's: Medium 6.8.
Affected products
Affected packages
From reviewed advisories of the GitHub Advisory Database.
- npmpugGHSA-p493-635q-r6gr (opens in a new tab)
- npmpug-code-genGHSA-p493-635q-r6gr (opens in a new tab)
References
References7
- https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr (opens in a new tab)x_refsource_CONFIRMx_transferred
- https://github.com/pugjs/pug/issues/3312 (opens in a new tab)x_refsource_MISCx_transferred
- https://github.com/pugjs/pug/pull/3314 (opens in a new tab)x_refsource_MISCx_transferred
- https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0 (opens in a new tab)x_refsource_MISCx_transferred
- https://github.com/pugjs/pug/releases/tag/pug%403.0.1 (opens in a new tab)x_refsource_MISCx_transferred
- https://www.npmjs.com/package/pug (opens in a new tab)x_refsource_MISCx_transferred
- https://www.npmjs.com/package/pug-code-gen (opens in a new tab)x_refsource_MISCx_transferred
Sources
The same CVE in the primary databases and aggregators, to check against.
- CVE.org record (opens in a new tab)
- CVE List JSON (GitHub) (opens in a new tab)
- NVD (opens in a new tab)
- FIRST EPSS (opens in a new tab)
- EUVD EUVD-2021-0685 (opens in a new tab)
- OSV.dev (opens in a new tab)
- GitHub Advisory GHSA-p493-635q-r6gr (opens in a new tab)
- CIRCL Vulnerability-Lookup (opens in a new tab)
Badge for a README or a ticket
[](https://cveledger.app/cve/CVE-2021-21353)Record last updated .