Skip to main content
Vulnerability Database/CVE-2026-85985

CVE-2026-85985: MariaDB CONNECT Engine Privilege Escalation

CVE-2026-85985 is a privilege escalation vulnerability in MariaDB CONNECT engine that allows low-privileged attackers to bypass FILE privilege checks and access unauthorized files. This article covers technical details, affected versions from 10.6.1 through recent releases, security impact, and mitigation strategies.

Published:

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-85985 Overview

CVE-2026-85985 is a missing authorization vulnerability [CWE-862] in the MariaDB CONNECT storage engine plugin. The affected file-access user-defined functions (UDFs) json_file(), bson_file(), jfile_make(), bfile_make(), and jbin_file() do not enforce the FILE privilege or honor the secure_file_priv configuration directive. A low-privileged authenticated database user can invoke these UDFs with an arbitrary filesystem path to read or write files that the database account would otherwise be unauthorized to access, bounded only by operating-system permissions on the mysqld process. The flaw affects MariaDB server versions 10.6.1 through the fixed releases 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, and 13.0.2.

Critical Impact

Authenticated low-privilege users can read or write arbitrary files accessible to the MariaDB service account, bypassing both the FILE privilege model and the secure_file_priv sandbox.

Affected Products

  • MariaDB server 10.6.1 through 10.6.27
  • MariaDB server 10.11.x prior to 10.11.19, 11.4.x prior to 11.4.13, and 11.8.x prior to 11.8.9
  • MariaDB server 12.3.x prior to 12.3.3 and 13.0.x prior to 13.0.2

Discovery Timeline

  • 2026-10-16 - CVE-2026-85985 published to NVD
  • 2026-10-20 - Last updated in NVD database

Technical Details for CVE-2026-85985

Vulnerability Analysis

The MariaDB CONNECT storage engine ships several UDFs that read and write JSON and BSON documents directly from the filesystem. MariaDB normally restricts filesystem access through two controls: the FILE global privilege and the secure_file_priv system variable, which pins read and write operations to a single directory. The CONNECT engine's json_file(), bson_file(), jfile_make(), bfile_make(), and jbin_file() functions skipped both checks. Any user with permission to call UDFs could therefore reach outside the sandbox and interact with files owned by the database service account. This behavior creates a privilege boundary violation between the SQL authorization model and the host filesystem.

Root Cause

The root cause is missing authorization logic [CWE-862] in the CONNECT engine's JSON and BSON UDF entry points. The functions executed filesystem I/O without consulting the privilege table for FILE or validating the supplied path against secure_file_priv. The upstream fix, tracked as MDEV-40323, introduces a dedicated filechk.cpp / filechk.h module that the UDF implementations now call before touching the filesystem.

Attack Vector

Exploitation requires network-reachable access and valid credentials for a low-privileged MariaDB account that can invoke CONNECT UDFs. The attacker calls one of the affected functions with an absolute path pointing at a sensitive file, such as /etc/mysql/ configuration data or application secrets, and receives the contents in the query response. The write-oriented variants jfile_make() and bfile_make() enable file creation or overwrite within the service account's reach, which can be chained to tamper with configuration or logs.

cpp
#include <cassert>

#include "bsonudf.h"
#include "filechk.h"

#if defined(UNIX) || defined(UNIV_LINUX)
#define _O_RDONLY O_RDONLY

Source: MariaDB commit 4f66ca1b69daf1b7e6a562ca8e86d77a6a70abfe. The patch adds the filechk.h include to bsonudf.cpp so that each file-access UDF invokes the new privilege and path checks before performing I/O.

Detection Methods for CVE-2026-85985

Indicators of Compromise

  • Query log entries showing calls to json_file(), bson_file(), jfile_make(), bfile_make(), or jbin_file() from accounts that do not hold the FILE privilege.
  • File-path arguments to CONNECT UDFs that reference locations outside secure_file_priv, such as /etc/, /root/, or application secret directories.
  • Unexpected files created or modified under the mysqld process owner with timestamps that correlate to CONNECT UDF invocations.

Detection Strategies

  • Enable the MariaDB general query log or audit plugin and alert on invocations of the five affected UDF names.
  • Correlate database query telemetry with host-level file access events on the database server to spot reads of sensitive paths originating from mysqld.
  • Inventory accounts with EXECUTE on CONNECT UDFs and flag any that lack a business justification for file-access functions.

Monitoring Recommendations

  • Forward MariaDB audit logs and host file-integrity events into a central analytics platform for cross-source correlation.
  • Baseline normal CONNECT engine usage per application account and alert on deviations, especially path arguments outside expected directories.
  • Monitor the mysqld process for file writes to configuration, cron, or startup locations that could enable follow-on privilege escalation.

How to Mitigate CVE-2026-85985

Immediate Actions Required

  • Upgrade to MariaDB 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, or 13.0.2, matching the branch deployed in your environment.
  • Audit database accounts and revoke EXECUTE on the affected CONNECT UDFs where file access is not required.
  • Review recent query and audit logs for prior invocations of the vulnerable functions to identify potential data exposure.

Patch Information

The fix is tracked as MDEV-40323 and delivered in commit 4f66ca1b69daf1b7e6a562ca8e86d77a6a70abfe. It introduces filechk.cpp and filechk.h into the CONNECT engine build and wires explicit privilege and secure_file_priv checks into the JSON and BSON file UDFs. Release notes and binaries are available for 10.6.28, 10.11.19, 11.4.13, 11.8.9, 12.3.3, and 13.0.2. Full details are documented in MariaDB Security Advisory GHSA-2245-9hm3-wxf6.

Workarounds

  • Disable the CONNECT storage engine plugin on servers that do not require it by removing or commenting out the plugin load directive and restarting mysqld.
  • Restrict the operating-system permissions of the MariaDB service account so it cannot read or write sensitive directories outside its data path.
  • Explicitly revoke EXECUTE from PUBLIC and application roles on json_file, bson_file, jfile_make, bfile_make, and jbin_file until the upgrade is deployed.
bash
# Remove the CONNECT engine until patched binaries are deployed
mysql -u root -p -e "UNINSTALL SONAME 'ha_connect.so';"

# Revoke execute on the affected UDFs for non-privileged roles
mysql -u root -p <<'SQL'
REVOKE EXECUTE ON FUNCTION json_file  FROM 'app_user'@'%';
REVOKE EXECUTE ON FUNCTION bson_file  FROM 'app_user'@'%';
REVOKE EXECUTE ON FUNCTION jfile_make FROM 'app_user'@'%';
REVOKE EXECUTE ON FUNCTION bfile_make FROM 'app_user'@'%';
REVOKE EXECUTE ON FUNCTION jbin_file  FROM 'app_user'@'%';
SQL

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

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.