{"id":"CVE-2023-2142","aliases":["CVE-2023-2142","GHSA-x77j-w7wf-fjmw"],"related":[],"kind":"vulnerability","state":"published","title":"Nunjucks autoescape bypass leads to cross site scripting","summary":"In Nunjucks versions prior to version 3.2.4, it was \npossible to bypass the restrictions which are provided by the autoescape\n functionality. If there are two user-controlled parameters on the same \nline used in the views, it was possible to inject cross site scripting \npayloads using the backslash \\ character.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In Nunjucks versions prior to version 3.2.4, it was \npossible to bypass the restrictions which are provided by the autoescape\n functionality. If there are two user-controlled parameters on the same \nline used in the views, it was possible to inject cross site scripting \npayloads using the backslash \\ character.","source":"cvelist"},{"lang":"en","text":"### Impact\nIn Nunjucks versions prior to version 3.2.4, it was possible to bypass the restrictions which are provided by the autoescape functionality. If there are two user-controlled parameters on the same line used in the views, it was possible to inject cross site scripting payloads using the backslash `\\` character.\n\n#### Example\nIf the user-controlled parameters were used in the views similar to the following:\n```\n<script>\nlet testObject = { lang: '{{ lang }}', place: '{{ place }}' };\n</script>\n```\n\nIt is possible to inject XSS payload using the below parameters:\n```\nhttps://<application-url>/?lang=jp\\&place=};alert(document.domain)//\n```\n\n### Patches\nThe issue was patched in version 3.2.4.\n\n### References\n\n- https://bugzilla.mozilla.org/show_bug.cgi?id=1825980","format":"markdown","source":"ghsa"},{"lang":"es","text":"En las versiones de Nunjucks anteriores a la versión 3.2.4, era posible eludir las restricciones que proporciona la función de escape automático. Si hay dos parámetros controlados por el usuario en la misma línea utilizada en las vistas, era posible inyectar payloads de cross-site scripting utilizando el carácter de barra invertida \\.","source":"nvd"}],"published":"2023-04-20T21:19:24.000Z","modified":"2026-06-17T05:51:35.577Z","severity":{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"3.2.4","status":"affected"}],"vendor":"Mozilla","product":"Nunjucks","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","fixed":"3.2.4","status":"affected"}],"vendor":"mozilla","product":"nunjucks","cpe":"cpe:2.3:a:mozilla:nunjucks:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.2.4"}],"ecosystem":"npm","package":"nunjucks","purl":"pkg:npm/nunjucks","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.2.4"}],"vendor":"mozilla","product":"nunjucks","cpe":"cpe:2.3:a:mozilla:nunjucks:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://bugzilla.mozilla.org/show_bug.cgi?id=1825980","tags":["issue-tracking","permissions-required","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/mozilla/nunjucks/security/advisories/GHSA-x77j-w7wf-fjmw","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-2142","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/mozilla/nunjucks/pull/1437","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/mozilla/nunjucks/commit/ec16d210e7e13f862eccdb0bc9af9f60ff6749d6","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/mozilla/nunjucks","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/mozilla/nunjucks/releases/tag/v3.2.4","tags":["web"],"sources":["ghsa"]}],"credits":["blaiddx64"],"assigner":"mozilla","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2024-11-27T16:17:55.829Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-2142","url":"https://www.cve.org/CVERecord?id=CVE-2023-2142","licence":"CVE Terms of Use","modified":"2024-11-27T16:19:44.548Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-x77j-w7wf-fjmw","url":"https://github.com/advisories/GHSA-x77j-w7wf-fjmw","licence":"CC-BY-4.0","modified":"2024-11-26T18:54:25.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-2142","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-2142","licence":"Public domain","modified":"2026-06-17T05:51:35.577Z"}],"updatedAt":"2026-11-25T22:58:34.387Z","epss":{"score":0.00386,"percentile":0.34748,"date":"2026-12-02T12:00:21.000Z"}}