{"id":"CVE-2023-2142","aliases":["GHSA-x77j-w7wf-fjmw"],"url":"https://o3.security/vulnerability/CVE-2023-2142","summary":"Nunjucks autoescape bypass leads to cross site scripting","details":"### 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\n","published":"2024-11-26T11:24:15.422Z","modified":"2026-10-28T02:30:26.376395727Z","cvss":{"score":6.1,"severity":"MEDIUM","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"},"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"npm","name":"nunjucks","fixedVersion":"3.2.4"}],"fix":{"url":"https://github.com/mozilla/nunjucks/pull/1437","label":"mozilla/nunjucks#1437"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/2xxx/CVE-2023-2142.json"},{"type":"ADVISORY","url":"https://github.com/mozilla/nunjucks/security/advisories/GHSA-x77j-w7wf-fjmw"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-2142"},{"type":"REPORT","url":"https://bugzilla.mozilla.org/show_bug.cgi?id=1825980"},{"type":"WEB","url":"https://github.com/mozilla/nunjucks/pull/1437"},{"type":"WEB","url":"https://github.com/mozilla/nunjucks/commit/ec16d210e7e13f862eccdb0bc9af9f60ff6749d6"},{"type":"PACKAGE","url":"https://github.com/mozilla/nunjucks"},{"type":"WEB","url":"https://github.com/mozilla/nunjucks/releases/tag/v3.2.4"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-10-28T02:30:26.376395727Z"}}