CVE-2022-23647: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in PrismJS prism
Prism is a syntax highlighting library. Starting with version 1.14.0 and prior to version 1.27.0, Prism's command line plugin can be used by attackers to achieve a cross-site scripting attack. The command line plugin did not properly escape its output, leading to the input text being inserted into the DOM as HTML code. Server-side usage of Prism is not impacted. Websites that do not use the Command Line plugin are also not impacted. This bug has been fixed in v1.27.0. As a workaround, do not use the command line plugin on untrusted inputs, or sanitize all code blocks (remove all HTML code text) from all code blocks that use the command line plugin.
AI Analysis
Technical Summary
CVE-2022-23647 is a cross-site scripting (XSS) vulnerability identified in the PrismJS syntax highlighting library, specifically affecting the command line plugin versions from 1.14.0 up to but not including 1.27.0. PrismJS is widely used for client-side syntax highlighting in web applications and documentation sites. The vulnerability arises because the command line plugin fails to properly escape or sanitize user input before inserting it into the DOM as HTML code. This improper neutralization of input (CWE-79) allows an attacker to inject malicious scripts into web pages that use the vulnerable plugin with untrusted inputs. Notably, server-side usage of PrismJS is not affected, and websites that do not utilize the command line plugin are also not vulnerable. The issue was addressed and fixed in version 1.27.0 of PrismJS. Until upgrading, mitigations include avoiding the use of the command line plugin on untrusted inputs or sanitizing all code blocks to remove any embedded HTML code before rendering. There are no known exploits in the wild reported to date. The vulnerability primarily impacts client-side web applications that incorporate the vulnerable PrismJS plugin and process untrusted input for syntax highlighting, potentially enabling attackers to execute arbitrary JavaScript in the context of the victim's browser session.
Potential Impact
For European organizations, this vulnerability poses a moderate risk primarily to web applications that embed PrismJS with the vulnerable command line plugin and accept untrusted user input for syntax highlighting. Successful exploitation could lead to the execution of arbitrary scripts in users' browsers, resulting in session hijacking, credential theft, defacement, or redirection to malicious sites. This could undermine user trust, lead to data breaches, or facilitate further attacks such as phishing or malware distribution. Organizations in sectors with high web presence—such as e-commerce, media, education, and government—may be particularly impacted if they use the vulnerable plugin without proper input sanitization. However, the scope is limited to client-side usage of the command line plugin, and server-side PrismJS implementations are unaffected. The lack of known active exploitation reduces immediate risk but does not eliminate the potential for targeted attacks. The impact on confidentiality and integrity is moderate, while availability impact is minimal unless combined with other attack vectors.
Mitigation Recommendations
European organizations should take the following specific steps to mitigate this vulnerability: 1) Identify all web applications and services using PrismJS, particularly versions between 1.14.0 and 1.27.0, and verify if the command line plugin is in use. 2) Upgrade PrismJS to version 1.27.0 or later, which contains the fix for this vulnerability. 3) If immediate upgrade is not feasible, disable the command line plugin or avoid processing untrusted input through it. 4) Implement rigorous input sanitization on all code blocks passed to the command line plugin, removing any embedded HTML or script tags before rendering. 5) Conduct security reviews and penetration testing focused on XSS vectors in affected applications. 6) Educate developers about safe usage patterns of PrismJS and the risks of client-side script injection. 7) Monitor web application logs and user reports for suspicious activity that could indicate attempted exploitation. These steps go beyond generic advice by emphasizing plugin-specific controls, version auditing, and input sanitization tailored to the PrismJS command line plugin context.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Italy, Spain
CVE-2022-23647: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in PrismJS prism
Description
Prism is a syntax highlighting library. Starting with version 1.14.0 and prior to version 1.27.0, Prism's command line plugin can be used by attackers to achieve a cross-site scripting attack. The command line plugin did not properly escape its output, leading to the input text being inserted into the DOM as HTML code. Server-side usage of Prism is not impacted. Websites that do not use the Command Line plugin are also not impacted. This bug has been fixed in v1.27.0. As a workaround, do not use the command line plugin on untrusted inputs, or sanitize all code blocks (remove all HTML code text) from all code blocks that use the command line plugin.
AI-Powered Analysis
Technical Analysis
CVE-2022-23647 is a cross-site scripting (XSS) vulnerability identified in the PrismJS syntax highlighting library, specifically affecting the command line plugin versions from 1.14.0 up to but not including 1.27.0. PrismJS is widely used for client-side syntax highlighting in web applications and documentation sites. The vulnerability arises because the command line plugin fails to properly escape or sanitize user input before inserting it into the DOM as HTML code. This improper neutralization of input (CWE-79) allows an attacker to inject malicious scripts into web pages that use the vulnerable plugin with untrusted inputs. Notably, server-side usage of PrismJS is not affected, and websites that do not utilize the command line plugin are also not vulnerable. The issue was addressed and fixed in version 1.27.0 of PrismJS. Until upgrading, mitigations include avoiding the use of the command line plugin on untrusted inputs or sanitizing all code blocks to remove any embedded HTML code before rendering. There are no known exploits in the wild reported to date. The vulnerability primarily impacts client-side web applications that incorporate the vulnerable PrismJS plugin and process untrusted input for syntax highlighting, potentially enabling attackers to execute arbitrary JavaScript in the context of the victim's browser session.
Potential Impact
For European organizations, this vulnerability poses a moderate risk primarily to web applications that embed PrismJS with the vulnerable command line plugin and accept untrusted user input for syntax highlighting. Successful exploitation could lead to the execution of arbitrary scripts in users' browsers, resulting in session hijacking, credential theft, defacement, or redirection to malicious sites. This could undermine user trust, lead to data breaches, or facilitate further attacks such as phishing or malware distribution. Organizations in sectors with high web presence—such as e-commerce, media, education, and government—may be particularly impacted if they use the vulnerable plugin without proper input sanitization. However, the scope is limited to client-side usage of the command line plugin, and server-side PrismJS implementations are unaffected. The lack of known active exploitation reduces immediate risk but does not eliminate the potential for targeted attacks. The impact on confidentiality and integrity is moderate, while availability impact is minimal unless combined with other attack vectors.
Mitigation Recommendations
European organizations should take the following specific steps to mitigate this vulnerability: 1) Identify all web applications and services using PrismJS, particularly versions between 1.14.0 and 1.27.0, and verify if the command line plugin is in use. 2) Upgrade PrismJS to version 1.27.0 or later, which contains the fix for this vulnerability. 3) If immediate upgrade is not feasible, disable the command line plugin or avoid processing untrusted input through it. 4) Implement rigorous input sanitization on all code blocks passed to the command line plugin, removing any embedded HTML or script tags before rendering. 5) Conduct security reviews and penetration testing focused on XSS vectors in affected applications. 6) Educate developers about safe usage patterns of PrismJS and the risks of client-side script injection. 7) Monitor web application logs and user reports for suspicious activity that could indicate attempted exploitation. These steps go beyond generic advice by emphasizing plugin-specific controls, version auditing, and input sanitization tailored to the PrismJS command line plugin context.
Affected Countries
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2022-01-19T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9842c4522896dcbf25e6
Added to database: 5/21/2025, 9:09:22 AM
Last enriched: 6/23/2025, 4:02:44 PM
Last updated: 2/7/2026, 10:46:02 AM
Views: 41
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2026-2083: SQL Injection in code-projects Social Networking Site
MediumCVE-2026-2082: OS Command Injection in D-Link DIR-823X
MediumCVE-2026-2080: Command Injection in UTT HiPER 810
HighCVE-2026-2079: Improper Authorization in yeqifu warehouse
MediumCVE-2026-1675: CWE-1188 Initialization of a Resource with an Insecure Default in brstefanovic Advanced Country Blocker
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.