{"api_version":"1","generated_at":"2026-07-23T13:44:43+00:00","cve":"CVE-2021-21353","urls":{"html":"https://cve.report/CVE-2021-21353","api":"https://cve.report/api/cve/CVE-2021-21353.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2021-21353","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2021-21353"},"summary":{"title":"CVE-2021-21353","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.","state":"PUBLIC","assigner":"security-advisories@github.com","published_at":"2021-03-03 02:15:00","updated_at":"2021-03-09 15:35:00"},"problem_types":["CWE-74"],"metrics":[],"references":[{"url":"https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0","name":"https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0","refsource":"MISC","tags":["Patch","Third Party Advisory"],"title":"fix: sanitise and escape the `pretty` option (#3314) · pugjs/pug@991e78f · GitHub","mime":"text/html","httpstatus":"200","archivestatus":"200"},{"url":"https://github.com/pugjs/pug/releases/tag/pug%403.0.1","name":"https://github.com/pugjs/pug/releases/tag/pug%403.0.1","refsource":"MISC","tags":["Release Notes","Third Party Advisory"],"title":"Release pug@3.0.1 · pugjs/pug · GitHub","mime":"text/html","httpstatus":"200","archivestatus":"200"},{"url":"https://github.com/pugjs/pug/issues/3312","name":"https://github.com/pugjs/pug/issues/3312","refsource":"MISC","tags":["Exploit","Patch","Third Party Advisory"],"title":"Code injection vulnerability in visitMixin and visitMixinBlock through \"pretty\" option · Issue #3312 · pugjs/pug · GitHub","mime":"text/html","httpstatus":"200","archivestatus":"404"},{"url":"https://github.com/pugjs/pug/pull/3314","name":"https://github.com/pugjs/pug/pull/3314","refsource":"MISC","tags":["Patch","Third Party Advisory"],"title":"fix: sanitise and escape the `pretty` option by ForbesLindesay · Pull Request #3314 · pugjs/pug · GitHub","mime":"text/html","httpstatus":"200","archivestatus":"200"},{"url":"https://www.npmjs.com/package/pug-code-gen","name":"https://www.npmjs.com/package/pug-code-gen","refsource":"MISC","tags":["Product","Third Party Advisory"],"title":"pug-code-gen","mime":"text/html","httpstatus":"200","archivestatus":"200"},{"url":"https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr","name":"https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr","refsource":"CONFIRM","tags":["Third Party Advisory"],"title":"Remote code execution via the `pretty` option. · Advisory · pugjs/pug · GitHub","mime":"text/html","httpstatus":"200","archivestatus":"0"},{"url":"https://www.npmjs.com/package/pug","name":"https://www.npmjs.com/package/pug","refsource":"MISC","tags":["Product","Third Party Advisory"],"title":"pug","mime":"text/html","httpstatus":"200","archivestatus":"200"},{"url":"https://www.cve.org/CVERecord?id=CVE-2021-21353","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21353","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[{"cve_year":"2021","cve_id":"21353","vulnerable":"1","versionEndIncluding":"","cpe1":"cpe","cpe2":"2.3","cpe3":"a","cpe4":"pugjs","cpe5":"pug","cpe6":"*","cpe7":"*","cpe8":"*","cpe9":"*","cpe10":"*","cpe11":"node.js","cpe12":"*","cpe13":"*"},{"cve_year":"2021","cve_id":"21353","vulnerable":"1","versionEndIncluding":"1","cpe1":"cpe","cpe2":"2.3","cpe3":"a","cpe4":"pugjs","cpe5":"pug","cpe6":"*","cpe7":"*","cpe8":"*","cpe9":"*","cpe10":"*","cpe11":"node.js","cpe12":"*","cpe13":"*"},{"cve_year":"2021","cve_id":"21353","vulnerable":"1","versionEndIncluding":"","cpe1":"cpe","cpe2":"2.3","cpe3":"a","cpe4":"pugjs","cpe5":"pug-code-gen","cpe6":"*","cpe7":"*","cpe8":"*","cpe9":"*","cpe10":"*","cpe11":"node.js","cpe12":"*","cpe13":"*"},{"cve_year":"2021","cve_id":"21353","vulnerable":"1","versionEndIncluding":"1","cpe1":"cpe","cpe2":"2.3","cpe3":"a","cpe4":"pugjs","cpe5":"pug-code-gen","cpe6":"*","cpe7":"*","cpe8":"*","cpe9":"*","cpe10":"*","cpe11":"node.js","cpe12":"*","cpe13":"*"}],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[{"cve":"CVE-2021-21353","qid":"982929","title":"Nodejs (npm) Security Update for pug-code-gen (GHSA-p493-635q-r6gr)"}]},"source_records":{"cve_program":{"CVE_data_meta":{"ASSIGNER":"security-advisories@github.com","ID":"CVE-2021-21353","STATE":"PUBLIC","TITLE":"Remote code execution in pug"},"affects":{"vendor":{"vendor_data":[{"product":{"product_data":[{"product_name":"pug","version":{"version_data":[{"version_value":"< 3.0.1"}]}}]},"vendor_name":"pugjs"}]}},"data_format":"MITRE","data_type":"CVE","data_version":"4.0","description":{"description_data":[{"lang":"eng","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."}]},"impact":{"cvss":{"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"}},"problemtype":{"problemtype_data":[{"description":[{"lang":"eng","value":"CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')"}]}]},"references":{"reference_data":[{"name":"https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr","refsource":"CONFIRM","url":"https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr"},{"name":"https://github.com/pugjs/pug/issues/3312","refsource":"MISC","url":"https://github.com/pugjs/pug/issues/3312"},{"name":"https://github.com/pugjs/pug/pull/3314","refsource":"MISC","url":"https://github.com/pugjs/pug/pull/3314"},{"name":"https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0","refsource":"MISC","url":"https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0"},{"name":"https://github.com/pugjs/pug/releases/tag/pug%403.0.1","refsource":"MISC","url":"https://github.com/pugjs/pug/releases/tag/pug%403.0.1"},{"name":"https://www.npmjs.com/package/pug","refsource":"MISC","url":"https://www.npmjs.com/package/pug"},{"name":"https://www.npmjs.com/package/pug-code-gen","refsource":"MISC","url":"https://www.npmjs.com/package/pug-code-gen"}]},"source":{"advisory":"GHSA-p493-635q-r6gr","discovery":"UNKNOWN"}},"nvd":{"publishedDate":"2021-03-03 02:15:00","lastModifiedDate":"2021-03-09 15:35:00","problem_types":["CWE-74"],"metrics":{"baseMetricV3":{"cvssV3":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H","attackVector":"NETWORK","attackComplexity":"HIGH","privilegesRequired":"NONE","userInteraction":"NONE","scope":"CHANGED","confidentialityImpact":"HIGH","integrityImpact":"HIGH","availabilityImpact":"HIGH","baseScore":9,"baseSeverity":"CRITICAL"},"exploitabilityScore":2.2,"impactScore":6},"baseMetricV2":{"cvssV2":{"version":"2.0","vectorString":"AV:N/AC:M/Au:N/C:P/I:P/A:P","accessVector":"NETWORK","accessComplexity":"MEDIUM","authentication":"NONE","confidentialityImpact":"PARTIAL","integrityImpact":"PARTIAL","availabilityImpact":"PARTIAL","baseScore":6.8},"severity":"MEDIUM","exploitabilityScore":8.6,"impactScore":6.4,"acInsufInfo":false,"obtainAllPrivilege":false,"obtainUserPrivilege":false,"obtainOtherPrivilege":false,"userInteractionRequired":false}},"configurations":{"CVE_data_version":"4.0","nodes":[{"operator":"OR","children":[],"cpe_match":[{"vulnerable":true,"cpe23Uri":"cpe:2.3:a:pugjs:pug:*:*:*:*:*:node.js:*:*","versionEndExcluding":"3.0.1","cpe_name":[]},{"vulnerable":true,"cpe23Uri":"cpe:2.3:a:pugjs:pug-code-gen:*:*:*:*:*:node.js:*:*","versionStartIncluding":"3.0.0","versionEndExcluding":"3.0.2","cpe_name":[]},{"vulnerable":true,"cpe23Uri":"cpe:2.3:a:pugjs:pug-code-gen:*:*:*:*:*:node.js:*:*","versionEndExcluding":"2.0.3","cpe_name":[]}]}]}},"legacy_mitre":{"record":{"CveYear":"2021","CveId":"21353","Ordinal":"195479","Title":"CVE-2021-21353","CVE":"CVE-2021-21353","Year":"2021"},"notes":[{"CveYear":"2021","CveId":"21353","Ordinal":"1","NoteData":"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.","Type":"Description","Title":null},{"CveYear":"2021","CveId":"21353","Ordinal":"2","NoteData":"2021-03-02","Type":"Other","Title":"Published"},{"CveYear":"2021","CveId":"21353","Ordinal":"3","NoteData":"2021-03-02","Type":"Other","Title":"Modified"}]}}}