Mysql2: sql injection
HighAI-generated2026-12-01
- CVE
- CVE-2026-139877
- Severity
- High (CVSS 7.4)
- Attack conditions
- Remotely, over the network · No account needed · No user action needed
Summary
The mysql2 library versions prior to 3.25.0 are vulnerable to SQL injection. An attacker can craft input that bypasses escaping and execute arbitrary database commands.
Details
According to the NVD record, the mysql2 library before version 3.25.0 has an SQL injection flaw in its Connection.format() and Connection.escape() functions. The code always backslash-escapes quotes, even when the database session disables backslash escapes.
When the NO_BACKSLASH_ESCAPES mode is active, an attacker can supply specially crafted values through the ? placeholders in connection.query(). This allows them to close string literals and inject additional SQL statements, leading to data disclosure or modification.
What to do
The source record does not name a specific patch, fixed version or workaround. General measures:
- Follow the vendor's security advisories.
- Apply the update when it is released.
- Limit access to the product as much as possible, especially from the internet.
Sources
Timeline
- 30 November 2026 NVD record published
- 1 December 2026 This article was written