CVE-2023-38687: Svelecte Svelecte Item Names Vulnerable To Vulnerability
MODERATECVE-2023-38687 is a MODERATE (CVSS 5.4) svelecte item names vulnerable to vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Svelecte libraries in the npm ecosystem. The issue involves svelecte item names vulnerable to execution of arbitrary javascript. Remediation is available by upgrading affected packages to version 3.16.3.
CVE-2023-38687 at a Glance
Security Impact
CVSS: 5.4
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:L/I:L/A:N).
How to Fix CVE-2023-38687
To remediate this vulnerability, upgrade all affected Svelecte 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 svelecte@3.16.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls svelecte
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2023-38687, inspect your project dependencies using npm:
npm ls svelecte
Analyze the terminal output to locate any version of Svelecte in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.16.3), your application is affected.
Note: The npm ls svelecte 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 Svelecte, 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-2023-38687 Affected Svelecte Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
svelecte
|
npm |
< 3.16.3
|
3.16.3
|
References
Frequently Asked Questions
What is CVE-2023-38687?
Which Svelecte versions are affected?
What version fixes CVE-2023-38687?
Is svelecte affected?
What is the CVSS score of CVE-2023-38687?
What CWE is associated with CVE-2023-38687?
How can I check npm dependencies for CVE-2023-38687?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7h45-grc5-89wq",
"modified" : "2023-08-14T21:14:08Z",
"published" : "2023-08-14T21:14:08Z",
"aliases" : [ "CVE-2023-38687" ],
"summary" : "Svelecte item names vulnerable to execution of arbitrary JavaScript",
"details" : "### Summary\n\nSvelecte item names are rendered as raw HTML with no escaping. This allows the injection of arbitrary HTML into the Svelecte dropdown. This can be exploited to execute arbitrary JavaScript whenever a Svelecte dropdown is opened.\n\n### Details\n\nItem names given to Svelecte appear to be directly rendered as HTML by the default item renderer. This means that any HTML tags in the name are rendered as HTML elements not as text.\n\nNote that the custom item renderer shown in https://mskocik.github.io/svelecte/#item-rendering is also vulnerable to the same exploit.\n\nTo prevent this all special HTML characters in item names should be escaped (for example using `document.createTextNode()`).\n\n### PoC\n```svelte\n<script>\n import Svelecte from 'svelecte';\n \n const list = [\n { id: 1, name: `Item 1` },\n { id: 2, name: `Item 2<img style=\"display:none;\" src=1 onerror=\"alert('JavaScript executed!');\"/>` },\n { id: 3, name: 'Item 3'}\n ];\n</script>\n \n<Svelecte options={list}></Svelecte>\n```\n\nThis code snippet demonstrates how the vulnerability can be used to execute arbitrary JavaScript without the user's knowledge when the Svelecte dropdown is opened (note that visually item 2 appears identical to other items).\nIn this case the script is hardcoded, but in practice the real danger is that some applications may use Svelecte with items that are created by users or come from low-trust sources where someone else could add a malicious script to the item name.\n\n### Impact\n\nAny site that uses Svelecte with dynamically created items either from an external source or from user-created content could be vulnerable to an XSS attack (execution of untrusted JavaScript), clickjacking or any other attack that can be performed with arbitrary HTML injection.\nThe actual impact of this vulnerability for a specific application depends on how trustworthy the sources that provide Svelecte items are and the steps that the application has taken to mitigate XSS attacks. XSS attacks using this vulnerability are mostly mitigated by a Content Security Policy that blocks inline JavaScript.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "svelecte"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.16.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/mskocik/svelecte/security/advisories/GHSA-7h45-grc5-89wq"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-38687"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/mskocik/svelecte"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-08-14T21:14:08Z",
"nvd_published_at" : "2023-08-14T21:15:12Z"
}
}