Skip to main content
Vulnerability Database/CVE-2026-86047

CVE-2026-86047: MariaDB Server SQL Injection Vulnerability

CVE-2026-86047 is a SQL injection vulnerability in MariaDB Server affecting versions 10.6.1 through 13.0.1. Attackers can inject malicious SQL through crafted identifiers in SHOW commands and dumps. This article covers technical details, affected versions, impact assessment, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-86047 Overview

MariaDB server contains an SQL injection vulnerability in SHOW CREATE SERVER, SHOW CREATE USER, and mariadb-dump output serialization. The affected utilities do not consistently quote identifiers and values when generating SQL. A low-privileged attacker can create database objects with crafted identifiers or values, causing injected SQL statements to appear in subsequent SHOW output or logical dumps. When an administrator or automated pipeline applies the poisoned output, the injected statements execute with elevated privileges. This issue affects MariaDB from 10.6.1 through fixes released in 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, and 13.0.2. The flaw is tracked under CWE-89 (SQL Injection).

Critical Impact

A low-privileged database user can inject arbitrary SQL that executes under administrative context when dumps or SHOW CREATE output are replayed, enabling privilege escalation and data integrity compromise.

Affected Products

  • MariaDB server versions 10.6.1 through 10.6.27
  • MariaDB server versions 10.11.0 through 10.11.18, 11.4.0 through 11.4.12, 11.8.0 through 11.8.8
  • MariaDB server versions 12.3.0 through 12.3.2 and 13.0.0 through 13.0.1

Discovery Timeline

  • 2026-10-16 - CVE-2026-86047 published to NVD
  • 2026-10-20 - Last updated in NVD database

Technical Details for CVE-2026-86047

Vulnerability Analysis

The vulnerability lies in how MariaDB serializes database objects back into executable SQL. Routines emitting SHOW CREATE SERVER, SHOW CREATE USER, and mariadb-dump output construct SQL strings by concatenating identifiers and values with surrounding literal quotes. When identifier content includes quote characters, backticks, or other SQL metacharacters, the generated statement breaks out of its intended syntactic context. The output then contains attacker-controlled SQL fragments that run when replayed.

MariaDB tracks the fix across multiple JIRA issues including MDEV-39776, MDEV-39818 (backtick in foreign key names breaking SHOW CREATE TABLE), MDEV-40308 (single quotes making SHOW CREATE USER invalid), MDEV-40311, and MDEV-40312. Each addresses a distinct serializer path that failed to call the standard identifier-quoting helpers.

Root Cause

The root cause is inconsistent use of the append_identifier() quoting helper. Legacy serialization code hardcoded single quotes and backticks around identifier substrings instead of delegating to the central escaping routine. Any identifier containing the surrounding quote character terminates the literal early.

Attack Vector

Exploitation requires network access and low privileges to create objects such as users, servers, foreign keys, or tables with crafted names or values. The attack completes when a privileged operator runs SHOW CREATE USER, SHOW CREATE SERVER, or mariadb-dump and replays the output on the same or another server. User interaction is required.

