CVE-2021-32817 Details
Description
express-hbs is an Express handlebars template engine. express-hbs mixes pure template data with engine configuration options through the Express render API. More specifically, the layout parameter may trigger file disclosure vulnerabilities in downstream applications. This potential vulnerability is somewhat restricted in that only files with existing extentions (i.e. file.extension) can be included, files that lack an extension will have .hbs appended to them. For complete details refer to the referenced GHSL-2021-019 report. Notes in documentation have been added to help users of express-hbs avoid this potential information exposure vulnerability.
A file disclosure vulnerability has been identified in the Express-HBS template engine, specifically in version 2.1.2. This issue arises because the engine allows configuration options to be mixed with template data through the Express render API. When user-controlled data is passed as options, it can lead to arbitrary file reads from the filesystem. The vulnerability is somewhat limited, as only files with existing extensions can be included; files without an extension will have '.hbs' appended. This issue is particularly concerning because it can be exploited to read sensitive files, depending on the application's implementation.
Users are advised to avoid passing user-submitted data as options to 'res.render', as this can lead to arbitrary file reads. Instead, use the 'restrictLayoutsTo' option in the Express-HBS configuration to limit layout file resolution to a safe directory.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
No SSVC data is available for this CVE.
References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://github.com/TryGhost/express-hbs/commit/ff6fad6e357699412d4e916273314e5e7af1500e | CVE | PatchThird Party Advisory |
| https://github.com/TryGhost/express-hbs#%EF%B8%8F-this-creates-a-potential-security-vulnerability | CVE | Release NotesThird Party Advisory |
| https://securitylab.github.com/advisories/GHSL-2021-019-express-hbs/ | CVE | ExploitPatchThird Party Advisory |
| https://www.npmjs.com/package/express-hbs | CVE | Product |
| https://github.com/TryGhost/express-hbs/commit/ff6fad6e357699412d4e916273314e5e7af1500e | [email protected] | PatchThird Party Advisory |
| https://github.com/TryGhost/express-hbs#%EF%B8%8F-this-creates-a-potential-security-vulnerability | [email protected] | Release NotesThird Party Advisory |
| https://securitylab.github.com/advisories/GHSL-2021-019-express-hbs/ | [email protected] | ExploitPatchThird Party Advisory |
| https://www.npmjs.com/package/express-hbs | [email protected] | Product |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-94 | Improper Control of Generation of Code ('Code Injection') | [email protected] |
| CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| express handlebars project express handlebars | <= 5.3.2 |
CPE
Remediation
| |
Change History
5 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 17, 2026 | CVE Modified | [email protected] |
| Nov 21, 2024 | CVE Modified | CVE |
| May 14, 2024 | CVE Modified | [email protected] |
| Jul 2, 2022 | Reanalysis | [email protected] |
| May 19, 2021 | Initial Analysis | [email protected] |