CVE-2021-21353 json
Remote code execution in pug
published 2021-03-03 5 y ago modified 2026-11-02 6 d ago also GHSA-p493-635q-r6gr , EUVD-2021-0685
- cvss
- 6.8
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 4.3%
- EPSS 4.3% chance of exploitation in 30 days, percentile 91%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- npm pug 3.0.1
- npm pug-code-gen 2.0.3, 3.0.2
- pugjs pug 3.0.1
- pugjs pug-code-gen 2.0.3, 3.0.2
- github.com/pugjs/pug@991e78f commit
- github.com/pugjs/pug#3314 pull request
- github.com/pugjs/pug/releases/tag/pug%403.0.1 release
- github.com/pugjs/pug/issues/3312 advisory
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2021-21353 updated cvss 9.0
pug: user provided objects as input to pug templates can achieve remote code execution
-
Red Hat Logging Subsystem for Red Hat OpenShift openshift-logging/kibana6-rhel8affected: no fix available
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- total
- Assessed
- 6 d ago
Exploit prediction
4.27% chance of exploitation in the next 30 days, higher than 91% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- github.com https://github.com/pugjs/pug/issues/3312 referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 6.8 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N |
| NVD | 3.1 | 9.0 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H |
| NVD | 2.0 | 6.8 | AV:N/AC:M/Au:N/C:P/I:P/A:P |
| GitHub | 3.1 | 6.8 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| npm | pug | <3.0.1 |
3.0.1 |
| npm | pug-code-gen | <2.0.3 >=3.0.0, <3.0.2 |
2.0.3 3.0.2 |
Affected products
- pugjs pug
Classification
References
-
github.com
/pugjs/pug/pull/3314
web, patch, third-party-advisory
-
github.com
/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0
web, patch, third-party-advisory
-
github.com
/pugjs/pug/issues/3312
web, exploit, patch, third-party-advisory
-
github.com
/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr
web, third-party-advisory
-
github.com
/pugjs/pug/releases/tag/pug%403.0.1
web, release-notes, third-party-advisory
-
npmjs.com
/package/pug
web, product, third-party-advisory
-
npmjs.com
/package/pug-code-gen
web, product, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2021-21353
advisory
Sources
- CVE List CVE-2021-21353
- GitHub Advisory GHSA-p493-635q-r6gr
- NVD CVE-2021-21353
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.