c
// Patch excerpt: sql/sql_acl.cc — MDEV-40308 fix for SHOW CREATE USER
-  void print_grant(String *str)
-  {
-    str->append(STRING_WITH_LEN("GRANT PROXY ON '"));
-    str->append(proxied_user, strlen(proxied_user));
-    str->append(STRING_WITH_LEN("'@'"));
-    if (proxied_host.hostname)
-      str->append(proxied_host.hostname, strlen(proxied_host.hostname));
-    str->append(STRING_WITH_LEN("' TO '"));
-    str->append(user, strlen(user));
-    str->append(STRING_WITH_LEN("'@'"));
-    if (host.hostname)
-      str->append(host.hostname, strlen(host.hostname));
-    str->append(STRING_WITH_LEN("'"));
+  void print_grant(THD *thd, String *str)
+  {
+    str->append(STRING_WITH_LEN("GRANT PROXY ON "));
+    append_identifier(thd, str, proxied_user, strlen(proxied_user));
+    str->append(STRING_WITH_LEN("@"));
+    if (proxied_host.hostname)
+      append_identifier(thd, str, proxied_host.hostname, strlen(proxied_host.hostname));
+    str->append(STRING_WITH_LEN(" TO "));
+    append_identifier(thd, str, user, strlen(user));
+    str->append(STRING_WITH_LEN("@"));
+    if (host.hostname)
+      append_identifier(thd, str, host.hostname, strlen(host.hostname));

Source: MariaDB Commit #3646569

c
// Patch excerpt: storage/innobase/handler/ha_innodb.cc — MDEV-39818 fix
-  const int q = trx != NULL && trx->mysql_thd != NULL
-    ? get_quote_char_for_identifier(trx->mysql_thd, id, strlen(id))
-    : '`';
-  if (q == EOF) {
-    fputs(id, file);
-  } else {
-    putc(q, file);
-    while (int c = *id++) {
-      if (c == q) { putc(c, file); }
-      putc(c, file);
-    }
-    putc(q, file);
-  }
+  std::string str = innobase_quote_identifier(trx, id);
+  fputs(str.c_str(), file);

Source: MariaDB Commit #5acb435

Detection Methods for CVE-2026-86047

Indicators of Compromise

  • Database users, servers, or foreign key constraints whose names contain single quotes, double quotes, backticks, newlines, or SQL keywords such as GRANT, DROP, or UNION.
  • mariadb-dump output files containing unexpected GRANT, CREATE USER, or SET statements adjacent to objects owned by low-privileged accounts.
  • Audit log entries showing object creation calls with unusually long or metacharacter-rich identifier arguments.

Detection Strategies

  • Scan the mysql.user, mysql.servers, and information_schema.table_constraints tables for identifiers containing quote characters or whitespace that are not expected in your naming convention.
  • Diff dump files produced before and after suspicious object creation to spot injected statements that do not correspond to legitimate schema changes.
  • Enable the MariaDB audit plugin and alert on CREATE USER, CREATE SERVER, and ALTER TABLE ... ADD CONSTRAINT statements submitted by non-administrative accounts.

Monitoring Recommendations

  • Monitor administrative workflows that replay SHOW CREATE or mariadb-dump output and gate them on identifier validation.
  • Alert on execution of logical dumps containing identifiers that fail a strict [A-Za-z0-9_] regex outside quoted ASCII bounds.
  • Forward MariaDB general query and audit logs to a centralized analytics platform for cross-correlation with privileged session activity.

How to Mitigate CVE-2026-86047

Immediate Actions Required

  • Upgrade affected MariaDB instances to 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, or 13.0.2.
  • Review existing user accounts, server definitions, and foreign key names for malicious identifier content and rename or drop any suspicious objects.
  • Restrict CREATE USER, CREATE SERVER, and ALTER privileges to trusted roles until patching is complete.

Patch Information

MariaDB released fixes in MariaDB 10.6.28, MariaDB 10.11.19, MariaDB 11.4.13, MariaDB 11.8.9, MariaDB 12.3.3, and MariaDB 13.0.2. Full details are documented in MariaDB Security Advisory GHSA-wxr3-wm3p-7w6p.

Workarounds

  • Avoid executing mariadb-dump output or SHOW CREATE statements captured from untrusted or multi-tenant databases without manual review.
  • Enforce an organizational naming policy that rejects identifiers containing quote characters, backticks, or control characters at object creation time.
  • Revoke CREATE USER, CREATE SERVER, and foreign key creation privileges from application accounts that do not require them.
bash
# Verify patched MariaDB version after upgrade
mariadb --version
mariadb -u root -p -e "SELECT VERSION();"

# Audit for identifiers containing suspicious characters
mariadb -u root -p -e "SELECT User, Host FROM mysql.user WHERE User REGEXP '[\\'\"\\`\\\\]';"
mariadb -u root -p -e "SELECT Server_name FROM mysql.servers WHERE Server_name REGEXP '[\\'\"\\`\\\\]';"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.