GHSA-R3RV-JM3R-62Q2
MariaDB Connector/Node.js: SQL injection in the text protocol when the session uses NO_BACKSLASH_ESCAPES
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 3.2.5 | mariadb · -37 d desde divulgación | |
| Remediación | Parche 3.3.4 | mariadb · -37 d desde divulgación | |
| Remediación | Parche 3.4.7 | mariadb · -37 d desde divulgación | |
| Remediación | Parche 3.5.4 | mariadb · -37 d desde divulgación | |
| Divulgación | Publicada | GHSA-R3RV-JM3R-62Q2 divulgada | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice |
### Description
When escaping string and binary parameters for the text protocol, the connector always escaped the quote character with a backslash, without ever consulting the session's NO_BACKSLASH_ESCAPES SQL mode. The server status flag was declared (STATUS_NO_BACKSLASH_ESCAPES) but never read.
Under a server or session running with NO_BACKSLASH_ESCAPES, the backslash is an ordinary character and the quote must be escaped by doubling it. The escaped value produced by the connector therefore closed the string literal, and a value passed through a placeholder was interpreted as SQL.
All text-protocol escaping entry points were affected, including Connection.escape().
### Impact
An attacker able to influence any value the application passes as a query parameter could execute arbitrary SQL with the privileges of the application's database user: read, modify or delete any data reachable by that connection.
Exposure requires a deployment where NO_BACKSLASH_ESCAPES is enabled — server-wide, through the connector's sessionVariables / initSql options, or by an application-issued SET sql_mode. It is not implied by the ANSI, ORACLE or TRADITIONAL compound modes on MariaDB 11.4, so it has to be set deliberately. Where it is enabled, no unusual application code is needed: the standard placeholder API is the injection point.
execute() and batch() are not affected: the binary prepared-statement and bulk protocols send parameter values out of band.
### Resolution
The escaping routines now branch on the session status flag, doubling the quote and leaving the backslash untouched when NO_BACKSLASH_ESCAPES is set
### Workarounds
Use execute() or batch(), or do not enable NO_BACKSLASH_ESCAPES, until upgraded.
### Credit
Reported by fg0x0.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmmariadb |
Corregida | 3.2.5, 3.3.4, 3.4.7, 3.5.4 | -37 d · -37 d · -37 d · -37 d | 3.5.5 no afectada |
3.2.53.3.43.4.73.5.4Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/mariadb-corporation/mariadb-connector-nodejs/security/advisories/GHSA-r3rv-jm3r-62q2https://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/6995c8cf8e51b2ad055de63dcaa4094eebbef5cehttps://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/7670d90949307e735c0ae148d80b3776478a599dhttps://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/95886df9fa0cca991e2be339caa6c3979be61553https://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/e5a9d732d9574177749488336319b73074072779https://hackerone.com/reports/3889197https://github.com/mariadb-corporation/mariadb-connector-nodejshttps://github.com/mariadb-corporation/mariadb-connector-nodejs/releases/tag/3.2.5https://github.com/mariadb-corporation/mariadb-connector-nodejs/releases/tag/3.3.4https://github.com/mariadb-corporation/mariadb-connector-nodejs/releases/tag/3.4.7https://github.com/mariadb-corporation/mariadb-connector-nodejs/releases/tag/3.5.4https://jira.mariadb.org/browse/CONJS-368Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
