Advisory

GHSA-x77j-w7wf-fjmw

Also known as: CVE-2023-2142

Summary

Nunjucks autoescape bypass leads to cross site scripting

Details

Impact
In 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.

Example
If the user-controlled parameters were used in the views similar to the following:

<script>
let testObject = { lang: '{{ lang }}', place: '{{ place }}' };
</script>

It is possible to inject XSS payload using the below parameters:

https://<application-url>/?lang=jp\&place=};alert(document.domain)//

Patches
The issue was patched in version 3.2.4.

References

  • https://bugzilla.mozilla.org/show_bug.cgi?id=1825980

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2023-04-20 21:19 UTC
Modified
2024-11-26 18:54 UTC

Affected packages and fixes

nunjucks

npm · All systems

Affected

  • introduced 0, fixed 3.2.4 (semver)

Fixed versions

3.2.4

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences