Database RCE From a Read-Nothing Account: 4 Engines Hit

By 12 min read
Database RCE research showing low-privilege SQL accounts reaching code execution in four engines

An account that cannot read a single application table should be harmless. A new piece of research shows that on PostgreSQL, MySQL and ClickHouse it was enough to get a shell on the database server.

In short: database RCE from a low-privilege account works because SQL grants only control which tables and schemas a user can touch, not which parts of the C and C++ engine their queries exercise. On 18 November 2026 depthfirst researcher Zheng Yu showed that accounts allowed only to create temporary objects could trigger memory-corruption bugs in the engine and run operating system commands as the database service user. All the bugs are fixed; the lesson about grants is not.

What is the Narrow Grants, Wide Engines research?

“Narrow Grants, Wide Engines: Reaching Native Database Attack Surface from Minimal SQL Roles” is a technical write-up by Zheng Yu of depthfirst, a security research company, published on 18 November 2026. It covers four products: PostgreSQL, MySQL, ClickHouse and Oracle Database.

The central claim is simple. A SQL grant decides which logical objects a role can use. It does not decide which code paths inside the engine a permitted statement reaches. Query optimizers, aggregate functions, prepared-statement handling and data-format parsers are all native code, and all of them are reachable from statements that need no access to anyone’s data.

Remote code execution (RCE) means an attacker can run their own commands on a machine they do not control. Here, the commands run as the operating system account the database service uses, such as postgres, mysql or clickhouse.

Six-stage flow from a low-privilege SQL login to an operating system command as the database user
None of the stages needs read access to application data; the temporary objects a session can create are the building blocks. Data: depthfirst.

Why it matters: SQL grants are not a sandbox

depthfirst argues the real boundary is the memory safety of everything the role can reach. Its takeaway section warns against reading a short list of grants as a small attack surface. If one bug in a reachable code path corrupts memory, the role’s permissions stop mattering, because the attacker is now running code inside the server process.

The research also points out why this is attractive to attackers: it cites the November 2026 DB-Engines ranking, where Oracle, MySQL and PostgreSQL hold three of the top four places. These are not niche products.

This is the same pattern depthfirst described earlier in its PHP work, which we covered in phpAfterShell: the PHP session flaw: a small, apparently harmless input surface leading to native memory corruption in a runtime everyone trusts.

Four headline figures: four engines, five flaws, one pre-login chain and zero known real attacks
Five flaws across four engines, one reachable before login, and no reported exploitation so far. Data: depthfirst, The Hacker News.

How does the PostgreSQL attack work? (CVE-2026-116331)

PostgreSQL describes CVE-2026-116331 as a type confusion in the min/max aggregate optimization, scored 8.8 under CVSS 3.0 with low privileges required. Its advisory says an object creator can run arbitrary code as the operating system user running the database.

The root cause

PostgreSQL lets users define their own aggregate functions. One option, SORTOP, tells the planner that an aggregate behaves like MIN or MAX, so it can answer the query with a quick index lookup instead of scanning every row.

A type confusion bug happens when code treats a value as one data type while it is really another. According to depthfirst, the planner shortcut skips the aggregate’s final function, so the declared return type and the real value no longer match. The executor can end up reading an 8-byte integer as if it were a pointer to text.

The upstream fix, committed on 9 November 2026 with Zheng Yu credited as reporter, makes the planner skip the shortcut whenever an aggregate’s input and output types differ. The commit message notes that such aggregate definitions might already exist in the wild, which is why the check happens at planning time.

Why a default role is enough

The key detail is privilege. depthfirst’s chain used a default login role with no extra grants. Such a role inherits the TEMPORARY privilege on the database, which depthfirst notes is granted to PUBLIC by default.

That lets the role create temporary tables, indexes, functions and aggregates in its own pg_temp schema. None of these touch application data. depthfirst then used the confusion to build a pointer leak, a bounded memory read to defeat address randomization (ASLR, which places code at unpredictable addresses), and finally control over a function pointer. Its proof of concept targets 64-bit builds.

Affected and fixed versions

Branch Fixed release
PostgreSQL 18 18.7
PostgreSQL 17 17.12
PostgreSQL 16 16.16
PostgreSQL 15 15.20
PostgreSQL 14 14.25

