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.
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:
const sortField = req.query.sort || 'id';
const rows = await db
.select()
.from(users)
.orderBy(sql.identifier(sortField));
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.
Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access. Typical impact: data disclosure or modification.
CVE-2026-39356 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.45.2, 1.0.0-beta.20); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
drizzle-orm to 0.45.2 or later; drizzle-orm to 1.0.0-beta.20 or later
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-39356? CVE-2026-39356 is a high-severity SQL injection vulnerability in drizzle-orm (npm), affecting versions < 0.45.2. It is fixed in 0.45.2, 1.0.0-beta.20. Untrusted input alters a database query, allowing the attacker to read or modify data the query was not intended to access.
- How severe is CVE-2026-39356? CVE-2026-39356 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of drizzle-orm are affected by CVE-2026-39356? drizzle-orm (npm) versions < 0.45.2 is affected.
- Is there a fix for CVE-2026-39356? Yes. CVE-2026-39356 is fixed in 0.45.2, 1.0.0-beta.20. Upgrade to this version or later.
- Is CVE-2026-39356 exploitable, and should I be worried? Whether CVE-2026-39356 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-39356 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-39356?
- Upgrade
drizzle-ormto 0.45.2 or later - Upgrade
drizzle-ormto 1.0.0-beta.20 or later
- Upgrade