Vulnerabilities in pkg:npm/hbs
PACKAGECVE-2021-32822 is a MODERATE (CVSS 4.0) insertion of sensitive information into vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Hbs libraries in the npm ecosystem. The issue involves insertion of sensitive information into externally-accessible file or directory and exposure of sensitive information to an unauthorized actor in hbs. Remediation is available in the latest vendor maintenance releases.
pkg:npm/hbs
Vulnerability advisories affecting package pkg:npm/hbs. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-7f5c-rpf4-86p8 | CVE-2021-32822 | MODERATE | Insertion of Sensitive Information into Externally-Accessible File or Directory and Exposure of Sensitive Information to an Unauthorized Actor in hbs |
CVE-2021-32822 at a Glance
Security Impact
CVSS: 4.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:N).
How to Fix CVE-2021-32822
To remediate this vulnerability, upgrade all affected Hbs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install hbs@Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls hbs
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-32822, inspect your project dependencies using npm:
npm ls hbs
Analyze the terminal output to locate any version of Hbs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The npm ls hbs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Hbs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-32822 Affected Hbs Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
hbs
|
npm |
≤ 4.1.2
|
|
References
Frequently Asked Questions
What is CVE-2021-32822?
Which Hbs versions are affected?
What version fixes CVE-2021-32822?
Is hbs affected?
What is the CVSS score of CVE-2021-32822?
What CWE is associated with CVE-2021-32822?
How can I check npm dependencies for CVE-2021-32822?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7f5c-rpf4-86p8",
"modified" : "2021-08-26T17:12:06Z",
"published" : "2021-09-02T17:16:46Z",
"aliases" : [ "CVE-2021-32822" ],
"summary" : "Insertion of Sensitive Information into Externally-Accessible File or Directory and Exposure of Sensitive Information to an Unauthorized Actor in hbs",
"details" : "The npm hbs package is an Express view engine wrapper for Handlebars. Depending on usage, users of hbs may be vulnerable to a file disclosure vulnerability. There is currently no patch for this vulnerability. hbs mixes pure template data with engine configuration options through the Express render API. By overwriting internal configuration options a file disclosure vulnerability may be triggered in downstream applications. For an example PoC see the referenced GHSL-2021-020.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "hbs"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "4.1.2"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32822"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pillarjs/hbs"
}, {
"type" : "ADVISORY",
"url" : "https://securitylab.github.com/advisories/GHSL-2021-020-pillarjs-hbs"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200", "CWE-538", "CWE-94" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-08-26T17:12:06Z",
"nvd_published_at" : "2021-08-16T19:15:00Z"
}
}