Public vulnerability disclosure

CVE-2021-21353

Remote code execution in pug

publishedCWE-74

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.

Technical severity6.8 mediumCVSS 3.1 · CNA: GitHub_M
Published2021-03-03Source updated 2026-11-02
Collected2026-11-023 attributed sources

Fixes and workarounds

Fix

pug (npm): OSV reports a fixed version 3.0.1. Check the advisory for supported release branches.

Source: OSV GHSA-p493-635q-r6gr

Fix

pug-code-gen (npm): OSV reports a fixed version 2.0.3. Check the advisory for supported release branches.

Source: OSV GHSA-p493-635q-r6gr

Fix

pug-code-gen (npm): OSV reports a fixed version 3.0.2. Check the advisory for supported release branches.

Source: OSV GHSA-p493-635q-r6gr

Affected products and versions

Affected products, source version ranges and reporting authorities
ProductVersionsAuthority
pug
pugjs
< 3.0.1 (affected) CNA: GitHub_M
pug

pug
npm
≥ 0; < 3.0.1 (affected, semver); OSV events: introduced 0; fixed 3.0.1
Source events (semver)
[
  {
    "introduced": "0"
  },
  {
    "fixed": "3.0.1"
  }
]

Other versions: unaffected
OSV GHSA-p493-635q-r6gr
pug-code-gen

pug-code-gen
npm
≥ 0; < 2.0.3 (affected, semver); OSV events: introduced 0; fixed 2.0.3
Source events (semver)
[
  {
    "introduced": "0"
  },
  {
    "fixed": "2.0.3"
  }
]

Other versions: unaffected
OSV GHSA-p493-635q-r6gr
pug-code-gen

pug-code-gen
npm
≥ 3.0.0; < 3.0.2 (affected, semver); OSV events: introduced 3.0.0; fixed 3.0.2
Source events (semver)
[
  {
    "introduced": "3.0.0"
  },
  {
    "fixed": "3.0.2"
  }
]

Other versions: unaffected
OSV GHSA-p493-635q-r6gr

Version ranges are source assertions. Check the vendor advisory and your installed configuration before determining exposure.

CVSS assessments

CVSS scores, vectors and reporting authorities
Version / scoreVectorAuthority
3.1 / 6.8
medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:NCNA: GitHub_M

Exploit evidence

No exploit evidence in collected sources. This is not proof of no exploitation.

References

For agents and automation

Read public disclosures for free as Markdown or JSON. Compatible browsers also expose native WebMCP tools to search disclosures, read this page, and discover API access.

Use the ontology-linked Cyber API with x402 pay per request, or a Y2 Pro or Elite API key with the intel:cyber scope.

Endpoints and access details

https://api.y2.dev/api/v2/cyber/cves
https://api.y2.dev/api/v2/cyber/cves/{cveId}

A workspace owner or admin can create a Pro or Elite API key. Send Authorization: Bearer <Y2_API_KEY> from your trusted agent runtime.

For x402, omit Authorization and read the HTTP 402 payment challenge before signing a retry. Public browser tools do not make payments.

Agent access JSON · OpenAPI · CVE API guide