Skip to main content

mysql2 CVE-2026-139877

| EUVDEUVD-2026-139548 CRITICAL
SQL Injection (CWE-89)
2026-11-30 disclosure@vulncheck.com GHSA-fx9j-5664-pqx4
9.1
CVSS 4.0 · Vendor: vulncheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Reach app endpoint using mysql2 text query
  2. Delivery
    Submit crafted value through ? placeholder
  3. Exploit
    Driver backslash-escapes quote, server reads it literally
  4. Execution
    String literal closes, appended UNION/SQL executes
  5. Impact
    Disclose or modify unintended database data

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Parameterized queries, prepared statements
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Persistence

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Two concrete conditions must both hold. (1) The MySQL server session must run with NO_BACKSLASH_ESCAPES in its sql_mode - set via my.cnf sql_mode, --sql-mode=, or SET [GLOBAL|SESSION] sql_mode; this is NOT a MySQL default and is outside the attacker's control, which is precisely why CVSS marks AC:H / AT:P. (2) The application must pass attacker-influenced values into the text-protocol path - connection.query() / connection.escape() / SqlString.format() (directly or via an ORM/framework built on them), including the parameterised '... WHERE x = ?' pattern assumed safe. LIMITING FACTORS: connection.execute() (prepared statements) is NOT affected and fully mitigates; if the server does not run NO_BACKSLASH_ESCAPES the specific flaw does not fire; and the attacker cannot themselves enable the required server mode. Realistic impact therefore depends on deployment configuration, not on any default being vulnerable.

Impact

This is a genuine, conditionally-high-priority SQL injection (CWE-89) rather than a CVSS-inflated non-issue, but the single most important qualifier is the precondition. The input carries TWO different scores: NVD's CVSS 4.0 vector (AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N) = 9.1, and the vendor GHSA's CVSS 3.1 (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N) = 7.4 High - the 4.0 framework rates the same facts materially higher, so treat 'severity' as a range, not a point. Both agree on the mechanism: network vector, no privileges or user interaction, high confidentiality AND integrity impact (data disclosure and tampering), no availability impact. Both also encode the catch as high attack complexity (AC:H) and, in 4.0, a present attack requirement (AT:P): the attacker fully controls the payload but the vulnerable state - the server session running with NO_BACKSLASH_ESCAPES in sql_mode - is a deployment configuration they cannot set. The vuln.today decision label is act_now, which is consistent with the confirmed, verified working PoC and the high impact. No EPSS score and no CISA KEV entry are present in the input, so there is no signal of mass or active exploitation - the urgency here is driven by the act_now decision and the published, proven exploit, not by observed in-the-wild activity. Net: where NO_BACKSLASH_ESCAPES is enabled this is a real, patch-now data-exposure/data-tampering flaw reachable through parameterised queries developers believe are safe; where that mode is off (the MySQL default), the specific flaw does not fire. Verify your own server/session sql_mode before downgrading or escalating priority.

Exploit ScenarioDerived

An application on mysql2 <= 3.24.6 talks to a MySQL server whose session runs with NO_BACKSLASH_ESCAPES (set for ANSI/standards compatibility or to store literal backslashes) and passes an attacker-influenced value into connection.query('... WHERE name = ?', [value]). Because mysql2 escapes a quote as \' regardless of SQL mode, the server treats the backslash as literal, the quote closes the string literal, and appended text such as a UNION SELECT runs as SQL - leaking or altering data the query never referenced. A complete, self-contained PoC is published in the GHSA advisory and shown with a verified run leaking a planted secrets-table marker; attack complexity is high only because the attacker depends on that non-default server mode.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.6% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Nov 30, 2026

