CVE-2021-21353 (GCVE-0-2021-21353)
Vulnerability from cvelistv5
Published
2021-03-03 01:50
Modified
2025-04-16 22:10
CWE
  • CWE-74 - Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
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.
References
security-advisories@github.comhttps://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0Patch, Third Party Advisory
security-advisories@github.comhttps://github.com/pugjs/pug/issues/3312Exploit, Patch, Third Party Advisory
security-advisories@github.comhttps://github.com/pugjs/pug/pull/3314Patch, Third Party Advisory
security-advisories@github.comhttps://github.com/pugjs/pug/releases/tag/pug%403.0.1Release Notes, Third Party Advisory
security-advisories@github.comhttps://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6grThird Party Advisory
security-advisories@github.comhttps://www.npmjs.com/package/pugProduct, Third Party Advisory
security-advisories@github.comhttps://www.npmjs.com/package/pug-code-genProduct, Third Party Advisory
af854a3a-2127-422b-91ae-364da2661108https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0Patch, Third Party Advisory
af854a3a-2127-422b-91ae-364da2661108https://github.com/pugjs/pug/issues/3312Exploit, Patch, Third Party Advisory
af854a3a-2127-422b-91ae-364da2661108https://github.com/pugjs/pug/pull/3314Patch, Third Party Advisory
af854a3a-2127-422b-91ae-364da2661108https://github.com/pugjs/pug/releases/tag/pug%403.0.1Release Notes, Third Party Advisory
af854a3a-2127-422b-91ae-364da2661108https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6grThird Party Advisory
af854a3a-2127-422b-91ae-364da2661108https://www.npmjs.com/package/pugProduct, Third Party Advisory
af854a3a-2127-422b-91ae-364da2661108https://www.npmjs.com/package/pug-code-genProduct, Third Party Advisory
Impacted products
Vendor Product Version
pugjs pug Version: < 3.0.1
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-03T18:09:15.912Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_refsource_CONFIRM",
              "x_transferred"
            ],
            "url": "https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr"
          },
          {
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://github.com/pugjs/pug/issues/3312"
          },
          {
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://github.com/pugjs/pug/pull/3314"
          },
          {
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0"
          },
          {
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://github.com/pugjs/pug/releases/tag/pug%403.0.1"
          },
          {
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://www.npmjs.com/package/pug"
          },
          {
            "tags": [
              "x_refsource_MISC",
              "x_transferred"
            ],
            "url": "https://www.npmjs.com/package/pug-code-gen"
          }
        ],
        "title": "CVE Program Container"
      }
    ],
    "cna": {
      "affected": [
        {
          "product": "pug",
          "vendor": "pugjs",
          "versions": [
            {
              "status": "affected",
              "version": "\u003c 3.0.1"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "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."
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "attackComplexity": "HIGH",
            "attackVector": "NETWORK",
            "availabilityImpact": "NONE",
            "baseScore": 6.8,
            "baseSeverity": "MEDIUM",
            "confidentialityImpact": "NONE",
            "integrityImpact": "HIGH",
            "privilegesRequired": "NONE",
            "scope": "CHANGED",
            "userInteraction": "NONE",
            "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N",
            "version": "3.1"
          }
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "cweId": "CWE-74",
              "description": "CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component (\u0027Injection\u0027)",
              "lang": "en",
              "type": "CWE"
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-04-16T22:10:03.957Z",
        "orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
        "shortName": "GitHub_M"
      },
      "references": [
        {
          "name": "https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr",
          "tags": [
            "x_refsource_CONFIRM"
          ],
          "url": "https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr"
        },
        {
          "name": "https://github.com/pugjs/pug/issues/3312",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/pugjs/pug/issues/3312"
        },
        {
          "name": "https://github.com/pugjs/pug/pull/3314",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/pugjs/pug/pull/3314"
        },
        {
          "name": "https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0"
        },
        {
          "name": "https://github.com/pugjs/pug/releases/tag/pug%403.0.1",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/pugjs/pug/releases/tag/pug%403.0.1"
        },
        {
          "name": "https://www.npmjs.com/package/pug",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://www.npmjs.com/package/pug"
        },
        {
          "name": "https://www.npmjs.com/package/pug-code-gen",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://www.npmjs.com/package/pug-code-gen"
        }
      ],
      "source": {
        "advisory": "GHSA-p493-635q-r6gr",
        "discovery": "UNKNOWN"
      },
      "title": "Remote code execution in pug"
    }
  },
  "cveMetadata": {
    "assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
    "assignerShortName": "GitHub_M",
    "cveId": "CVE-2021-21353",
    "datePublished": "2021-03-03T01:50:18",
    "dateReserved": "2020-12-22T00:00:00",
    "dateUpdated": "2025-04-16T22:10:03.957Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "vulnerability-lookup:meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2021-21353\",\"sourceIdentifier\":\"security-advisories@github.com\",\"published\":\"2021-03-03T02:15:13.143\",\"lastModified\":\"2025-05-27T21:08:34.550\",\"vulnStatus\":\"Analyzed\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"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.\"},{\"lang\":\"es\",\"value\":\"Pug es un paquete npm que es un motor de plantillas de alto rendimiento. En pug antes de la versi\u00f3n 3.0.1, si un atacante remoto era capaz de controlar la opci\u00f3n `pretty` del compilador de pug, por ejemplo, si extend\u00eda un objeto proporcionado por el usuario, como los par\u00e1metros de consulta de una solicitud, en las entradas de la plantilla de pug, era posible que lograra la ejecuci\u00f3n remota de c\u00f3digo en el backend de node.js. Esto se ha corregido en la versi\u00f3n 3.0.1. Este aviso se aplica a varios paquetes de pug, incluyendo \\\"pug\\\", \\\"pug-code-gen\\\". pug-code-gen tiene una correcci\u00f3n con soporte en la versi\u00f3n 2.0.3. Este aviso no es explotable si no hay forma de pasar a pug entradas no confiables como la opci\u00f3n `pretty`, por ejemplo, si compila las plantillas por adelantado antes de aplicarles las entradas del usuario, no necesita actualizar\"}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"security-advisories@github.com\",\"type\":\"Secondary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N\",\"baseScore\":6.8,\"baseSeverity\":\"MEDIUM\",\"attackVector\":\"NETWORK\",\"attackComplexity\":\"HIGH\",\"privilegesRequired\":\"NONE\",\"userInteraction\":\"NONE\",\"scope\":\"CHANGED\",\"confidentialityImpact\":\"NONE\",\"integrityImpact\":\"HIGH\",\"availabilityImpact\":\"NONE\"},\"exploitabilityScore\":2.2,\"impactScore\":4.0},{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H\",\"baseScore\":9.0,\"baseSeverity\":\"CRITICAL\",\"attackVector\":\"NETWORK\",\"attackComplexity\":\"HIGH\",\"privilegesRequired\":\"NONE\",\"userInteraction\":\"NONE\",\"scope\":\"CHANGED\",\"confidentialityImpact\":\"HIGH\",\"integrityImpact\":\"HIGH\",\"availabilityImpact\":\"HIGH\"},\"exploitabilityScore\":2.2,\"impactScore\":6.0}],\"cvssMetricV2\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"cvssData\":{\"version\":\"2.0\",\"vectorString\":\"AV:N/AC:M/Au:N/C:P/I:P/A:P\",\"baseScore\":6.8,\"accessVector\":\"NETWORK\",\"accessComplexity\":\"MEDIUM\",\"authentication\":\"NONE\",\"confidentialityImpact\":\"PARTIAL\",\"integrityImpact\":\"PARTIAL\",\"availabilityImpact\":\"PARTIAL\"},\"baseSeverity\":\"MEDIUM\",\"exploitabilityScore\":8.6,\"impactScore\":6.4,\"acInsufInfo\":false,\"obtainAllPrivilege\":false,\"obtainUserPrivilege\":false,\"obtainOtherPrivilege\":false,\"userInteractionRequired\":false}]},\"weaknesses\":[{\"source\":\"security-advisories@github.com\",\"type\":\"Secondary\",\"description\":[{\"lang\":\"en\",\"value\":\"CWE-74\"}]},{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"description\":[{\"lang\":\"en\",\"value\":\"CWE-94\"}]}],\"configurations\":[{\"nodes\":[{\"operator\":\"OR\",\"negate\":false,\"cpeMatch\":[{\"vulnerable\":true,\"criteria\":\"cpe:2.3:a:pugjs:pug:*:*:*:*:*:node.js:*:*\",\"versionEndExcluding\":\"3.0.1\",\"matchCriteriaId\":\"AE43CE50-8DE8-4487-BCCB-9E3931241EB2\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:a:pugjs:pug-code-gen:*:*:*:*:*:node.js:*:*\",\"versionEndExcluding\":\"2.0.3\",\"matchCriteriaId\":\"F0CD8CA7-F670-4B0A-9639-E7D60F401DBB\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:a:pugjs:pug-code-gen:*:*:*:*:*:node.js:*:*\",\"versionStartIncluding\":\"3.0.0\",\"versionEndExcluding\":\"3.0.2\",\"matchCriteriaId\":\"55FCB9F1-8C93-474D-9137-CB14C8F9F05E\"}]}]}],\"references\":[{\"url\":\"https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Patch\",\"Third Party Advisory\"]},{\"url\":\"https://github.com/pugjs/pug/issues/3312\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Exploit\",\"Patch\",\"Third Party Advisory\"]},{\"url\":\"https://github.com/pugjs/pug/pull/3314\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Patch\",\"Third Party Advisory\"]},{\"url\":\"https://github.com/pugjs/pug/releases/tag/pug%403.0.1\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Release Notes\",\"Third Party Advisory\"]},{\"url\":\"https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Third Party Advisory\"]},{\"url\":\"https://www.npmjs.com/package/pug\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Product\",\"Third Party Advisory\"]},{\"url\":\"https://www.npmjs.com/package/pug-code-gen\",\"source\":\"security-advisories@github.com\",\"tags\":[\"Product\",\"Third Party Advisory\"]},{\"url\":\"https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Patch\",\"Third Party Advisory\"]},{\"url\":\"https://github.com/pugjs/pug/issues/3312\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Exploit\",\"Patch\",\"Third Party Advisory\"]},{\"url\":\"https://github.com/pugjs/pug/pull/3314\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Patch\",\"Third Party Advisory\"]},{\"url\":\"https://github.com/pugjs/pug/releases/tag/pug%403.0.1\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Release Notes\",\"Third Party Advisory\"]},{\"url\":\"https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Third Party Advisory\"]},{\"url\":\"https://www.npmjs.com/package/pug\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Product\",\"Third Party Advisory\"]},{\"url\":\"https://www.npmjs.com/package/pug-code-gen\",\"source\":\"af854a3a-2127-422b-91ae-364da2661108\",\"tags\":[\"Product\",\"Third Party Advisory\"]}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…