CVE-2026-55855: MariaDB Connector/Node.js: Possible SQL injection in Buffer parameter escaping under big5/gbk/sjis/cp932/gb18030 client charsets

Published Aug 28, 2026
·
Updated

Summary

A SQL injection is possible when the connector escapes Buffer parameters client-side under a multi-byte client character set whose trail-byte range overlaps the ASCII backslash (0x5C): big5, gbk, sjis, cp932, and gb18030. Under these charsets, an attacker-controlled lead byte can absorb the escape byte the connector inserts, leaving the following quote unescaped so it terminates the string literal and injected SQL is parsed.

Details

When binding a Buffer (binary) parameter, the connector escapes the value byte-by-byte, inserting a backslash (0x5C) before quote (0x27) and backslash bytes. This is correct under single-byte and UTF-8–family charsets, but unsafe under client charsets whose multi-byte trail-byte range includes 0x5C.

On the server, the SQL lexer performs multi-byte character recognition (myismbchar) before it interprets escape sequences. If charactersetclient is one of the affected charsets and the attacker controls a byte the lexer treats as a valid lead byte, the sequence <lead-byte><0x5C> is consumed as a single multi-byte character. The escaping backslash inserted by the connector is swallowed as that character's trail byte, so the following 0x27 is no longer escaped — it closes the string literal, and the remaining bytes are parsed as SQL.

This is the well-known multi-byte escaping bypass (the same class that historically affected addslashes / mysqlrealescapestring under GBK/Big5), here applied to the connector's client-side Buffer escaping path.

Am I affected?

You are affected if all of the following hold:

You use mariadb Connector/Node.js at a version below the patched releases listed below. The connection's client character set is one of big5, gbk, sjis, cp932, or gb18030. This is not the default (the default is utf8mb4). Untrusted data can reach a Buffer-typed query parameter.

Applications using utf8mb4 (or any charset whose trail-byte range does not include 0x5C) are not affected by this vector. Parameters bound through the binary/server-side prepared-statement path are also not affected, because those values are sent out-of-band and are never escaped into the SQL text.

Impact

SQL injection. An attacker able to influence the contents of a Buffer parameter can break out of the intended string literal and inject arbitrary SQL, leading to unauthorized read or modification of data and, depending on the database account's privileges, further compromise.

Patches

Fixed in 3.2.4, 3.3.3, 3.4.6, and 3.5.3. Upgrade to the patched release on your branch:

3.5.x → 3.5.3 3.4.x → 3.4.6 3.3.x → 3.3.3 3.2.x and earlier → 3.2.4 (or any newer release)

Workarounds

If you cannot upgrade immediately:

Use server-side prepared statements (execute) so parameters are bound via the binary protocol rather than escaped into the SQL text. Avoid passing untrusted data as Buffer parameters under the affected charsets.

Credit

Reported by Yalguun Tumenkhuu (@fg0x0).

Other sources

MariaDB Connector/Node.js is used to connect applications developed on Node.js to MariaDB and MySQL databases. Prior to 3.2.4, 3.3.3, 3.4.6, and 3.5.3, MariaDB Connector/Node.js permits SQL injection when attacker-controlled Buffer parameters are escaped client-side under the big5, gbk, sjis, cp932, or gb18030 client character sets. PacketOutputStream.writeBufferEscape in lib/io/packet-output-stream.js escaped bytes without the charset-aware getMbRecognizer logic in lib/misc/charset-mb.js. The server SQL lexer runs myismbchar before escape processing, so an attacker-controlled lead byte can consume the inserted 0x5C backslash as a multibyte trail byte and leave the following 0x27 quote unescaped, terminating the string literal and allowing arbitrary SQL. The default utf8mb4 character set and parameters sent through the execute binary prepared-statement path are not affected. Successful exploitation can expose or modify data available to the database account. This issue is fixed in versions 3.2.4, 3.3.3, 3.4.6, and 3.5.3.

MITRE

Affected Software

5 affected componentsFixes available
MariaDB MariaDB Connector/Node.js>0<=3.2.3, >0<=3.3.2, >0<=3.4.5, >0<=3.5.2
npm/mariadb>=3.5.0<3.5.3
3.5.3
npm/mariadb>=3.4.0<3.4.6
3.4.6
npm/mariadb>=3.3.0<3.3.3
3.3.4
npm/mariadb<3.2.4
3.2.4

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/mariadb to a version that resolves this vulnerability.

    Fixed in 3.5.3
  2. Upgrade

    Upgrade npm/mariadb to a version that resolves this vulnerability.

    Fixed in 3.4.6
  3. Upgrade

    Upgrade npm/mariadb to a version that resolves this vulnerability.

    Fixed in 3.3.4
  4. Upgrade

    Upgrade npm/mariadb to a version that resolves this vulnerability.

    Fixed in 3.2.4
  5. Upgrade

    Upgrade mariadb Connector/Node.js to a version that resolves this vulnerability.

    Fixed in 3.2.4
  6. Upgrade

    Upgrade mariadb Connector/Node.js to a version that resolves this vulnerability.

    Fixed in 3.3.3
  7. Upgrade

    Upgrade mariadb Connector/Node.js to a version that resolves this vulnerability.

    Fixed in 3.4.6
  8. Upgrade

    Upgrade mariadb Connector/Node.js to a version that resolves this vulnerability.

    Fixed in 3.5.3
  9. Configuration

    Avoid passing untrusted data as Buffer parameters when the connection's character_set_client is one of the affected charsets: big5, gbk, sjis, cp932, or gb18030; prefer utf8mb4 or a charset whose trail-byte range does not include 0x5C.

    MariaDB Connector/Node.js (client charset selection) character_set_client = utf8mb4 (or any charset whose trail-byte range does not include 0x5C)
  10. Compensating control

    If you cannot upgrade immediately, use server-side prepared statements (execute) so Buffer parameters are bound via the binary protocol rather than escaped client-side into the SQL text.

Event History

Aug 28, 2026
CVE Published
via MITRE·10:06 PM
Data Sourced
via MITRE·10:06 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·10:53 PM
Data Sourced
via GitHub·10:53 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which applications are exposed to this issue?

Applications are exposed if they use an affected Connector/Node.js version, pass attacker-controlled Buffer parameters that are escaped client-side, and use big5, gbk, sjis, cp932, or gb18030 as the client character set. Applications using the default utf8mb4 character set are not affected by this flaw.

2

Does use of prepared statements prevent exploitation?

Parameters sent through the execute binary prepared-statement path are not affected. The vulnerable condition is client-side escaping of Buffer parameters under the listed multibyte client character sets.

3

What access does an attacker need, and what could they do?

An attacker needs to control a Buffer parameter that reaches the vulnerable client-side escaping path. Successful exploitation can allow arbitrary SQL injection within the permissions of the database account, exposing or modifying data available to that account.

4

How can I remediate or triage affected deployments?

Upgrade Connector/Node.js to 3.2.4, 3.3.3, 3.4.6, or 3.5.3, as appropriate for the release line. To identify exposure, check the connector version, client character set, and whether untrusted Buffer values use client-side escaping rather than the execute binary prepared-statement path.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203