CVE-2021-21353
MediumCVSS 6.8Exploitation Probability (EPSS)
Very high risk91th percentile - higher than 91% of all known CVEs
Summary
Pug is a template engine for Node.js. In versions before 3.0.1, if a remote attacker could control the `pretty` option of the Pug compiler (e.g., by spreading a user-provided object into template inputs), they could achieve remote code execution on the Node.js backend. This is fixed in version 3.0.1, with a backported fix for pug-code-gen in version 2.0.3.
Risk Assessment
This vulnerability allows remote code execution, potentially leading to full compromise of the application server. The risk exists only if untrusted input can be passed to the `pretty` compiler option.
Recommendation
Upgrade the pug package to version 3.0.1 or later, and pug-code-gen to 2.0.3. Ensure user-supplied data is not passed directly to compiler options.
Other vulnerabilities in Pug
Original NVD description (English source)
Pug is an npm package which is a high-performance template engine. In pug before version 3.0.1, if a remote attacker was able to control the `pretty` option of the pug compiler, e.g. if you spread a user provided object such as the query parameters of a request into the pug template inputs, it was possible for them to achieve remote code execution on the node.js backend. This is fixed in version 3.0.1. This advisory applies to multiple pug packages including "pug", "pug-code-gen". pug-code-gen has a backported fix at version 2.0.3. This advisory is not exploitable if there is no way for un-trusted input to be passed to pug as the `pretty` option, e.g. if you compile templates in advance before applying user input to them, you do not need to upgrade.
Vulnerability data from NVD (NIST) · CISA KEV · EPSS