All five releases were published on 12 November 2026, according to the PostgreSQL security page.

How does the MySQL attack work? (CVE-2026-101786)

CVE-2026-101786 is an out-of-bounds write in MySQL’s windowed BIT_OR and BIT_AND handling. Oracle’s October 2026 MySQL advisory lists it under the Server: Optimizer component, affecting MySQL Server and MySQL Cluster 26.7.0 to 26.7.1.

The root cause

An out-of-bounds write means code writes past the end of the memory it allocated. MySQL’s fix commit, dated 8 September 2026, explains the mistake plainly: the per-bit counter array is sized when the statement is prepared, assuming 511 bytes for an argument whose type is not yet known. At execution, the bound value can be longer, and the update loop was guarded only by a debug assertion.

depthfirst puts numbers on it. The prepare step allocates 4,088 counters, or 32,704 bytes. Binding a longer binary value at execution makes the code increment memory beyond that array. The fix now rejects oversized operands at runtime with a dedicated error.

The privilege gap

Here the vendor and the researcher disagree. Oracle scores the flaw 7.2 and lists privileges required as High. depthfirst says its chain ran on the official 26.7.0 image from an account holding only CREATE TEMPORARY TABLES ON *.*, with no SELECT on application tables. The Hacker News called this narrower than the rating suggests.

Bar chart of vendor CVSS scores for the Oracle Text, PostgreSQL and MySQL flaws
MySQL's 7.2 assumes high privileges, yet the proof of concept needed only temporary-table rights. The Oracle score is as reported by depthfirst. Data: PostgreSQL, Oracle MySQL advisory, depthfirst.

How does the ClickHouse attack work?

ClickHouse is a column-oriented analytics database often exposed over HTTP. The bug sits in how it reads strings in RowBinary, a compact binary input format. The sources name no CVE for it.

The root cause

An integer overflow happens when a number grows past the largest value its type can hold and wraps around to a small one. The ClickHouse fix, pull request 115702, opened on 21 August and merged on 4 September 2026, explains that the string reader’s only size limit was the format_binary_max_string_size setting, which is documented as disabled when set to 0. With it disabled, a size close to 2^64 wrapped the offset, and data was copied past the end of the column buffer.

depthfirst says an unprivileged HTTP caller could set that option to zero in the query string under the default configuration. Its proof of concept on version 26.7.5.10 needed only CREATE TEMPORARY TABLE ON *.* and produced a shell as the clickhouse service account, using an overflow of about 6,144 bytes.

The fix

The pull request adds a hard limit that is always enforced, regardless of the user-facing setting, and makes another size calculation use a 128-bit integer that cannot wrap. ClickHouse told The Hacker News the issue arrived through its bug bounty, the fix is in 26.9 and later, and it was backported to 26.8.3.41, 26.7.7.30, 26.6.5.55 and 26.3.32.8.

What about Oracle Database?

The Oracle chain is different in kind: according to depthfirst, it needs no database account at all. The researcher describes an unauthenticated attacker who can reach an exposed HTTP endpoint and smuggle a crafted document into the database, then run commands as the database’s operating system user.

depthfirst says the chain combines CVE-2026-114819 in Oracle Text, rated CVSS 9.9 and fixed in Oracle’s November 2026 update, with CVE-2026-91609, a flaw in the GraphQL interface of Oracle REST Data Services (ORDS) disclosed in October. The Hacker News adds that Oracle rates neither bug as exploitable without login on its own.

We could not open Oracle’s own November advisory page during this research (it refused automated access), so the Oracle scores and versions here are as reported by depthfirst and The Hacker News. Because Oracle is closed source, depthfirst gives no root-cause walkthrough for it.

Which products and versions are affected?

Product Flaw Minimum access in the PoC Fixed in
PostgreSQL CVE-2026-116331, type confusion Default login role (TEMP via PUBLIC) 18.7, 17.12, 16.16, 15.20, 14.25
MySQL CVE-2026-101786, out-of-bounds write CREATE TEMPORARY TABLES ON . October 2026 update (affects 26.7.0 to 26.7.1)
ClickHouse No CVE named, integer overflow CREATE TEMPORARY TABLE ON . 26.9+, backports to 26.8, 26.7, 26.6, 26.3
Oracle Database CVE-2026-114819 plus CVE-2026-91609 None, HTTP access to exposed ORDS November and October 2026 updates

