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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| sidorares | mysql2 | < 3.25.0 | 3.25.0 |
References
- GitHub Security Advisory (GHSA-f763-mv98-7rv9) vendor-advisory
- https://github.com/sidorares/node-mysql2/commit/ef0dfa494a4fd30d82fa8ce5af3d2e46049d85ea patch
- mysql2 v3.25.0 Release Notes release-notes
- https://github.com/sidorares/node-mysql2/blob/v3.24.6/lib/base/connection.js#L648-L675 technical-description
- VulnCheck Advisory: mysql2 before 3.25.0 SQL Injection via Placeholder Escaping under NO_BACKSLASH_ESCAPES third-party-advisory