Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAuthenticate to MariaDB as low-privileged user
-
DeliveryDefine routine opening 17+ SYS_REFCURSORs
-
ExploitForce cursor-array reallocation leaving stale refs
-
ExecutionFetch cursor to trigger use-after-free
-
ImpactChain 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
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.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.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.
Articles & Coverage 1
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
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.
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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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.
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
MySQL 5.5.19 and possibly other versions, and MariaDB 5.5.28a and possibly other versions, when configured to assign the
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
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
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
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
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
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
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
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.
Oracle MySQL before 5.7.3, Oracle MySQL Connector/C (aka libmysqlclient) before 6.1.3, and MariaDB before 5.5.44 use the
The BN_mod_sqrt() function, which computes a modular square root, contains a bug that can cause it to loop forever for n
EUVD-2026-102941
NVD
CVE.org
Vulnrichment
GitHub
Exploit-DB