CVE-2026-107385: Mariadb SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-r3rv-jm3r-62q2
CVSS 7.4
CWE-89
Published
Advisory Summary

CVE-2026-107385 is a HIGH (CVSS 7.4) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Mariadb libraries in the npm ecosystem. The issue involves sql injection in the text protocol when the session uses no_backslash_escapes. Remediation is available by upgrading affected packages to version 3.2.5, 3.3.4, 3.4.7, 3.5.4.

CVE-2026-107385 at a Glance

CVE Identifier CVE-2026-107385
GHSA Identifier GHSA-r3rv-jm3r-62q2
Severity HIGH
CVSS v3.1 Base Score 7.4
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Mariadb
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-107385

To remediate this vulnerability, upgrade all affected Mariadb dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mariadb fixed: 3.2.5
npm install mariadb@3.2.5
mariadb fixed: 3.3.4
npm install mariadb@3.3.4
mariadb fixed: 3.4.7
npm install mariadb@3.4.7
mariadb fixed: 3.5.4
npm install mariadb@3.5.4
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 mariadb

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-107385, inspect your project dependencies using npm:

npm ls mariadb

Analyze the terminal output to locate any version of Mariadb in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.2.5), your application is affected.

Note: The npm ls mariadb 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 Mariadb, 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

### Description When escaping string and binary parameters for the text protocol, the connector always escaped the quote character with a backslash, without ever consulting the session's NO_BACKSLASH_ESCAPES SQL mode. The server status flag was declared (STATUS_NO_BACKSLASH_ESCAPES) but never read. Under a server or session running with NO_BACKSLASH_ESCAPES, the backslash is an ordinary character and the quote must be escaped by doubling it. The escaped value produced by the connector therefore closed the string literal, and a value passed through a placeholder was interpreted as SQL. All text-protocol escaping entry points were affected, including Connection.escape(). ### Impact An attacker able to influence any value the application passes as a query parameter could execute arbitrary SQL with the privileges of the application's database user: read, modify or delete any data reachable by that connection. Exposure requires a deployment where NO_BACKSLASH_ESCAPES is enabled — server-wide, through the connector's sessionVariables / initSql options, or by an application-issued SET sql_mode. It is not implied by the ANSI, ORACLE or TRADITIONAL compound modes on MariaDB 11.4, so it has to be set deliberately. Where it is enabled, no unusual application code is needed: the standard placeholder API is the injection point. execute() and batch() are not affected: the binary prepared-statement and bulk protocols send parameter values out of band. ### Resolution The escaping routines now branch on the session status flag, doubling the quote and leaving the backslash untouched when NO_BACKSLASH_ESCAPES is set ### Workarounds Use execute() or batch(), or do not enable NO_BACKSLASH_ESCAPES, until upgraded. ### Credit Reported by fg0x0.

CVE-2026-107385 Affected Mariadb Versions

4 component(s)
Fixed Versions:
3.2.53.3.43.4.73.5.4
Product / Package Ecosystem Affected Versions Fixed Version
mariadb
npm
< 3.2.5
3.2.5
mariadb
npm
≥ 3.3.0
< 3.3.4
3.3.4
mariadb
npm
≥ 3.4.0
< 3.4.7
3.4.7
mariadb
npm
≥ 3.5.0-rc.0
< 3.5.4
3.5.4

References

Frequently Asked Questions

What is CVE-2026-107385?
CVE-2026-107385 is a security vulnerability in Mariadb involving SQL injection in the text protocol when the session uses NO_BACKSLASH_ESCAPES under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Mariadb versions are affected?
Affected versions include releases prior to 3.2.5, 3.3.4, 3.4.7, 3.5.4 across affected packages: mariadb.
What version fixes CVE-2026-107385?
Upgrading to 3.2.5, 3.3.4, 3.4.7, 3.5.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mariadb affected?
Yes, mariadb is affected in releases prior to 3.2.5, 3.3.4, 3.4.7, 3.5.4. Upgrade your dependency to 3.2.5, 3.3.4, 3.4.7, 3.5.4 or later.
What is the CVSS score of CVE-2026-107385?
CVE-2026-107385 has a CVSS v3.1 base score of 7.4 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H.
What CWE is associated with CVE-2026-107385?
CVE-2026-107385 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-107385?
Run the dependency tree command: 'npm ls mariadb'. 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-r3rv-jm3r-62q2",
  "modified" : "2026-10-08T19:42:29Z",
  "published" : "2026-10-08T19:42:28Z",
  "aliases" : [ "CVE-2026-107385" ],
  "summary" : "MariaDB Connector/Node.js: SQL injection in the text protocol when the session uses NO_BACKSLASH_ESCAPES",
  "details" : "### Description\nWhen escaping string and binary parameters for the text protocol, the connector always escaped the quote character with a backslash, without ever consulting the session's NO_BACKSLASH_ESCAPES SQL mode. The server status flag was declared (STATUS_NO_BACKSLASH_ESCAPES) but never read.\n\nUnder a server or session running with NO_BACKSLASH_ESCAPES, the backslash is an ordinary character and the quote must be escaped by doubling it. The escaped value produced by the connector therefore closed the string literal, and a value passed through a placeholder was interpreted as SQL.\n\nAll text-protocol escaping entry points were affected, including Connection.escape().\n\n### Impact\nAn attacker able to influence any value the application passes as a query parameter could execute arbitrary SQL with the privileges of the application's database user: read, modify or delete any data reachable by that connection.\n\nExposure requires a deployment where NO_BACKSLASH_ESCAPES is enabled — server-wide, through the connector's sessionVariables / initSql options, or by an application-issued SET sql_mode. It is not implied by the ANSI, ORACLE or TRADITIONAL compound modes on MariaDB 11.4, so it has to be set deliberately. Where it is enabled, no unusual application code is needed: the standard placeholder API is the injection point.\n\nexecute() and batch() are not affected: the binary prepared-statement and bulk protocols send parameter values out of band.\n\n### Resolution\nThe escaping routines now branch on the session status flag, doubling the quote and leaving the backslash untouched when NO_BACKSLASH_ESCAPES is set\n\n### Workarounds\nUse execute() or batch(), or do not enable NO_BACKSLASH_ESCAPES, until upgraded.\n\n### Credit\nReported by fg0x0.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mariadb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mariadb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.3.0"
      }, {
        "fixed" : "3.3.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mariadb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.4.0"
      }, {
        "fixed" : "3.4.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mariadb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.5.0-rc.0"
      }, {
        "fixed" : "3.5.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs/security/advisories/GHSA-r3rv-jm3r-62q2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/6995c8cf8e51b2ad055de63dcaa4094eebbef5ce"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/7670d90949307e735c0ae148d80b3776478a599d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/95886df9fa0cca991e2be339caa6c3979be61553"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/e5a9d732d9574177749488336319b73074072779"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/3889197"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs/releases/tag/3.2.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs/releases/tag/3.3.4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs/releases/tag/3.4.7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mariadb-corporation/mariadb-connector-nodejs/releases/tag/3.5.4"
  }, {
    "type" : "WEB",
    "url" : "https://jira.mariadb.org/browse/CONJS-368"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-08T19:42:28Z",
    "nvd_published_at" : null
  }
}