Skip to main content

MariaDB Server CVE-2026-85748

| EUVDEUVD-2026-102941 CRITICAL
Use After Free (CWE-416)
2026-10-16 GitHub_M
9.9
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Authenticate to MariaDB as low-privileged user
  2. Delivery
    Define routine opening 17+ SYS_REFCURSORs
  3. Exploit
    Force cursor-array reallocation leaving stale refs
  4. Execution
    Fetch cursor to trigger use-after-free
  5. Impact
    Chain second flaw for code execution

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Memory lifecycle management
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Privilege Escalation

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires an authenticated, low-privileged MariaDB account (versions 12.3.1 through 12.3.2, i.e. before 12.3.3, and the 13.0.x branch before 13.0.2) with the ability to create and execute stored routines that use the SYS_REFCURSOR type - a feature only present in these recent 12.3+/13.0 branches. The attacker must declare and open more than the default 16 SYS_REFCURSORs inside a routine (the regression test uses 17 with max_open_cursors raised to 100) to force cursor-array reallocation, then fetch from a cursor to hit the use-after-free. Limiting factors: exploitation needs valid DB authentication (not unauthenticated), the SYS_REFCURSOR feature must be used, the deployment must run one of the narrow affected versions, and achieving remote code execution (rather than just a crash) requires chaining with a second, separate vulnerability.

Impact

The vendor CVSS of 9.9 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H) reflects a network-reachable, low-complexity, low-privilege memory-corruption bug, which on its surface is a high priority. However, several signals temper this: no EPSS score was provided, the CVE is not in CISA KEV (so this is 'no public exploit identified at time of analysis'), and no SSVC decision framework data is supplied. Crucially, the description itself states RCE is only achievable 'when combined with another vulnerability' - so the confirmed standalone impact of this use-after-free is a server crash (availability loss), while the C:H/I:H/code-execution rating depends on chaining and heap control that are not demonstrated in the provided data. The only code evidence is the vendor's fix commit and a crash-reproducing regression test, not a weaponized exploit. Net: this is a genuine, patch-worthy memory-safety flaw that matters most for multi-tenant or internet-adjacent MariaDB instances where low-privileged SQL accounts are untrusted, but the real-world exploitation bar (authenticated access plus a second vulnerability for RCE) and the very narrow affected version window make it less of an immediate mass-exploitation threat than the 9.9 alone suggests.

Exploit ScenarioDerived

A low-privileged but authenticated MariaDB user creates a stored function that declares and opens more than 16 SYS_REFCURSORs, forcing the cursor-array to reallocate and leaving stale references in the routine context; fetching from one of the cursors then triggers a use-after-free. On its own this reliably crashes the server (denial of service), and the vendor states it can enable remote code execution when chained with a second vulnerability. No public exploit exists - only the vendor's crash-reproducing regression test (MDEV-40639) is available.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 16, 2026

Use-after-free in MariaDB Server's SYS_REFCURSOR handling (12.3.1 through 12.3.2, and the 13.0.x branch before 13.0.2) lets an authenticated, low-privileged database user crash the server and corrupt server memory by declaring and opening more than the default 16 SYS_REFCURSORs inside a stored routine and then fetching from one of them. The flaw is a stale-reference bug in the cursor array: when the array is reallocated to grow beyond its initial 16 slots, routine-context references still point at the freed element, and the resulting use-after-free can be leveraged for remote code execution only when chained with a second, separate vulnerability. Authentication is required (CVSS PR:L, AV:N), and no public exploit code or confirmed active exploitation has been identified at the time of analysis; the vendor CVSS of 9.9 is high, but practical impact is bounded by the narrow affected version range and the need for CREATE ROUTINE/EXECUTE privileges plus a second bug to convert memory corruption into code execution.

RemediationAI

Vendor-released patch: upgrade to MariaDB Server 12.3.3 or 13.0.2 (see the GitHub advisory GHSA-mv8g-9f7q-hprm and the release tags for mariadb-12.3.3 and mariadb-13.0.2); the fix is also visible in upstream commits 91156c3de58762196605150ab3f756fe952592d1 and 9b075b2cb53338f67e7230cc585e02d2d34514ed, which switch the cursor array from inline elements to heap pointers. If upgrading immediately is not possible, reduce the attack surface by revoking CREATE ROUTINE, ALTER ROUTINE and EXECUTE privileges on stored procedures/functions from untrusted or low-privileged accounts, since the bug is only reachable by authenticated users who can create and execute routines that open many SYS_REFCURSORs - the trade-off is loss of legitimate stored-program functionality for those accounts. Do not rely solely on lowering max_open_cursors: it is a session variable the attacker can raise themselves (the regression test sets it to 100), so it is a weak and easily bypassed control. Also treat unexplained mysqld crashes as a potential exploitation signal and restrict network exposure of the database port to trusted hosts, noting that network exposure itself does not remove the need for credentials. Finally, because full remote code execution requires chaining with a second, separate vulnerability, prioritizing patching of other MariaDB memory-corruption issues in the same time window is warranted.

Affected VersionsENISA

Server 13.0.1, < 13.0.2
Server 12.3.1, < 12.3.3

Affected Packages

euvd server fix: 12.3.3, 13.0.2

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

