{"id":"GHSA-x77j-w7wf-fjmw","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\u003cscript\u003e\nlet testObject = { lang: '{{ lang }}', place: '{{ place }}' };\n\u003c/script\u003e\n```\n\nIt is possible to inject XSS payload using the below parameters:\n```\nhttps://\u003capplication-url\u003e/?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","aliases":["CVE-2023-2142"],"modified":"2024-11-26T18:54:25Z","published":"2023-04-20T21:19:24Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2023-04-20T21:19:24Z","nvd_published_at":"2024-11-26T12:15:18Z","cwe_ids":["CWE-79"],"severity":"MODERATE"},"references":[{"type":"WEB","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":"WEB","url":"https://github.com/mozilla/nunjucks/pull/1437"},{"type":"WEB","url":"https://github.com/mozilla/nunjucks/commit/ec16d210e7e13f862eccdb0bc9af9f60ff6749d6"},{"type":"WEB","url":"https://bugzilla.mozilla.org/show_bug.cgi?id=1825980"},{"type":"PACKAGE","url":"https://github.com/mozilla/nunjucks"},{"type":"WEB","url":"https://github.com/mozilla/nunjucks/releases/tag/v3.2.4"}],"affected":[{"package":{"name":"nunjucks","ecosystem":"npm","purl":"pkg:npm/nunjucks"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"3.2.4"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/04/GHSA-x77j-w7wf-fjmw/GHSA-x77j-w7wf-fjmw.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"},{"type":"CVSS_V4","score":"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"}]}