How to check your exposure

  1. List versions. SELECT version(); on PostgreSQL and MySQL, and SELECT version() on ClickHouse. Compare with the table above.
  2. List who can create temporary objects. On PostgreSQL, check whether PUBLIC still holds TEMPORARY on each database. On MySQL and ClickHouse, search grants for CREATE TEMPORARY TABLES given globally.
  3. Find exposed interfaces. Inventory ORDS endpoints reachable from the internet and ClickHouse HTTP ports reachable beyond trusted application hosts.
  4. Include managed services. Ask your cloud provider which engine minor version your managed instances run and when the fix was applied, as depthfirst’s FAQ advises coordinating with the provider.
Timeline from the ClickHouse fix in September 2026 to the depthfirst publication on 18 November
Every fix shipped before the research went public, so patched systems were protected on publication day. Data: GitHub, MySQL, PostgreSQL, depthfirst.

How do you detect low-privilege database RCE attempts?

depthfirst gives no detection guidance, and The Hacker News reports no in-the-wild use, so there are no published indicators. The ideas below are our own suggestions for defenders, based on the behaviour the research describes.

Database logs

  • PostgreSQL: log DDL (log_statement = 'ddl') and alert when a non-administrative role runs CREATE AGGREGATE with a SORTOP option, especially in pg_temp. Ordinary application roles rarely define aggregates.
  • MySQL: watch for prepared statements that use windowed BIT_OR or BIT_AND with large binary parameters, and for the new oversized-operand error after patching, which signals someone tried.
  • ClickHouse: search system.query_log for queries that set format_binary_max_string_size to 0, and for RowBinary inserts from accounts that normally only read.

Host and process signals

  • The strongest signal on any engine is the database service account starting a shell or a network tool. A postgres, mysqld or clickhouse-server process spawning sh, bash, curl or similar should be rare enough to alert on directly.

ATT&CK mapping

The sources publish no MITRE ATT&CK mapping. Our reading: the Oracle chain fits T1190 (Exploit Public-Facing Application), and the authenticated chains fit T1068 (Exploitation for Privilege Escalation), because they turn a database role into operating system code execution.

How do you mitigate it?

  1. Patch first. PostgreSQL 18.7, 17.12, 16.16, 15.20 or 14.25; the October 2026 MySQL update for 26.7 builds; ClickHouse 26.9 or the listed backports; Oracle’s October and November 2026 updates.
  2. Revoke default temporary rights in PostgreSQL where applications do not need them, by removing TEMPORARY from PUBLIC on each database and granting it back only to roles that use temp tables. Test first, since some ORMs and reporting tools rely on temp tables.
  3. Stop granting CREATE TEMPORARY TABLES ON *.* in MySQL and ClickHouse to accounts that only read or write fixed tables.
  4. Lock down ClickHouse settings. Check whether ordinary users can change format settings such as format_binary_max_string_size per query, and restrict that where your version allows.
  5. Keep ORDS and ClickHouse HTTP off the internet unless there is a clear need, and put authentication and network filtering in front of what remains.
  6. Assume a stolen low-privilege password can mean a server compromise. Rotate database credentials found in code or CI, and run the database service under an operating system account with as little access as possible, so a shell there reaches little else.

How does this compare with earlier runtime bugs?

The research fits a run of 2026 findings where trusted runtimes, not applications, were the weak point. The comparison below uses articles we have already published.

Case Runtime Entry point Needed access
Narrow Grants, Wide Engines PostgreSQL, MySQL, ClickHouse, Oracle SQL statements, HTTP for Oracle Temp-object rights, or none for Oracle
phpAfterShell PHP Session data Web request plus a usable gadget chain
Java4Shell OpenJDK Base64 decoding Input reaching the decoder
Ruby2Shell Ruby Case conversion String input reaching the conversion

The common thread is that the attacker does not need a feature that looks dangerous. They need a path into native code that handles their input. For databases, a SQL session is that path.

Is it as bad as it sounds? The limits

