You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pug-code-gen is a Default code-generator for pug. It generates HTML via a JavaScript template function.
Affected versions of this package are vulnerable to Improper Control of Generation of Code ('Code Injection') via the name option of the compileClient, compileFileClient, or compileClientWithDependenciesTracked functions. An attacker can execute arbitrary JavaScript code by providing untrusted input.
Note:
These functions are for compiling Pug templates into JavaScript, and there would typically be no reason to allow untrusted callers.
PoC
constexpress=require("express")constpug=require("pug")construntimeWrap=require('pug-runtime/wrap');constPORT=3000constapp=express()app.get("/",(req,res)=>{constout=runtimeWrap(pug.compileClient('string of pug',req.query))res.send(out())})app.listen(PORT,()=>{console.log(`Server is running on port ${PORT}`)})
Detailed paths
Overview
pug-code-gen is a Default code-generator for pug. It generates HTML via a JavaScript template function.
Affected versions of this package are vulnerable to Improper Control of Generation of Code ('Code Injection') via the
name
option of thecompileClient
,compileFileClient
, orcompileClientWithDependenciesTracked
functions. An attacker can execute arbitrary JavaScript code by providing untrusted input.Note:
These functions are for compiling Pug templates into JavaScript, and there would typically be no reason to allow untrusted callers.
PoC
Remediation
Upgrade
pug-code-gen
to version 3.0.3 or higher.References
SNYK-JS-PUGCODEGEN-7086056
(CVE-2024-36361) pug-code-gen@3.0.2
The text was updated successfully, but these errors were encountered: