Vulnerabilities in pkg:npm/drizzle-orm

PACKAGE
Advisory Identifier: GHSA-gpj5-g38j-94v9
Advisory Summary

CVE-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.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/drizzle-orm

1 Known Advisory Record(s)

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

CVE Identifier CVE-2026-39356
GHSA Identifier GHSA-gpj5-g38j-94v9
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Drizzle orm
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (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.

drizzle-orm fixed: 0.45.2
npm install drizzle-orm@0.45.2
drizzle-orm fixed: 1.0.0-beta.20
npm install drizzle-orm@1.0.0-beta.20
Verify Direct and Transitive Dependencies

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

### 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));

CVE-2026-39356 Affected Drizzle orm Versions

2 component(s)
Fixed Versions:
0.45.21.0.0-beta.20
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?
CVE-2026-39356 is a security vulnerability in Drizzle orm involving Drizzle ORM has SQL injection via improperly escaped SQL identifiers under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Drizzle orm versions are affected?
Affected versions include releases prior to 0.45.2, 1.0.0-beta.20 across affected packages: drizzle-orm.
What version fixes CVE-2026-39356?
Upgrading to 0.45.2, 1.0.0-beta.20 (or the latest patched release for your respective branch) resolves the vulnerability.
Is drizzle-orm affected?
Yes, drizzle-orm is affected in releases prior to 0.45.2, 1.0.0-beta.20. Upgrade your dependency to 0.45.2, 1.0.0-beta.20 or later.
What is the CVSS score of CVE-2026-39356?
CVE-2026-39356 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-39356?
CVE-2026-39356 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (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.).
How can I check npm dependencies for CVE-2026-39356?
Run the dependency tree command: 'npm ls drizzle-orm'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}