CVE-2021-32818: Haml coffee Insecure Template Handling Vulnerability
HIGHCVE-2021-32818 is a HIGH (CVSS 7.7) insecure template handling vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Haml coffee libraries in the npm ecosystem. The issue involves insecure template handling in haml-coffee. Remediation is available in the latest vendor maintenance releases.
CVE-2021-32818 at a Glance
Security Impact
CVSS: 7.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N).
How to Fix CVE-2021-32818
To remediate this vulnerability, upgrade all affected Haml coffee 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 haml-coffee@Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls haml-coffee
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-32818, inspect your project dependencies using npm:
npm ls haml-coffee
Analyze the terminal output to locate any version of Haml coffee 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 haml-coffee 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Haml coffee, 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-32818 Affected Haml coffee Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
haml-coffee
|
npm |
≤ 1.14.1
|
|
References
Frequently Asked Questions
What is CVE-2021-32818?
Which Haml coffee versions are affected?
What version fixes CVE-2021-32818?
Is haml-coffee affected?
What is the CVSS score of CVE-2021-32818?
What CWE is associated with CVE-2021-32818?
How can I check npm dependencies for CVE-2021-32818?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-m7mf-vm62-7x3q",
"modified" : "2021-05-17T19:07:00Z",
"published" : "2021-05-17T20:58:21Z",
"aliases" : [ "CVE-2021-32818" ],
"summary" : "Insecure template handling in haml-coffee",
"details" : "haml-coffee is a JavaScript templating solution. haml-coffee mixes pure template data with engine configuration options through the Express render API. More specifically, haml-coffee supports overriding a series of HTML helper functions through its configuration options. A vulnerable application that passes user controlled request objects to the haml-coffee template engine may introduce RCE vulnerabilities. Additionally control over the escapeHtml parameter through template configuration pollution ensures that haml-coffee would not sanitize template inputs that may result in reflected Cross Site Scripting attacks against downstream applications. There is currently no fix for these issues as of the publication of this CVE. The latest version of haml-coffee is currently 1.14.1. For complete details refer to the referenced GHSL-2021-025.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "haml-coffee"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "1.14.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32818"
}, {
"type" : "ADVISORY",
"url" : "https://securitylab.github.com/advisories/GHSL-2021-025-haml-coffee"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/haml-coffee"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-05-17T19:07:00Z",
"nvd_published_at" : "2021-05-14T19:15:00Z"
}
}