/

CVE-2026-86047

Severity:

HIGH RISK

(7.7)

SQL Injection (CWE-89) in MariaDB SQL Serialization

CVE-2026-86047

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

SQL injection and unauthorized database command execution

Severity:

HIGH RISK

(7.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

MariaDB inconsistently quotes identifiers and values when generating SQL through SHOW CREATE SERVER, SHOW CREATE USER, and mariadb-dump. A low-privileged attacker may poison an object so that generated output contains injected SQL, which can execute when the output is later applied.

MariaDB inconsistently quotes identifiers and values when generating SQL through SHOW CREATE SERVER, SHOW CREATE USER, and mariadb-dump. A low-privileged attacker may poison an object so that generated output contains injected SQL, which can execute when the output is later applied.

Affected context

The vulnerability occurs in MariaDB installations where attacker-created objects can be included in SHOW output or logical database dumps. It becomes risky when generated SQL is trusted and subsequently executed without independent validation, allowing crafted identifiers or values to cross the serialization boundary as executable statements.

The vulnerability occurs in MariaDB installations where attacker-created objects can be included in SHOW output or logical database dumps. It becomes risky when generated SQL is trusted and subsequently executed without independent validation, allowing crafted identifiers or values to cross the serialization boundary as executable statements.

Exploit preconditions

  • Attack surface: MariaDB SQL serialization through SHOW CREATE SERVER, SHOW CREATE USER, or mariadb-dump
  • Required access: Low-privileged ability to create or modify database objects whose identifiers or values are serialized
  • Trigger point: Generation and later application of poisoned SHOW output or dump content
  • Why exploitation is possible: Identifiers and values are not consistently quoted, allowing attacker-controlled content to be interpreted as additional SQL statements
  • Attack surface: MariaDB SQL serialization through SHOW CREATE SERVER, SHOW CREATE USER, or mariadb-dump
  • Required access: Low-privileged ability to create or modify database objects whose identifiers or values are serialized
  • Trigger point: Generation and later application of poisoned SHOW output or dump content
  • Why exploitation is possible: Identifiers and values are not consistently quoted, allowing attacker-controlled content to be interpreted as additional SQL statements

Why this happens

The underlying bug is incomplete escaping and quoting during conversion of database metadata into executable SQL text. When identifiers or values are serialized without context-appropriate quoting, attacker-controlled content can break out of its intended syntactic position and introduce new SQL statements. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.

The underlying bug is incomplete escaping and quoting during conversion of database metadata into executable SQL text. When identifiers or values are serialized without context-appropriate quoting, attacker-controlled content can break out of its intended syntactic position and introduce new SQL statements. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.

Potential impact

  • Unauthorized SQL statements may be executed when poisoned output is applied
  • Database contents or schema may be altered
  • Sensitive information may be exposed or modified
  • Administrative or operational workflows may be disrupted
  • Data integrity and backup or migration reliability may be compromised
  • Unauthorized SQL statements may be executed when poisoned output is applied
  • Database contents or schema may be altered
  • Sensitive information may be exposed or modified
  • Administrative or operational workflows may be disrupted
  • Data integrity and backup or migration reliability may be compromised

General mitigation guidance

Mitigation generally focuses on treating serialized SQL as a security-sensitive output format rather than inherently trusted text.

Common defensive patterns include:

  • Apply context-appropriate quoting and escaping to every serialized identifier and value
  • Prefer structured metadata or parameterized execution paths over concatenated SQL where practical
  • Validate generated SQL before applying dumps or SHOW-derived output
  • Reduce trust in objects and metadata created by low-privileged accounts
  • Run import, migration, and administrative workflows with only the privileges they require
  • Keep generated dumps protected from unauthorized modification and review them before execution

Mitigation generally focuses on treating serialized SQL as a security-sensitive output format rather than inherently trusted text.

Common defensive patterns include:

  • Apply context-appropriate quoting and escaping to every serialized identifier and value
  • Prefer structured metadata or parameterized execution paths over concatenated SQL where practical
  • Validate generated SQL before applying dumps or SHOW-derived output
  • Reduce trust in objects and metadata created by low-privileged accounts
  • Run import, migration, and administrative workflows with only the privileges they require
  • Keep generated dumps protected from unauthorized modification and review them before execution

How teams detect issues like this

Organizations can look for this weakness through:

  • Static analysis rules that identify SQL generation using unescaped identifiers or values
  • Code review checks for inconsistent quoting across SHOW, dump, export, and migration serializers
  • Tests using metacharacters and statement delimiters in object names and metadata values
  • Policy enforcement requiring validation or review before generated SQL is executed
  • Monitoring for unexpected statements in dump-import and administrative execution workflows

Automated security and code review tools may help identify unsafe string-construction patterns, but database-specific serialization tests remain important.

Organizations can look for this weakness through:

  • Static analysis rules that identify SQL generation using unescaped identifiers or values
  • Code review checks for inconsistent quoting across SHOW, dump, export, and migration serializers
  • Tests using metacharacters and statement delimiters in object names and metadata values
  • Policy enforcement requiring validation or review before generated SQL is executed
  • Monitoring for unexpected statements in dump-import and administrative execution workflows

Automated security and code review tools may help identify unsafe string-construction patterns, but database-specific serialization tests remain important.

Sources

SourceLink
github.comgithub.com/MariaDB/server/commit/2b28d1c424104429eeed43115ee6d8a803671d52
github.comgithub.com/MariaDB/server/commit/3646569225758c8225e7342783d775ef7c7570e5
github.comgithub.com/MariaDB/server/commit/5acb43522863c9bd6b91f354104ea247bf513e9a
github.comgithub.com/MariaDB/server/commit/9d4ffe23b25808f7858b2dc48106fbd60cf0e513
github.comgithub.com/MariaDB/server/commit/d5d741a3076f911b468518d6b06a917593498c5b
github.comgithub.com/MariaDB/server/releases/tag/mariadb-10.11.19
github.comgithub.com/MariaDB/server/releases/tag/mariadb-10.6.28
github.comgithub.com/MariaDB/server/releases/tag/mariadb-11.4.13
github.comgithub.com/MariaDB/server/releases/tag/mariadb-11.8.9
github.comgithub.com/MariaDB/server/releases/tag/mariadb-12.3.3
github.comgithub.com/MariaDB/server/releases/tag/mariadb-13.0.2
github.comgithub.com/MariaDB/server/security/advisories/GHSA-wxr3-wm3p-7w6p
jira.mariadb.orgjira.mariadb.org/browse/MDEV-39776
jira.mariadb.orgjira.mariadb.org/browse/MDEV-39818
jira.mariadb.orgjira.mariadb.org/browse/MDEV-40308
jira.mariadb.orgjira.mariadb.org/browse/MDEV-40311
jira.mariadb.orgjira.mariadb.org/browse/MDEV-40312

Frequently asked

questions

Exploitation generally depends on access to a MariaDB instance and the ability to create or influence objects that appear in serialized output. The injected SQL executes when the poisoned output is later applied, rather than necessarily during output generation.

No. The described attack can begin with low-privileged database access, although the eventual impact depends on the privileges used to apply the generated SQL.

Ensure every identifier and value is serialized with context-appropriate quoting, and validate or review generated SQL before execution. Structured or parameterized workflows are preferable where available.

Add adversarial serialization tests, review SQL construction paths, restrict who can create exported objects, protect dump files, and enforce least privilege for import and migration processes.

Exploitation generally depends on access to a MariaDB instance and the ability to create or influence objects that appear in serialized output. The injected SQL executes when the poisoned output is later applied, rather than necessarily during output generation.

No. The described attack can begin with low-privileged database access, although the eventual impact depends on the privileges used to apply the generated SQL.

Ensure every identifier and value is serialized with context-appropriate quoting, and validate or review generated SQL before execution. Structured or parameterized workflows are preferable where available.

Add adversarial serialization tests, review SQL construction paths, restrict who can create exported objects, protect dump files, and enforce least privilege for import and migration processes.

Find out what's already
exploitable in your codebase.