CVE-2021-32820 File disclosure in Express Handlebars
Attackers can read arbitrary files with extensions via the layout parameter in Express Handlebars, leading to information disclosure.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-32820?
CVE-2021-32820 is a high-severity path traversal vulnerability in express-handlebars, published on 14 May 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Which versions are affected by CVE-2021-32820?
3 open source packages ship an affected version, including express-handlebars and handlebars. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
express-handlebars npm | All versions | 5.3.1 |
express-handlebars npm | All versions | 5.3.1 |
handlebars Bitnami | All versions | 5.3.3 |
Products include Express Handlebars Project Express Handlebars.
How do I fix CVE-2021-32820?
Upgrade express-handlebars to 5.3.1 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2021-32820 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-32820 exists.
Public exploit code: 1 Nuclei template.
Other vulnerabilities in express-handlebars
Sources
Also known as BIT-handlebars-2021-32820, GHSA-fr76-2wp8-fp92.