CVE-2026-33442: CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in kysely-org kysely
Kysely is a type-safe TypeScript SQL query builder. In versions 0.28.12 and 0.28.13, the `sanitizeStringLiteral` method in Kysely's query compiler escapes single quotes (`'` → `''`) but does not escape backslashes. On MySQL with the default `BACKSLASH_ESCAPES` SQL mode, an attacker can inject a backslash before a single quote to neutralize the escaping, breaking out of the JSON path string literal and injecting arbitrary SQL. Version 0.28.14 fixes the issue.
AI Analysis
Technical Summary
CVE-2026-33442 is an SQL injection vulnerability affecting the Kysely SQL query builder, specifically versions 0.28.12 and 0.28.13. Kysely is a type-safe TypeScript library used to build SQL queries programmatically. The vulnerability stems from the sanitizeStringLiteral method in Kysely's query compiler, which escapes single quotes by doubling them (' → '') but does not escape backslashes. In MySQL databases configured with the default BACKSLASH_ESCAPES SQL mode, a backslash acts as an escape character. An attacker can exploit this by injecting a backslash before a single quote within a JSON path string literal, effectively neutralizing the escaping mechanism. This allows the attacker to break out of the intended string context and inject arbitrary SQL commands. Such injection can lead to unauthorized data access, data modification, or denial of service. The vulnerability does not require authentication or user interaction, increasing its risk. The issue was identified and fixed in Kysely version 0.28.14, which properly handles backslash escaping to prevent injection. No known exploits are reported in the wild yet, but the high CVSS score (8.1) reflects the critical nature of the flaw due to its potential impact and ease of exploitation in vulnerable environments.
Potential Impact
The SQL injection vulnerability in Kysely can have severe consequences for organizations using affected versions with MySQL databases. Exploitation can lead to unauthorized disclosure of sensitive data, data corruption or deletion, and potential full compromise of the database server. Since the vulnerability requires no authentication or user interaction, attackers can remotely exploit it if they can influence query inputs, such as through web applications or APIs using Kysely. This can result in data breaches, loss of data integrity, service outages, and reputational damage. Organizations relying on Kysely for database interactions may face compliance violations if sensitive data is exposed. The impact is amplified in environments where MySQL's default BACKSLASH_ESCAPES mode is enabled, which is common. Given the widespread use of TypeScript and Node.js in modern web applications, many organizations globally could be affected if they use the vulnerable Kysely versions without patching.
Mitigation Recommendations
The primary mitigation is to upgrade Kysely to version 0.28.14 or later, where the vulnerability is fixed by properly escaping backslashes in string literals. Organizations should audit their codebases to identify usage of Kysely versions 0.28.12 or 0.28.13 and plan immediate upgrades. Additionally, developers should review all SQL query constructions to ensure proper parameterization and avoid manual string concatenation. Enforcing the use of parameterized queries or prepared statements can reduce injection risks. Database administrators should verify MySQL SQL modes and consider disabling BACKSLASH_ESCAPES if feasible, although this may impact application compatibility. Implementing Web Application Firewalls (WAFs) with rules to detect and block SQL injection patterns can provide temporary protection. Finally, monitoring database logs for suspicious query patterns and unusual activity can help detect exploitation attempts early.
Affected Countries
United States, Germany, United Kingdom, Canada, Australia, France, Netherlands, Japan, South Korea, India
CVE-2026-33442: CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in kysely-org kysely
Description
Kysely is a type-safe TypeScript SQL query builder. In versions 0.28.12 and 0.28.13, the `sanitizeStringLiteral` method in Kysely's query compiler escapes single quotes (`'` → `''`) but does not escape backslashes. On MySQL with the default `BACKSLASH_ESCAPES` SQL mode, an attacker can inject a backslash before a single quote to neutralize the escaping, breaking out of the JSON path string literal and injecting arbitrary SQL. Version 0.28.14 fixes the issue.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-33442 is an SQL injection vulnerability affecting the Kysely SQL query builder, specifically versions 0.28.12 and 0.28.13. Kysely is a type-safe TypeScript library used to build SQL queries programmatically. The vulnerability stems from the sanitizeStringLiteral method in Kysely's query compiler, which escapes single quotes by doubling them (' → '') but does not escape backslashes. In MySQL databases configured with the default BACKSLASH_ESCAPES SQL mode, a backslash acts as an escape character. An attacker can exploit this by injecting a backslash before a single quote within a JSON path string literal, effectively neutralizing the escaping mechanism. This allows the attacker to break out of the intended string context and inject arbitrary SQL commands. Such injection can lead to unauthorized data access, data modification, or denial of service. The vulnerability does not require authentication or user interaction, increasing its risk. The issue was identified and fixed in Kysely version 0.28.14, which properly handles backslash escaping to prevent injection. No known exploits are reported in the wild yet, but the high CVSS score (8.1) reflects the critical nature of the flaw due to its potential impact and ease of exploitation in vulnerable environments.
Potential Impact
The SQL injection vulnerability in Kysely can have severe consequences for organizations using affected versions with MySQL databases. Exploitation can lead to unauthorized disclosure of sensitive data, data corruption or deletion, and potential full compromise of the database server. Since the vulnerability requires no authentication or user interaction, attackers can remotely exploit it if they can influence query inputs, such as through web applications or APIs using Kysely. This can result in data breaches, loss of data integrity, service outages, and reputational damage. Organizations relying on Kysely for database interactions may face compliance violations if sensitive data is exposed. The impact is amplified in environments where MySQL's default BACKSLASH_ESCAPES mode is enabled, which is common. Given the widespread use of TypeScript and Node.js in modern web applications, many organizations globally could be affected if they use the vulnerable Kysely versions without patching.
Mitigation Recommendations
The primary mitigation is to upgrade Kysely to version 0.28.14 or later, where the vulnerability is fixed by properly escaping backslashes in string literals. Organizations should audit their codebases to identify usage of Kysely versions 0.28.12 or 0.28.13 and plan immediate upgrades. Additionally, developers should review all SQL query constructions to ensure proper parameterization and avoid manual string concatenation. Enforcing the use of parameterized queries or prepared statements can reduce injection risks. Database administrators should verify MySQL SQL modes and consider disabling BACKSLASH_ESCAPES if feasible, although this may impact application compatibility. Implementing Web Application Firewalls (WAFs) with rules to detect and block SQL injection patterns can provide temporary protection. Finally, monitoring database logs for suspicious query patterns and unusual activity can help detect exploitation attempts early.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-03-19T18:45:22.438Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 69c569d6f4197a8e3be94d8c
Added to database: 3/26/2026, 5:16:06 PM
Last enriched: 3/26/2026, 5:31:32 PM
Last updated: 3/26/2026, 8:26:15 PM
Views: 7
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.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
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
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.