# CVE-2026-139877: mysql2 before 3.25.0 SQL Injection via Placeholder Escaping under NO_BACKSLASH_ESCAPES

- Severity: Critical 9.1 (CVSS:4.0, scored by VulnCheck) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.63%, higher than 51% of CVEs (2026-12-01)
- Published: 2026-11-30T16:20:44.034Z
- Modified: 2026-11-30T17:18:52.200Z
- Weaknesses: CWE-89
- Assigned by: VulnCheck

## Description

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.

(As written by CVE List.)

## Affected

- sidorares mysql2: before 3.25.0

## Every score

- VulnCheck: CVSS:4.0 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`
- VulnCheck: CVSS:3.1 7.4 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N`

## References

- <https://github.com/sidorares/node-mysql2/security/advisories/GHSA-f763-mv98-7rv9> (vendor-advisory)
- <https://github.com/sidorares/node-mysql2/commit/ef0dfa494a4fd30d82fa8ce5af3d2e46049d85ea> (patch)
- <https://github.com/sidorares/node-mysql2/releases/tag/v3.25.0> (release-notes)
- <https://github.com/sidorares/node-mysql2/blob/v3.24.6/lib/base/connection.js#L648-L675> (technical-description)
- <https://www.vulncheck.com/advisories/mysql2-before-3.25.0-sql-injection-via-placeholder-escaping-under-no-backslash-escapes> (third-party-advisory)

## Sources

- CVE List: [CVE-2026-139877](https://www.cve.org/CVERecord?id=CVE-2026-139877), CVE Terms of Use, modified 2026-11-30
- NVD: [CVE-2026-139877](https://nvd.nist.gov/vuln/detail/CVE-2026-139877), Public domain, modified 2026-11-30

---

Page: https://cve.day/CVE-2026-139877 · Whole record: https://cve.day/CVE-2026-139877.json · Rebuilt by cve.day 2026-11-30T17:32:19.355Z
