Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-27120: CWE-75: Failure to Sanitize Special Elements into a Different Plane (Special Element Injection) in vapor leaf-kit

0
Medium
VulnerabilityCVE-2026-27120cvecve-2026-27120cwe-75cwe-79cwe-87
Published: Fri Feb 20 2026 (02/20/2026, 21:27:09 UTC)
Source: CVE Database V5
Vendor/Project: vapor
Product: leaf-kit

Description

Leafkit is a templating language with Swift-inspired syntax. Prior to 1.4.1, htmlEscaped in leaf-kit will only escape html special characters if the extended grapheme clusters match, which allows bypassing escaping by using an extended grapheme cluster containing both the special html character and some additional characters. In the case of html attributes, this can lead to XSS if there is a leaf variable in the attribute that is user controlled. This vulnerability is fixed in 1.4.1.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 02/28/2026, 12:37:55 UTC

Technical Analysis

CVE-2026-27120 is a vulnerability in leaf-kit, a templating language with Swift-inspired syntax used primarily in the vapor web framework. The root cause is the improper sanitization of special HTML characters in the htmlEscaped function prior to version 1.4.1. Specifically, htmlEscaped only escapes HTML special characters if the extended grapheme clusters exactly match known characters. However, attackers can craft extended grapheme clusters that combine a special HTML character with additional characters, effectively bypassing the escaping mechanism. This flaw is particularly dangerous when leaf variables that are user-controlled are injected into HTML attributes, as it can lead to cross-site scripting (XSS) attacks. XSS vulnerabilities allow attackers to execute arbitrary JavaScript in the context of the victim's browser, potentially stealing session tokens, performing actions on behalf of the user, or defacing web content. The vulnerability is classified under CWE-75 (Failure to Sanitize Special Elements into a Different Plane), CWE-79 (Improper Neutralization of Input During Web Page Generation), and CWE-87 (Improper Neutralization of Special Elements). The issue requires no privileges to exploit but does require user interaction, such as visiting a maliciously crafted page. The scope is considered changed since the vulnerability affects the confidentiality and integrity of data processed by the web application. The vulnerability was published on February 20, 2026, and fixed in leaf-kit version 1.4.1. No known exploits have been reported in the wild to date.

Potential Impact

Organizations using leaf-kit versions prior to 1.4.1 in their web applications are at risk of cross-site scripting attacks. Successful exploitation could allow attackers to execute arbitrary JavaScript in users' browsers, leading to theft of sensitive information such as authentication tokens, user credentials, or personal data. It could also enable session hijacking, unauthorized actions on behalf of users, or defacement of web content. This undermines user trust and can lead to reputational damage, regulatory penalties, and financial losses. Since leaf-kit is often used in server-side Swift applications, the impact is particularly relevant to organizations leveraging the vapor framework for web services. The vulnerability does not affect availability directly but compromises confidentiality and integrity. The ease of exploitation is moderate due to the requirement of user interaction and crafting of specific extended grapheme clusters. The absence of authentication requirements increases the risk surface, especially for public-facing applications.

Mitigation Recommendations

The primary mitigation is to upgrade leaf-kit to version 1.4.1 or later, where the vulnerability is fixed. Developers should audit their codebases to identify any usage of leaf-kit versions prior to 1.4.1 and plan immediate upgrades. Additionally, implement defense-in-depth by applying Content Security Policy (CSP) headers to restrict script execution and reduce the impact of potential XSS attacks. Input validation and output encoding should be reviewed to ensure no user-controlled data is injected into HTML attributes without proper escaping. Security teams should conduct penetration testing focusing on XSS vectors involving extended grapheme clusters. Monitoring web application logs for suspicious input patterns or unusual user behavior can help detect exploitation attempts. Finally, educating developers about the nuances of Unicode grapheme clusters and their impact on escaping mechanisms can prevent similar issues in the future.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-02-17T18:42:27.043Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 6998d2dfbe58cf853bb9b97b

Added to database: 2/20/2026, 9:32:15 PM

Last enriched: 2/28/2026, 12:37:55 PM

Last updated: 4/7/2026, 6:52:13 AM

Views: 47

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses