PT-2021-3172 · Unknown+1 · Pug-Code-Gen+1
Forbes Lindesay
·
Published
2021-02-10
·
Updated
2025-05-27
·
CVE-2021-21353
CVSS v2.0
9.3
Critical
| Vector | AV:N/AC:M/Au:N/C:C/I:C/A:C |
Name of the Vulnerable Software and Affected Versions
pug versions prior to 3.0.1
pug-code-gen versions prior to 2.0.3
Description
The issue is related to the insufficient neutralization of special elements in the output of the Pug HTML preprocessor, specifically in the VisitMixin and visitMixinBlock functions. This can allow a remote attacker to execute arbitrary code if they can control the
pretty option of the pug compiler, for example, by spreading a user-provided object into the pug template inputs.Recommendations
For pug versions prior to 3.0.1, upgrade to version 3.0.1 or later.
For pug-code-gen versions prior to 2.0.3, upgrade to version 2.0.3 or later.
As a temporary workaround, consider compiling templates in advance before applying user input to them, to prevent un-trusted input from being passed to pug as the
pretty option.Exploit
Fix
RCE
Special Elements Injection
Code Injection
Found an issue in the description? Have something to add? Feel free to write us 👾
Related Identifiers
Affected Products
Pug
Pug-Code-Gen