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-85746 Overview
CVE-2026-85746 is an out-of-bounds write vulnerability in MariaDB server affecting the ST_AsText spatial function. The flaw exists in recursive Well-Known Text (WKT) serialization of deeply nested GeometryCollection objects. The recursive serializer fails to account for bytes already consumed or reserve sufficient output buffer space, allowing writes beyond the allocated buffer. A low-privileged remote attacker holding database connection credentials can submit a crafted Geographic Information System (GIS) object to corrupt heap memory. The vulnerability maps to [CWE-787: Out-of-bounds Write].
Critical Impact
Memory corruption triggered by a crafted GIS query can be chained with another vulnerability to achieve remote code execution within the MariaDB server process.
Affected Products
- MariaDB server versions 10.6.1 through 10.6.27
- MariaDB server versions 10.11.x through 10.11.18, 11.4.x through 11.4.12, and 11.8.x through 11.8.8
- MariaDB server versions 12.3.x through 12.3.2 and 13.0.x through 13.0.1
Discovery Timeline
- 2026-10-16 - CVE-2026-85746 published to the National Vulnerability Database (NVD)
- 2026-10-20 - Last updated in NVD database
Technical Details for CVE-2026-85746
Vulnerability Analysis
The vulnerability resides in sql/spatial.cc within the WKT serialization path invoked by ST_AsText. When MariaDB serializes a GeometryCollection, it recursively calls get_data_as_wkt for each nested geometry. After recursion returns, the parent function appends a closing parenthesis using qs_append, a fast-path method that assumes space was pre-reserved. The reservation accounting does not include bytes consumed by the inner recursive serializers. As recursion depth increases, the running write offset exceeds the originally reserved buffer length, producing a heap out-of-bounds write.
An attacker who can execute SELECT ST_AsText(...) against a crafted geometry blob can control the depth and shape of recursion. This provides a primitive for adjacent-chunk corruption on the heap. Combined with a secondary information disclosure or allocator-shaping primitive, the write can be steered toward function pointers or vtables inside the server process.
Root Cause
The root cause is a mismatch between reserved and consumed buffer length in recursive serialization. qs_append is an unchecked append operation intended for callers that have already called reserve(). The outer function reserved space for one closing byte but inner recursive calls consumed that reservation. The patch replaces qs_append(')') with the length-checked append(')') to restore safe-write semantics.
Attack Vector
Exploitation requires a valid authenticated session with permission to execute spatial functions, which is included in default SQL privileges on most schemas. The attacker submits a crafted GeometryCollection with sufficient nesting depth and invokes ST_AsText on it. No user interaction is required and the attack is executed over the standard MariaDB network protocol.
if (get_data_as_wkt(wkt, end))
return 1;
if (get_class_info() != &geometrycollection_class)
- wkt->qs_append(')');
+ wkt->append(')'); // NOT qs_append, get_data_as_wkt consumed reserved space
return 0;
}
Source: MariaDB Commit 5c04ca55. The patch replaces the unchecked qs_append with the bounds-checked append method to prevent the out-of-bounds write.
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2026-85746
Indicators of Compromise
- MariaDB server process crashes or SIGSEGV events following execution of ST_AsText queries
- Query log entries containing ST_AsText applied to deeply nested GeometryCollection or GEOMCOLLECTION payloads
- Unexpected child processes spawned by mysqld or mariadbd, indicating successful code execution chaining
Detection Strategies
- Enable the MariaDB general query log or audit plugin and alert on ST_AsText calls referencing geometry blobs over an abnormal size threshold
- Inspect binary logs for INSERT or UPDATE operations that store oversized WKB blobs preceding spatial queries
- Deploy runtime protection on database hosts to detect anomalous memory writes and post-exploitation activity originating from the database service account
Monitoring Recommendations
- Track MariaDB version inventory against the fixed releases: 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, and 13.0.2
- Monitor mysqld/mariadbd crash reports and core dumps for signatures involving Binary_string::qs_append on the call stack
- Correlate authentication events with spatial function usage to identify low-privileged accounts probing GIS surfaces
How to Mitigate CVE-2026-85746
Immediate Actions Required
- Upgrade MariaDB to a fixed release: 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, or 13.0.2
- Audit database accounts and revoke SELECT privileges from any accounts that do not require spatial query access
- Restrict network exposure of the MariaDB listener to trusted application tiers using firewall rules or bind-address constraints
Patch Information
MariaDB released fixes in versions 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, and 13.0.2. Review the MariaDB Security Advisory GHSA-8fvj-c57c-pggx and tracking issue MDEV-40329 for complete release notes. The upstream fix is in commit 5c04ca55.
Workarounds
- If patching cannot be performed immediately, revoke execution of spatial functions on sensitive schemas and reject application queries invoking ST_AsText at the proxy or application layer
- Place a SQL-aware proxy such as ProxySQL or MaxScale in front of MariaDB to filter or rate-limit queries containing ST_AsText against GeometryCollection columns
- Run MariaDB under a hardened service account with reduced filesystem permissions and AppArmor or SELinux confinement to limit post-exploitation impact
# Verify running MariaDB version and confirm it is at or above the fixed release
mysql -u root -p -e "SELECT VERSION();"
# Revoke spatial function access from a low-privileged account as a temporary mitigation
mysql -u root -p -e "REVOKE EXECUTE ON FUNCTION ST_AsText FROM 'app_user'@'%'; FLUSH PRIVILEGES;"
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

