Get a Demo

Let's Patch It!

Book a short call with one our specialists, we'll walk you through how Endor Patches work, and ask you a few questions about your environment (like your primary programming languages and repository management). We'll also send you an email right after you fill out the form, feel free to reply with any questions you have in advance!

CVE

CVE-2026-39356

Drizzle ORM has SQL injection via improperly escaped SQL identifiers
Back to all
CVE

CVE-2026-39356

Drizzle ORM has SQL injection via improperly escaped SQL identifiers

Summary

Drizzle ORM improperly escaped quoted SQL identifiers in its dialect-specific escapeName() implementations. In affected versions, embedded identifier delimiters were not escaped before the identifier was wrapped in quotes or backticks.

As a result, applications that pass attacker-controlled input to APIs that construct SQL identifiers or aliases, such as sql.identifier().as(), may allow an attacker to terminate the quoted identifier and inject SQL.

Affected components

The issue affects the identifier escaping logic used by the PostgreSQL, MySQL, SQLite, SingleStore, and Gel dialects.

Impact

This issue only affects applications that pass untrusted runtime input into identifier or alias construction. Common examples include dynamic sorting, dynamic report builders, and CTE or alias names derived from request parameters.

Depending on the database dialect, query context, and database permissions, successful exploitation may enable blind or direct data disclosure, schema enumeration, query manipulation, privilege escalation, or destructive operations.

Applications that use only static schema objects, or that strictly map user input through an allowlist of known column or alias names, are not affected.

Details

In affected versions, escapeName() wrapped the identifier but did not escape the quote delimiter inside the identifier value:

  • PostgreSQL / SQLite / Gel: " was not doubled to ""
  • MySQL / SingleStore:  `  was not doubled to   ``

Because of this, crafted input containing the dialect-specific identifier delimiter could break out of the quoted identifier and be interpreted as SQL syntax.

A representative vulnerable pattern is dynamic sorting using untrusted input:

```ts

const sortField = req.query.sort || 'id';

const rows = await db

  .select()

  .from(users)

  .orderBy(sql.identifier(sortField));

Package Versions Affected

Package Version
patch Availability
No items found.

Automatically patch vulnerabilities without upgrading

Fix Without Upgrading
Detect compatible fix
Apply safe remediation
Fix with a single pull request

CVSS Version

Severity
Base Score
CVSS Version
Score Vector
C
H
U
7.5
-
3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
C
H
U
0
-
3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
C
H
U
7.5
-
3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Related Resources

No items found.

References

https://github.com/drizzle-team/drizzle-orm/security/advisories/GHSA-gpj5-g38j-94v9, https://nvd.nist.gov/vuln/detail/CVE-2026-39356, https://github.com/drizzle-team/drizzle-orm

Severity

7.5

CVSS Score
0
10

Basic Information

Ecosystem
Base CVSS
7.5
EPSS Probability
0.00017%
EPSS Percentile
0.04481%
Introduced Version
0,0.44.3-aca84cf,1.0.0-beta.1-4ec2def,0.43.1-47c6ad4,0.36.4-14e59f4,1.0.0-beta.1-00df263,0.29.2-7ba7903,0.17.0-4e99516,0.28.3-a702909,0.25.0-7c12d10,0.14.1-1c58471,0.12.0-beta.0,0.12.0-beta.40,0.12.0-beta.4,0.12.0-beta.1
Fix Available
0.45.2,1.0.0-beta.20

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading