CVE-2022-23638: Enshrined/svg sanitize Cross-Site Scripting Vulnerability
MODERATECVE-2022-23638 is a MODERATE (CVSS 6.2) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Enshrined/svg sanitize libraries in the Packagist ecosystem. The issue involves cross-site scripting in enshrined/svg-sanitize. Remediation is available by upgrading affected packages to version 0.15.0.
CVE-2022-23638 at a Glance
Security Impact
CVSS: 6.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2022-23638
To remediate this vulnerability, upgrade all affected Enshrined/svg sanitize dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade enshrined/svg-sanitize to 0.15.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for enshrined/svg-sanitize
How to Check if You Are Affected
To determine whether your application is affected by CVE-2022-23638, inspect your project dependencies for Enshrined/svg sanitize:
inspect dependencies for enshrined/svg-sanitize
Analyze the terminal output to locate any version of Enshrined/svg sanitize in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.15.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
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 Enshrined/svg sanitize, 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-2022-23638 Affected Enshrined/svg sanitize Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
enshrined/svg-sanitize
|
Packagist |
< 0.15.0
|
0.15.0
|
References
Frequently Asked Questions
What is CVE-2022-23638?
Which Enshrined/svg sanitize versions are affected?
What version fixes CVE-2022-23638?
Is enshrined/svg-sanitize affected?
What is the CVSS score of CVE-2022-23638?
What CWE is associated with CVE-2022-23638?
How can I check Packagist dependencies for CVE-2022-23638?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-fqx8-v33p-4qcc",
"modified" : "2022-03-09T23:27:04Z",
"published" : "2022-02-14T22:54:18Z",
"aliases" : [ "CVE-2022-23638" ],
"summary" : "Cross-site Scripting in enshrined/svg-sanitize",
"details" : "### Impact\nSVG sanitizer library before version `0.15.0` did not remove HTML elements wrapped in a CDATA section. As a result, SVG content embedded in HTML (fetched as `text/html`) was susceptible to cross-site scripting. Plain SVG files (fetched as `image/svg+xml`) were not affected.\n\n### Patches\nThis issue is fixed in `0.15.0` and higher.\n\n### Workarounds\nThere is currently no workaround available without upgrading.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [Github](https://github.com/darylldoyle/svg-sanitizer/issues)\n* Email us at [daryll@enshrined.co.uk](mailto:daryll@enshrined.co.uk)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "enshrined/svg-sanitize"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.15.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/darylldoyle/svg-sanitizer/security/advisories/GHSA-fqx8-v33p-4qcc"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23638"
}, {
"type" : "WEB",
"url" : "https://github.com/darylldoyle/svg-sanitizer/issues/71"
}, {
"type" : "WEB",
"url" : "https://github.com/darylldoyle/svg-sanitizer/commit/17e12ba9c2881caa6b167d0fbea555c11207fbb0"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/enshrined/svg-sanitize/CVE-2022-23638.yaml"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-fqx8-v33p-4qcc"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/darylldoyle/svg-sanitizer"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-02-14T22:54:18Z",
"nvd_published_at" : "2022-02-14T21:15:00Z"
}
}