MariaDB's stored-program cursor support is implemented in sql/sp_cursor.cc and sql/sp_cursor.h. Before the fix, class sp_cursor_array derived from Dynamic_array<sp_cursor_array_element> - i.e. it stored cursor descriptor objects inline by value. When a routine opened more cursors than the array's current capacity (the default is 16 slots, matching the regression test's 17 cursors with max_open_cursors raised to 100), Dynamic_array::append() reallocated the backing buffer, moving the inline sp_cursor_array_element objects to a new address while routine contexts such as SYS_REFCURSOR handles continued to hold indices/pointers into the old, freed storage. Fetching from such a cursor dereferences freed memory - root cause CWE-416 (Use After Free), a memory-corruption class that typically manifests as a crash and, depending on allocator state, can escalate to control-flow hijacking. The upstream fix (commits 91156c3de58762196605150ab3f756fe952592d1 and 9b075b2cb53338f67e7230cc585e02d2d34514ed) changes sp_cursor_array to Dynamic_array<sp_cursor_array_element*> - storing pointers to heap-allocated elements - so that appending and reallocating the array no longer moves the cursor objects themselves, and updates check_for_open/get_cursor_by_ref accordingly (the diff's element-access operators change from '.' to '->'). This is the same regression tracked in MariaDB Jira issues MDEV-40639 ("Open SYS_REFCURSOR crash, if many cursors inside a function") and MDEV-40396. The SYS_REFCURSOR type is a recent addition, appearing only in the 12.3+ and 13.0 branches, which is why the exposure window is narrow.

Know when MariaDB gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 9.9 CRITICAL
AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
vuln.today AI 9.9 CRITICAL

Reachable over a DB connection (AV:N) with a deterministic >16-cursor trigger (AC:L) by any routine-creating user (PR:L); S:C and full C/I/A reflect potential RCE escaping SQL privileges, though standalone impact is a crash.

3.1 AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

2
Patch available
Oct 16, 2026 - 18:03 EUVD
CVE Published
Oct 16, 2026 - 16:28 cve.org
CRITICAL 9.9

DescriptionCVE.org

MariaDB server is a community developed fork of MySQL server. From 12.3.1 until 12.3.3 and 13.0.2, SYS_REFCURSOR handling is affected because cursor-array reallocation can leave stale references in routine contexts. A low-privileged attacker can open a large number of SYS_REFCURSORs and then fetch one to trigger a use-after-free that can enable remote code execution when combined with another vulnerability. This issue is fixed in versions 12.3.3 and 13.0.2.

Technical POC Analysis

CWE-416 Use After Free.

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Executive ViewAI

Why It Matters

MariaDB Server versions 12.3.1 through 12.3.2 and 13.0.x before 13.0.2 are impacted by a critical use-after-free vulnerability that enables an authenticated low-privileged database user to crash the server and corrupt memory. While remote code execution requires chaining with a separate vulnerability, the potential for service disruption and data integrity issues poses a significant risk to organizations running these versions in production. No vendor-released patch identified at time of analysis, and no public exploit identified at time of analysis, but immediate mitigation is warranted.

Business Impact: High
Compensating Controls

Restrict CREATE ROUTINE and EXECUTE privileges to trusted users only; monitor for stored routines that declare more than 16 SYS_REFCURSORs and for unexpected database crashes; ensure regular backups and rapid recovery procedures; consider isolating affected MariaDB instances from untrusted networks; apply vendor-recommended temporary mitigations if published.

Threat Intelligence Overview

Prevalence
High
widely deployed open-source RDBMS, but only recent 12.3.x/13.0.x branches affected
Data Quality
5 sources
Confidence: Medium
EUVD NVD CVE.org Vulnrichment GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS N/A
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

50
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +50
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Use-after-free vulnerabilities occur when a program continues to access memory through a pointer after that memory has been deallocated.

Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

CVE-2016-6662 CRITICAL POC
9.8 Sep 20

Oracle MySQL through 5.5.52, 5.6.x through 5.6.33, and 5.7.x through 5.7.15; MariaDB before 5.5.51, 10.0.x before 10.0.2

CVE-2012-5613 MEDIUM POC
6.0 Dec 03

MySQL 5.5.19 and possibly other versions, and MariaDB 5.5.28a and possibly other versions, when configured to assign the

CVE-2014-0195 MEDIUM POC
6.8 Jun 05

The dtls1_reassemble_fragment function in d1_both.c in OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2012-2122 MEDIUM POC
5.1 Jun 26

sql/password.c in Oracle MySQL 5.1.x before 5.1.63, 5.5.x before 5.5.24, and 5.6.x before 5.6.6, and MariaDB 5.1.x befor

CVE-2012-5612 MEDIUM POC
6.5 Dec 03

Heap-based buffer overflow in Oracle MySQL 5.5.19 and other versions through 5.5.28, and MariaDB 5.5.28a and possibly ot

CVE-2012-5611 MEDIUM POC
6.5 Dec 03

Stack-based buffer overflow in the acl_get function in Oracle MySQL 5.5.19 and other versions through 5.5.28, and 5.1.53

CVE-2014-3470 MEDIUM
4.3 Jun 05

The ssl3_send_client_key_exchange function in s3_clnt.c in OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before

CVE-2016-6664 HIGH POC
7.0 Dec 13

mysqld_safe in Oracle MySQL through 5.5.51, 5.6.x through 5.6.32, and 5.7.x through 5.7.14; MariaDB; Percona Server befo

CVE-2014-0221 MEDIUM
4.3 Jun 05

The dtls1_get_message_fragment function in d1_both.c in OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.

CVE-2015-3152 MEDIUM POC
5.9 May 16

Oracle MySQL before 5.7.3, Oracle MySQL Connector/C (aka libmysqlclient) before 6.1.3, and MariaDB before 5.5.44 use the

CVE-2022-0778 HIGH POC
7.5 Mar 15

The BN_mod_sqrt() function, which computes a modular square root, contains a bug that can cause it to loop forever for n

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy