CVE-2021-32820 is a high-severity (CVSS 8.6) Information Exposure vulnerability in express-handlebars. 2 public exploit references exist, so weaponization risk is real. A fix is available for express-handlebars — see the affected versions and patch details below.
Insecure template handling in Express-handlebars
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2021-32820 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 385,738 CVEs with a current EPSS score, this one falls in the 10–50% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
express-handlebarsReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects npm packages — download data is not available via public APIs for these ecosystems.
Description
Express-handlebars is a Handlebars view engine for Express. Express-handlebars 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 .handlebars appended to them. For complete details refer to the referenced GHSL-2021-018 report. Notes in documentation have been added to help users avoid this potential information exposure vulnerability.
A fix is discussed in https://github.com/express-handlebars/express-handlebars/pull/163
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | express-handlebars | all versions | 5.3.1npm install express-handlebars@5.3.1 |
Affected Products
express handlebarsexpress_handlebars_projectResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for express-handlebars, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update express-handlebars to 5.3.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-32820 is resolved across your whole dependency graph.
Workarounds
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
How to detect CVE-2021-32820
A community-maintained Nuclei template exists for this CVE. You can scan for it directly:
nuclei -id cve-2021-32820 -u https://target- Template
- Express-handlebars - Local File Inclusion
- Severity
- high
- Impact
- An attacker can exploit this vulnerability to read arbitrary files on the server, potentially leading to unauthorized access or sensitive information disclosure.
- Remediation
- Update to the latest version of Express-handlebars to mitigate the vulnerability.
Template by ProjectDiscovery nuclei-templates (dhiyaneshDk), MIT licensed. View the full template. Scan only systems you are authorised to test.
Frequently Asked Questions
Is CVE-2021-32820 in your dependencies?
Find it across npm, including transitive dependencies.