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-85745 Overview
CVE-2026-85745 is an out-of-bounds read vulnerability in MariaDB server affecting the ST_Area spatial function. The flaw resides in the MultiPolygon Well-Known Binary (WKB) parser, which advances past a nested geometry header without first verifying that enough input remains in the buffer. A low-privileged remote attacker with database access can submit malformed spatial data to read beyond the allocated buffer. The disclosed memory can be used to defeat Address Space Layout Randomization (ASLR) as part of a multi-stage exploit chain. The issue is tracked as [CWE-126] (Buffer Over-read) and was reported through MariaDB JIRA as MDEV-40328.
Critical Impact
Authenticated attackers can leak process memory from the MariaDB server by submitting crafted MultiPolygon WKB input to ST_Area, aiding ASLR bypass in subsequent exploitation.
Affected Products
- MariaDB server versions from 10.6.1 up to (but not including) 10.6.28
- MariaDB server 10.11.x before 10.11.19, 11.4.x before 11.4.13, and 11.8.x before 11.8.9
- MariaDB server 12.3.x before 12.3.3 and 13.0.x before 13.0.2
Discovery Timeline
- 2026-10-16 - CVE-2026-85745 published to NVD
- 2026-10-20 - Last updated in NVD database
Technical Details for CVE-2026-85745
Vulnerability Analysis
The vulnerability lives in sql/spatial.cc within the MultiPolygon parser used by the ST_Area spatial function. When MariaDB processes a MultiPolygon WKB payload, the parser iterates over nested line strings and skips the WKB header for each entry. The skip operation advances the data pointer by WKB_HEADER_SIZE without checking that enough bytes remain in the input buffer.
If an attacker submits a MultiPolygon with a declared line string count larger than the actual payload, the parser reads past the allocated buffer. The adjacent heap memory is interpreted as geometry coordinates, and derived values can be returned to the client through subsequent spatial computations. This leaks process memory contents useful for calculating base addresses of libraries and binaries loaded in the MariaDB process.
Root Cause
The root cause is missing bounds validation in the loop that walks nested WKB geometry headers. The parser trusts the attacker-supplied count field and performs unchecked pointer arithmetic. [CWE-126] classifies this as a buffer over-read triggered by insufficient length validation before a read operation.
Attack Vector
Exploitation requires network access to the database and authenticated low-privilege credentials. An attacker issues a SQL statement that invokes ST_Area on a crafted WKB blob containing a malformed MultiPolygon structure. No user interaction is required, and the attack does not alter data or crash the service in typical cases, making detection harder.
while (n_line_strings--)
{
- data+= WKB_HEADER_SIZE;
- if (!(data= get_mbr_for_points(mbr, data, 0)))
+ if (!(data= get_mbr_for_points(mbr, data + WKB_HEADER_SIZE, 0)))
return 1;
}
*end= data;
Source: MariaDB Commit 2bf355e. The patch folds the header skip into the get_mbr_for_points call, which performs bounds checking before dereferencing the pointer, preventing the out-of-bounds read.
Detection Methods for CVE-2026-85745
Indicators of Compromise
- SQL query logs containing ST_Area calls against user-supplied binary data or GeomFromWKB inputs
- Repeated spatial function calls returning anomalous numeric results from the same authenticated session
- MariaDB error log entries referencing AddressSanitizer, segmentation faults, or spatial parsing failures
Detection Strategies
- Enable MariaDB general query logging and audit log plugin to capture spatial function invocations with their payloads
- Hunt for authenticated sessions issuing ST_Area, ST_AsText, or related spatial calls on untrusted binary blobs
- Correlate database query telemetry with process-level anomalies such as abnormal memory read patterns on the mysqld/mariadbd binary
Monitoring Recommendations
- Forward MariaDB audit logs into a centralized analytics platform and alert on spatial functions executed by application accounts that do not normally use GIS features
- Monitor for sudden increases in failed or malformed spatial queries, which often precede exploit refinement
- Baseline normal ST_* function usage per application role so deviations trigger review
How to Mitigate CVE-2026-85745
Immediate Actions Required
- Upgrade MariaDB server to a fixed release: 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, or 13.0.2
- Restrict EXECUTE and spatial function privileges to application roles that genuinely require GIS processing
- Review database accounts and remove unused low-privilege credentials that could be leveraged for authenticated access
Patch Information
The fix is published in the MariaDB Security Advisory GHSA-p7v9-24h4-mch8 and implemented in commit 2bf355e361db85153fdfba7b8a0f0d114d6a26ce. Patched builds are available in the 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, and 13.0.2 releases.
Workarounds
- Revoke execute access to spatial functions for untrusted roles until upgrading is possible
- Validate and sanitize any WKB inputs at the application layer to reject malformed MultiPolygon structures
- Place MariaDB behind a database firewall or proxy capable of blocking queries that pass binary blobs to ST_Area
# Restrict spatial function usage for application roles until patched
REVOKE EXECUTE ON FUNCTION ST_Area FROM 'app_user'@'%';
FLUSH PRIVILEGES;
# Verify running MariaDB version is patched
mysql -u root -p -e "SELECT VERSION();"
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