There are real limits, and they matter for prioritisation.

  • No known exploitation. The Hacker News reports none of the five flaws has been seen in a real attack, and that it did not independently reproduce the full chains.
  • No public exploit code. depthfirst describes the techniques in detail but did not release working exploits.
  • Build-specific. depthfirst says its proofs of concept target the tested builds and configurations: 64-bit PostgreSQL, the MySQL 26.7.0 image and ClickHouse 26.7.5.10 with defaults. Real deployments may need extra work.
  • An account is still required for three of the four engines. An attacker needs a valid login first, from a leaked connection string, SQL injection in an app, or a compromised service.
  • Fixes predate disclosure. Every vendor shipped a fix before the write-up, so the window is about patch lag, not a zero-day.

None of that changes the underlying point. Patching closes these five bugs; the next memory-safety bug in reachable engine code will reopen the same path.

Open questions

  • Oracle versions and scoring. We could not verify Oracle’s own advisory entries. The Hacker News lists affected Oracle Text and ORDS versions; check them against Oracle’s advisory with your support account.
  • MySQL privileges. Oracle says High; depthfirst’s chain says otherwise. If you hand out temporary-table rights broadly, treat the bug as more serious than its score.
  • Other branches. Oracle’s advisory lists only 26.7.0 to 26.7.1 as affected supported versions for CVE-2026-101786. Whether older branches share the code is not stated in the sources.
  • AI assistance. The write-up does not say how the bugs were found.
  • Managed services. The sources do not say when cloud providers rolled out each fix.

The bottom line

A database account that can only create temporary objects was enough to run commands on unpatched PostgreSQL, MySQL and ClickHouse servers, and an exposed ORDS endpoint was enough for Oracle. Patch all four, strip temporary-object rights from accounts that do not need them, and stop treating a narrow SQL grant as a security boundary.

Sources

This article is written for defenders and authorised security testers. Only test systems you own or have written permission to assess.

Frequently asked questions

What is the Narrow Grants, Wide Engines research?

It is a depthfirst write-up by Zheng Yu, published on 18 November 2026. It shows that SQL accounts with almost no permissions can still reach memory-corruption bugs in database engine code and use them to run operating system commands on PostgreSQL, MySQL and ClickHouse servers.

What is CVE-2026-116331?

CVE-2026-116331 is a PostgreSQL type confusion in the min/max aggregate optimization. PostgreSQL scores it 8.8 and says an object creator can run code as the database's operating system user. It is fixed in 18.7, 17.12, 16.16, 15.20 and 14.25, released on 12 November 2026.

Can a read-only database user get remote code execution?

According to depthfirst, yes on unpatched builds, if the user can create temporary objects. Its PostgreSQL chain used a default login role with no extra grants, and its MySQL and ClickHouse chains needed only CREATE TEMPORARY TABLES ON *.*.

Which MySQL versions are affected by CVE-2026-101786?

Oracle's October 2026 MySQL advisory lists MySQL Server and MySQL Cluster 26.7.0 to 26.7.1 as affected. Oracle scores it 7.2 with high privileges required, while depthfirst reached code execution with only the CREATE TEMPORARY TABLES privilege.

Is the ClickHouse RowBinary bug a CVE?

No CVE is named in the sources. The fix is ClickHouse pull request 115702, merged on 4 September 2026. ClickHouse told The Hacker News the fix is in 26.9 and later and was backported to 26.8, 26.7, 26.6 and 26.3 branches.

Does revoking TEMPORARY stop these database RCE attacks?

It removes the building blocks the PostgreSQL, MySQL and ClickHouse chains relied on, but patching is the real fix. It does nothing against the Oracle chain, which depthfirst says starts before any login and so bypasses SQL role checks.

Are these database exploits being used in the wild?

The Hacker News reports that none of the five flaws has been seen in a real attack and that the full chains were not independently reproduced. depthfirst did not release exploit code.

How do I check if my PostgreSQL server is vulnerable?

Run SELECT version(); and compare it with the fixed releases 18.7, 17.12, 16.16, 15.20 and 14.25. Any earlier minor release on those branches is affected according to the PostgreSQL advisory.

Keep reading

database RCEPostgreSQLMySQLClickHouseOracle Databaseleast privilegevulnerability research