SQL injection in the npm package mysql2 through 3.24.6 allows crafted values passed through ? placeholders in connection.query() to close string literals and append attacker SQL when the MySQL server session runs with NO_BACKSLASH_ESCAPES in its sql_mode, enabling disclosure or modification of data the statement never intended to select. The root cause is the client-side escaper behind Connection.format() and Connection.escape(), which always emits \' regardless of the session's SQL mode. The bug is conditional, not default-exploitable: the deployment must have enabled NO_BACKSLASH_ESCAPES (outside the attacker's control), and only the text protocol is affected - connection.execute() prepared statements are immune. A public proof-of-concept with a verified run against the released 3.24.6 package and a stock mysql:8.4 server exists, and the vendor fix ships in 3.25.0; the vuln.today priority label is act_now.

RemediationAI

Upgrade mysql2 to 3.25.0 or later, which fixes the escaping to double quotes ('') whenever the server reports the NO_BACKSLASH_ESCAPES status flag (vendor advisory: https://github.com/sidorares/node-mysql2/security/advisories/GHSA-f763-mv98-7rv9, release: https://github.com/sidorares/node-mysql2/releases/tag/v3.25.0). On 3.25.0 and above, additionally set the noBackslashEscapes: true connection option on servers configured with NO_BACKSLASH_ESCAPES so escaping no longer depends on the status the server reports - a defence against pooled connections whose status could be stale. Where upgrading is not immediately possible, replace connection.query()/connection.escape() usage with connection.execute() prepared statements for all attacker-influenced values, including the '... WHERE x = ?' pattern, since the binary protocol path is not affected; the trade-off is that execute() does not support some multi-statement and dynamic-SQL patterns, and ORMs built on the text path must be reconfigured or patched to use it. A further compensating measure is removing NO_BACKSLASH_ESCAPES from the server sql_mode (my.cnf, --sql-mode, or SET GLOBAL/SESSION sql_mode), which eliminates the vulnerable condition entirely but may break applications or standards-compatibility settings that rely on that mode for storing literal backslashes, so it should be validated in staging first.

Affected VersionsENISA

mysql2 0 <3.25.0

Affected Packages

euvd mysql2 fix: 3.25.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The issue is CWE-89 (SQL injection) arising in mysql2's client-side SQL string escaping layer (sql-escaper), not in the server protocol handling itself. When an application calls connection.query(sql, values), the driver substitutes each placeholder via Connection.format() -> SqlString.format() -> SqlString.escape(), which unconditionally renders a single quote as the backslash-escaped form \'. That encoding is only meaningful when the server interprets backslash as an escape character. Under the SQL mode NO_BACKSLASH_ESCAPES the server treats a backslash as an ordinary literal, so a payload such as x\' UNION SELECT secret,2,3 FROM secrets -- terminates the literal at the quote and the trailing text is parsed as SQL, with the appended comment swallowing the quote the driver added. The fix commit ef0dfa494a4fd30d82fa8ce5af3d2e46049d85ea (PR #4684) records the server status flag SERVER_STATUS_NO_BACKSLASH_ESCAPES from the handshake and OK packets, tracks it via connection.serverStatus, and doubles quotes ('') instead when the mode is active; it also formats the statement for the alternate mode so a session-mode change mid-connection is handled, and 3.25.0 adds a noBackslashEscapes connection option (PR #4718) to pin the escaping behaviour. Severity assessments diverge: the feed's CVSS 4.0 vector scores 9.1 with AC:H/AT:P/PR:N/UI:N, the vendor GHSA rates CVSS 3.1 7.4 (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N), and our independent assessment adopts that 7.4 vector - all agree on high confidentiality and integrity impact with no availability impact, and all condition the exploit on deployment configuration rather than an attacker-settable state.

Know when Node.js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (vulncheck) PRIMARY 9.1 CRITICAL
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
vuln.today AI 7.4 HIGH

Network-reachable, no auth or user interaction (PR:N/UI:N), but AC:H because exploitation needs the non-default NO_BACKSLASH_ESCAPES server mode; injection yields data disclosure and tampering (C:H/I:H) without availability loss.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
4.0 AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (vulncheck).

CVSS VectorVendor: vulncheck

Attack Vector
Network
Attack Complexity
High
Attack Requirements
Present
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch available
Nov 30, 2026 - 18:34 EUVD
CVE Published
Nov 30, 2026 - 17:18 cve.org
CRITICAL 9.1

DescriptionCVE.org

mysql2 before 3.25.0 contains an sql injection vulnerability in Connection.format() and Connection.escape() because quotes are always backslash-escaped regardless of session SQL mode. When NO_BACKSLASH_ESCAPES is enabled, attackers can pass crafted values through ? placeholders in connection.query() to close string literals and append SQL, disclosing or modifying data.

Technical POC Analysis

CWE-89 SQL injection.

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Executive ViewAI

Why It Matters

A critical SQL injection flaw in the widely used mysql2 Node.js database library (through version 3.24.6) could let attackers read or alter data beyond what an application's query intended, affecting any service that relies on this driver and operates with a non-default MySQL SQL mode. Leadership should care because the exposure spans application data confidentiality and integrity, and while exploitation is conditional, a verified public proof-of-concept lowers the barrier for opportunistic attackers targeting affected systems.

Business Impact: High
Compensating Controls

Vendor-released patch: 3.25.0

Threat Intelligence Overview

EPSS Score
0.6%
Top 49% exploitable
Prevalence
High
mysql2 is among the most widely used Node.js MySQL drivers (millions of weekly npm installs)
Data Quality
3 sources
Confidence: Low

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.6%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact
High

Priority Score

47
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +46
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

SQL injection exploits the way applications construct database queries by mixing user input directly into SQL statements.

CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2024-35286 CRITICAL POC
9.8 Oct 21

A vulnerability in NuPoint Messenger (NPM) of Mitel MiCollab through 9.8.0.33 allows an unauthenticated attacker to cond

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy