CVE-2026-33442: Kysely MySQL SQL Injection via Backslash Escape Bypass

kysely Updated 20 Mar 2026

Summary

20/03/2026
Yes i
High
8.1

CVE-2026-33442: Kysely has a MySQL SQL Injection via Backslash Escape Bypass in non-type-safe usage of JSON path keys. Affects kysely versions >= 0.28.12, < 0.28.14. Fixed in 0.28.14. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Kysely is a type-safe SQL query builder for TypeScript that allows developers to construct SQL queries using a fluent API. It supports various databases, including MySQL, PostgreSQL, and SQLite. The package is designed to provide a seamless experience for building complex queries while ensuring type safety. However, a vulnerability has been identified that affects its JSON path builder functionality when used with MySQL, specifically in the context of backslash escape handling.

Vulnerability Detail

The vulnerability arises from the sanitizeStringLiteral method in Kysely's query compiler, which escapes single quotes but fails to escape backslashes. In MySQL's default BACKSLASH_ESCAPES mode, this oversight allows an attacker to inject a backslash before a single quote, effectively neutralizing the escaping mechanism. This leads to SQL injection vulnerabilities, enabling attackers to execute arbitrary SQL commands, potentially leading to data exfiltration, modification, or even full database compromise. The vulnerability is particularly critical as it can be exploited through user-controlled input passed to the .key() JSON path builder API.

How To Fix

Latest published version: 0.29.7 as of 23 Oct 2026

npm install kysely@0.29.7

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.28.14

This is the first release that contains the fix.

npm install kysely@0.28.14

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate upgrading is not feasible, a temporary workaround is to manually sanitize user inputs before passing them to the .key() method. For example, you can replace backslashes and single quotes in user input as follows:

const sanitizedInput = 

userInput.

replace(/\/g, '\\\\').replace(/'/g, "''");

This will help mitigate the risk until the package can be updated.

Conclusion

The vulnerability CVE-2026-33442 in Kysely poses a significant risk for applications using MySQL, allowing for SQL injection attacks through improper handling of backslashes. It is crucial to update to the latest version to mitigate this risk. Additionally, using Vulert can help monitor and alert for such vulnerabilities in real-time.

See every vulnerability recorded for kysely →

Share this vulnerability

FAQ

CVE-2026-33442 is a vulnerability in the Kysely package that allows SQL injection through improper handling of backslashes in JSON path keys when used with MySQL.

You can check if your application is affected by using Vulert, which monitors open-source vulnerabilities in your software. Simply upload your package-lock.json file to the Vulert playground.

The vulnerability can lead to SQL injection, allowing attackers to read, modify, or delete data, and potentially compromise the entire database.

You can update Kysely to the patched version by running the command: npm install kysely@0.28.14 in your project directory.

Yes, you can sanitize user inputs by replacing backslashes and single quotes before passing them to the .key() method as a temporary workaround.

Related vulnerabilities

Recent vulnerabilities recorded for kysely.

How To Fix

Latest published version: 0.29.7 as of 23 Oct 2026

npm install kysely@0.29.7

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.28.14

This is the first release that contains the fix.

npm install kysely@0.28.14

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback