CVE-2021-32817:
Insecure template handling in express-hbs
5.4
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.6403%
CWE
Published
5/17/2021
Updated
4/4/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
express-hbs | npm | <= 2.4.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from express-hbs's handling of the 'layout' parameter in the Express render API. When applications pass user-controlled data (e.g., req.query
) to res.render
, attackers can inject a 'layout' value pointing to arbitrary files. The engine resolves this parameter to read files from disk (with existing extensions) or appends .hbs
to extensionless paths. The commit diff and advisory explicitly warn about this pattern, and the CWE-200/CWE-94 mappings confirm improper input validation and information exposure. While the exact internal function name isn't visible in provided data, the core issue manifests in the layout handling logic during rendering.