Vulnerabilities in pkg:npm/ghtml
PACKAGECVE-2024-37166 is a HIGH (CVSS 8.9) cross-site scripting vulnerability (CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)) affecting Ghtml libraries in the npm ecosystem. The issue involves ghtml cross-site scripting (xss) vulnerability. Remediation is available by upgrading affected packages to version 2.0.0.
pkg:npm/ghtml
Vulnerability advisories affecting package pkg:npm/ghtml. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-vvhj-v88f-5gxr | CVE-2024-37166 | HIGH | ghtml Cross-Site Scripting (XSS) vulnerability |
CVE-2024-37166 at a Glance
Security Impact
CVSS: 8.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:L).
How to Fix CVE-2024-37166
To remediate this vulnerability, upgrade all affected Ghtml 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 ghtml@2.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls ghtml
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-37166, inspect your project dependencies using npm:
npm ls ghtml
Analyze the terminal output to locate any version of Ghtml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0), your application is affected.
Note: The npm ls ghtml 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-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages. In Ghtml, 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-2024-37166 Affected Ghtml Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ghtml
|
npm |
< 2.0.0
|
2.0.0
|
References
Frequently Asked Questions
What is CVE-2024-37166?
Which Ghtml versions are affected?
What version fixes CVE-2024-37166?
Is ghtml affected?
What is the CVSS score of CVE-2024-37166?
What CWE is associated with CVE-2024-37166?
How can I check npm dependencies for CVE-2024-37166?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vvhj-v88f-5gxr",
"modified" : "2024-06-11T18:27:52Z",
"published" : "2024-06-10T21:36:48Z",
"aliases" : [ "CVE-2024-37166" ],
"summary" : "ghtml Cross-Site Scripting (XSS) vulnerability",
"details" : "## Summary\n\nIt is possible to introduce user-controlled JavaScript code and trigger a Cross-Site Scripting (XSS) vulnerability in some cases.\n\n## Actions Taken\n\n- Updated the documentation to clarify that while `ghtml` escapes characters with special meaning in HTML, it does not provide comprehensive protection against all types of XSS attacks in every scenario. **_This aligns with the approach taken by other template engines. Developers should be cautious and take additional measures to sanitize user input and prevent potential vulnerabilities._** More reading: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html\n- The backtick character (`) is now also escaped to prevent the creation of strings in most cases where a malicious actor somehow gains the ability to write JavaScript. This does not provide comprehensive protection either.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "ghtml"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/gurgunday/ghtml/security/advisories/GHSA-vvhj-v88f-5gxr"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-37166"
}, {
"type" : "WEB",
"url" : "https://github.com/gurgunday/ghtml/commit/df1ea50fe8968a766fd2b9379a8f9806375227f8"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/gurgunday/ghtml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79", "CWE-80" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-06-10T21:36:48Z",
"nvd_published_at" : "2024-06-10T22:15:12Z"
}
}