Skip to content
NewCybercrime Report 2026 · Eight Chapters · A Post Is Not An Incident → Explore The ChaptersCybercrime Report 2026 → Explore

mysql2 NO_BACKSLASH_ESCAPES SQL Injection (CVE-2026-139877)

CVE-2026-139877 is a mysql2 SQL injection flaw affecting Node.js applications that use the driver's text-query path with a MySQL session in NO_BACKSLASH_ESCAPES mode.

Reviewed by
Brandefense Analyst Team
Published
Reading Time
3 min read
CVE ID
CVE-2026-139877
Vendor
sidorares
Affected Product
mysql2 (npm) with MySQL NO_BACKSLASH_ESCAPES
Exploitation
Not confirmed
Published
2026-11-30

The producer's advisory identifies versions through 3.24.6 as affected and 3.25.0 as fixed. Application teams can use the vulnerability intelligence platform as a reference while checking their own driver versions and database settings.The CVE Program's VulnCheck CNA record scores the flaw 9.1 Critical under CVSS 4.0 and 7.4 High under CVSS 3.1. The producer's GHSA displays the 7.4 score and still labels its CVE field “No known CVE.” The CVE Program published CVE-2026-139877 on 30 November 2026, so this profile uses that identifier.

What it allows

How Does CVE-2026-139877 Turn a Placeholder Into SQL Injection?

The producer says connection.query() substitutes placeholder values into SQL on the client and escapes quotes with backslashes. When the MySQL session has NO_BACKSLASH_ESCAPES enabled, the server treats a backslash literally. An attacker-controlled value can then end the intended string and change the SQL statement. This can disclose or modify data, depending on the application's query and database privileges.

The affected path includes connection.query(), connection.escape(), and SqlString.escape() when they format a text-protocol query. The producer says connection.execute() uses prepared statements and is unaffected by this flaw. Its public proof of concept demonstrates data disclosure under the required SQL mode. The SQL injection glossary explains the broader failure mode without replacing this configuration check.

Brandefense Blackhole counted 3 dark-chat items for CVE-2026-139877 from 2026-09-01 to 2026-11-30. The measured unit is a dark-chat item mentioning the CVE identifier.

Who is affected

Which CVE-2026-139877 Installations Are Exposed?

The producer lists every published mysql2 release through 3.24.6 as affected, with 3.25.0 patched. The CVE Program expresses the affected semver range as 0 to before 3.25.0. Exposure also requires a MySQL session with NO_BACKSLASH_ESCAPES and attacker-influenced input reaching the text-query path. A version match alone does not establish that a particular application is exploitable.

Check both the installed mysql2 version and the effective session sql_mode used by each application connection. Review query() calls and wrappers that pass outside input through placeholders, including ORM paths that ultimately call query(). The producer notes that NO_BACKSLASH_ESCAPES is a deployment setting, rather than a MySQL default. The separate pgjdbc simple query mode profile describes another driver-specific SQL injection issue.

Timeline

  1. 2026-11-29

    The producer says it verified a proof of concept against 3.24.6 and the fix commit.

  2. 2026-11-29

    The producer released mysql2 3.25.0 with the NO_BACKSLASH_ESCAPES fix.

  3. 2026-11-30

    The producer published GHSA-f763-mv98-7rv9; VulnCheck published the CVE-2026-139877 record.

What to do

  1. Inventory driver and SQL mode

    Identify applications using mysql2 and record the package version deployed in each environment. Inspect the effective MySQL session sql_mode on application connections, not only the server configuration.

  2. Patch affected applications

    Upgrade mysql2 to 3.25.0 or later wherever an affected release is deployed. Rebuild and redeploy each application, then confirm the running package version is at least 3.25.0.

  3. Set the connection safeguard

    For sessions using NO_BACKSLASH_ESCAPES, consider the producer’s noBackslashEscapes: true connection option after upgrading. Verify that the application’s actual connection configuration sets it where needed.

  4. Reduce exposure while patching

    If immediate upgrade is impossible, use connection.execute() prepared statements for every statement carrying untrusted input, or remove NO_BACKSLASH_ESCAPES from the session mode. Validate application behavior after either change.

  5. Review possible abuse

    Inspect database audit trails and application query errors for unusual reads or modifications through affected query() paths. This is a defensive investigation inferred from the described SQL injection mechanism, not a published detection signature.

What Brandefense can do

Frequently Asked Questions

Does a ? placeholder in connection.query() prevent CVE-2026-139877?

No. The producer says query() formats placeholder values on the client. Under NO_BACKSLASH_ESCAPES, its older quote escaping can let attacker-influenced data change the SQL.

Is connection.execute() affected?

The producer says no. connection.execute() uses prepared statements rather than the affected text-query formatting path.

Which mysql2 release fixes this flaw?

The producer lists 3.25.0 as the patched release. Update and verify the version running inside each application deployment.

Why do the CVSS scores differ?

The VulnCheck CNA record gives 9.1 under CVSS 4.0 and 7.4 under CVSS 3.1. The producer GHSA displays the 7.4 CVSS 3.1 score.

Sources

  1. SQL injection in mysql2 under NO_BACKSLASH_ESCAPESsidorares / GitHub Security Advisory
  2. CVE-2026-139877 CNA recordVulnCheck via CVE Program
  3. mysql2 v3.25.0 releasesidorares
  4. Known Exploited Vulnerabilities catalogCISA
ShareLinkedInX
Brandefense logo

Stay Ahead of Digital Threats.

Take control of your digital security with an exclusive demo of our AI-driven threat intelligence platform.

Open The Full Demo Form →