CVE-2026-33442

Kysely has a MySQL SQL Injection via Backslash Escape Bypass in non-type-safe usage of JSON path keys.

Published Mar 26, 2026 CVSS 3.1 · 8.1 High EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

Kysely’s query compiler contains a flaw in the sanitizeStringLiteral method that only escapes single quotes but leaves backslashes untouched. On MySQL databases running the default BACKSLASH_ESCAPES mode, an attacker can prepend a backslash to an input string, neutralizing the escape of a following single quote. This allows the attacker to terminate the JSON path string literal and inject arbitrary SQL statements through the query builder, potentially causing unauthorized data disclosure or modification. The defect is a classic SQL injection weakness described by CWE‑89.

Affected Systems

The affected product is Kysely, maintained by kysely‑org. Versions 0.28.12 and 0.28.13 are vulnerable when used with a MySQL backend that has the default BACKSLASH_ESCAPES mode enabled. All applications that rely on these library versions to build SQL queries from user‑supplied JSON path keys are at risk. The issue was remedied in version 0.28.14, which now properly escapes backslashes.

Risk and Exploitability

The vulnerability scores 8.1 on the CVSS scale, indicating a high severity of potential impact. EPSS analysis shows the probability of exploitation is below 1%, and it is not listed in the CISA Known Exploited Vulnerabilities catalog. Based on the description, the likely attack vector involves an application that constructs dynamic SQL using JSON path keys, where an attacker can supply a crafted input to the underlying query builder. While exploitation enables arbitrary SQL execution, it requires the vulnerable library version and integration with a MySQL database running the default BACKSLASH_ESCAPES mode.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Kysely to version 0.28.14 or later.
  • Verify that the deployed version is not 0.28.12 or 0.28.13 and that the MySQL instance uses the default BACKSLASH_ESCAPES mode as described.

Generated by OpenCVE AI on April 1, 2026 at 07:09 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-fr9j-6mvq-frcv Kysely has a MySQL SQL Injection via Backslash Escape Bypass in non-type-safe usage of JSON path keys.
History
Type Values Removed Values Added
First Time appeared Kysely
Kysely kysely
CPEs cpe:2.3:a:kysely:kysely:*:*:*:*:*:node.js:*:*
Vendors & Products Kysely
Kysely kysely
Type Values Removed Values Added
First Time appeared Kysely-org
Kysely-org kysely
Vendors & Products Kysely-org
Kysely-org kysely
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
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.
Title Kysely has a MySQL SQL Injection via Backslash Escape Bypass in non-type-safe usage of JSON path keys.
Weaknesses CWE-89
References
Metrics cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H'}

Weaknesses
  • CWE-89

    Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Mar 26, 2026, 6:47 PM
Reserved
Mar 19, 2026, 6:45 PM
Status
Analyzed
Published
Mar 26, 2026, 5:16 PM
Modified
Jun 17, 2026, 10:37 AM