Vulnerabilities in pkg:npm/drizzle-orm
PACKAGECVE-2026-39356 is a HIGH (CVSS 7.5) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Drizzle orm libraries in the npm ecosystem. The issue involves drizzle orm has sql injection via improperly escaped sql identifiers. Remediation is available by upgrading affected packages to version 0.45.2, 1.0.0-beta.20.
pkg:npm/drizzle-orm
Vulnerability advisories affecting package pkg:npm/drizzle-orm. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-gpj5-g38j-94v9 | CVE-2026-39356 | HIGH | Drizzle ORM has SQL injection via improperly escaped SQL identifiers |
CVE-2026-39356 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2026-39356
To remediate this vulnerability, upgrade all affected Drizzle orm dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install drizzle-orm@0.45.2
npm install drizzle-orm@1.0.0-beta.20
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls drizzle-orm
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-39356, inspect your project dependencies using npm:
npm ls drizzle-orm
Analyze the terminal output to locate any version of Drizzle orm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.45.2), your application is affected.
Note: The npm ls drizzle-orm command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Drizzle orm, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-39356 Affected Drizzle orm Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
drizzle-orm
|
npm |
< 0.45.2
|
0.45.2
|
|
drizzle-orm
|
npm |
≥ 1.0.0-beta.2
< 1.0.0-beta.20
|
1.0.0-beta.20
|
References
Frequently Asked Questions
What is CVE-2026-39356?
Which Drizzle orm versions are affected?
What version fixes CVE-2026-39356?
Is drizzle-orm affected?
What is the CVSS score of CVE-2026-39356?
What CWE is associated with CVE-2026-39356?
How can I check npm dependencies for CVE-2026-39356?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gpj5-g38j-94v9",
"modified" : "2026-04-08T00:14:58Z",
"published" : "2026-04-08T00:14:58Z",
"aliases" : [ "CVE-2026-39356" ],
"summary" : "Drizzle ORM has SQL injection via improperly escaped SQL identifiers",
"details" : "### Summary\n\nDrizzle 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.\n\nAs 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.\n\n### Affected components\n\nThe issue affects the identifier escaping logic used by the PostgreSQL, MySQL, SQLite, SingleStore, and Gel dialects.\n\n### Impact\n\nThis 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.\n\nDepending 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.\n\nApplications that use only static schema objects, or that strictly map user input through an allowlist of known column or alias names, are not affected.\n\n### Details\n\nIn affected versions, `escapeName()` wrapped the identifier but did not escape the quote delimiter inside the identifier value:\n\n- PostgreSQL / SQLite / Gel: `\"` was not doubled to `\"\"`\n- MySQL / SingleStore: `` ` `` was not doubled to `` `` ``\n\nBecause of this, crafted input containing the dialect-specific identifier delimiter could break out of the quoted identifier and be interpreted as SQL syntax.\n\nA representative vulnerable pattern is dynamic sorting using untrusted input:\n\n```ts\nconst sortField = req.query.sort || 'id';\n\nconst rows = await db\n .select()\n .from(users)\n .orderBy(sql.identifier(sortField));",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "drizzle-orm"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.45.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "drizzle-orm"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.0.0-beta.2"
}, {
"fixed" : "1.0.0-beta.20"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/drizzle-team/drizzle-orm/security/advisories/GHSA-gpj5-g38j-94v9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-39356"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/drizzle-team/drizzle-orm"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-08T00:14:58Z",
"nvd_published_at" : "2026-04-07T20:16:29Z"
}
}