Back to Intelligence

Low-Privilege Database Accounts Turned Into Server Code Execution: Defending PostgreSQL, MySQL, Oracle, and ClickHouse Against SQL-Reachable Memory Corruption

SA
Security Arsenal Team
November 19, 2026
11 min read

Every database security program I have ever assessed rests on one foundational assumption: a low-privilege database account — one that cannot read a single application table — is a low-risk account. New research published this week shatters that assumption across the four most widely deployed database engines in enterprise environments.

A security researcher has released working proof-of-concept exploits demonstrating that an unprivileged database user can reach memory-corruption bugs deep inside the database engine itself, simply by issuing ordinary SQL. No table read access required. No elevated privileges required. The demonstrated PoCs cover PostgreSQL, MySQL, and ClickHouse, alongside a separate exploitation chain against Oracle that similarly requires no special privileges.

If you run any of these engines — and in most environments I walk into, at least two of them are present — your "read-only service account" and your "reporting user" just became a potential remote code execution primitive on the database host. That means lateral movement, data exfiltration, and ransomware staging all starting from an account your risk register marked as low.

This is a defense-first write-up: what the technique means, how to detect exploitation attempts in your SOC, and how to shrink the attack surface before weaponized variants start circulating.

Technical Analysis

What the Researcher Demonstrated

The core insight is architectural, not a single isolated bug. Modern database engines are enormous C/C++ codebases. The SQL parser, the type system, the function evaluation layer, the wire protocol handlers, and extension/plugin frameworks all parse and transform attacker-influenced input. Any memory-corruption class bug in that code — out-of-bounds read/write, use-after-free, type confusion, integer overflow — is reachable by any authenticated session that can submit SQL, regardless of what objects that session has been granted access to.

The researcher's PoCs weaponize this reality:

  • PostgreSQL — corruption bugs reachable through SQL-level constructs in engine code (function evaluation / type handling paths), chained to arbitrary code execution in the context of the postgres OS user.
  • MySQL — similar engine-level reachability through ordinary query constructs, yielding code execution as the mysql service account.
  • ClickHouse — memory corruption reachable via its SQL dialect, notable because ClickHouse is often deployed as a "less sensitive" analytics node and is correspondingly less hardened and less monitored.
  • Oracle — a separate multi-step chain requiring no elevated database privileges, demonstrating code execution on Oracle server hosts.

No CVE identifiers have been published in the initial disclosure, and the vendor patching cycle will likely address the individual bugs one at a time. That is exactly why this matters for defenders: the technique class outlives any single patch. Engine-level memory safety problems are endemic to these codebases; the fix is layered defense, not one hotfix.

Why Low Privilege Is Sufficient

Privilege checks in a database engine gate object access (SELECT on a table, EXECUTE on a procedure). They do not gate code reachability. A user with nothing but CONNECT permission still drives the parser, the optimizer, the type system, and every built-in function the engine exposes. The exploit chain never needs to touch an application table — it only needs to reach a vulnerable code path with attacker-controlled data, then convert memory corruption into controlled execution.

Post-Exploitation Reality

Code execution as the database service account is not the endgame — it is the beachhead:

  • The service account owns the database files themselves, so all "low privilege" grants become irrelevant the moment the host is compromised.
  • Database servers frequently hold service accounts, backup credentials, and linked-server / dblink / foreign-data-wrapper credentials that enable lateral movement.
  • Historically, attackers have used classic post-RCE primitives on these platforms — MySQL UDF libraries, PostgreSQL shared libraries loaded via shared_preload_libraries or CREATE FUNCTION, xp_cmdshell-style command execution, and ClickHouse's executable table functions — to establish persistence and execute OS commands. Expect those exact techniques to follow any public exploitation of this research.

Exploitation Status

  • Status: Public proof-of-concept code exists and was published with the research (yesterday, November 2026).
  • CISA KEV: Not listed at time of writing — monitor, as public PoC for enterprise database engines is a strong KEV candidate.
  • Confirmed in-the-wild exploitation: Not yet reported. Treat the PoC publication as the start of the 24–72 hour weaponization window that typically follows high-visibility database RCE research.

Detection & Response

The most reliable, low-noise detections here are not signature-based bug hunting — you cannot write a SIEM rule for a memory-corruption gadget. What you can detect with near-zero false positives is the post-exploitation behavior: the database server process spawning shells, loading unexpected shared libraries, or making unusual outbound network connections. In a healthy environment, postgres, mysqld, mariadbd, oracle/tnslsnr, and clickhouse-server never spawn cmd.exe, powershell.exe, sh, or bash as child processes. Any occurrence is a breach-level event.

Sigma Rules

YAML
---
title: Database Server Process Spawning Shell (Windows)
id: 3f8c2a91-7b4e-4d2a-9c61-8e5f0a1b2c3d
status: experimental
description: Detects database server processes (mysqld, postgres, mariadbd, oracle) spawning command shells or script interpreters, consistent with post-exploitation following database engine RCE.
references:
  - https://thehackernews.com/2026/11/researcher-demonstrates-database-rce.html
  - https://attack.mitre.org/techniques/T1059/
author: Security Arsenal
date: 2026/11/20
tags:
  - attack.execution
  - attack.t1059
logsource:
  category: process_creation
  product: windows
detection:
  selection_parent:
    ParentImage|endswith:
      - '\mysqld.exe'
      - '\mysqld-nt.exe'
      - '\mariadbd.exe'
      - '\postgres.exe'
      - '\oracle.exe'
      - '\tnslsnr.exe'
  selection_child:
    Image|endswith:
      - '\cmd.exe'
      - '\powershell.exe'
      - '\pwsh.exe'
      - '\wscript.exe'
      - '\cscript.exe'
      - '\rundll32.exe'
      - '\mshta.exe'
      - '\regsvr32.exe'
  condition: selection_parent and selection_child
falsepositives:
  - Database maintenance jobs that legitimately invoke shells (rare — verify and document)
level: critical
---
title: Database Server Process Spawning Shell (Linux)
id: 9d1e4b07-3c5f-4a8e-b2d7-6f0a9c4e8b1d
status: experimental
description: Detects Linux database daemons (postgres, mysqld, mariadbd, clickhouse-server, oracle) spawning shells, interpreters, or download utilities, consistent with engine-level RCE post-exploitation.
references:
  - https://thehackernews.com/2026/11/researcher-demonstrates-database-rce.html
  - https://attack.mitre.org/techniques/T1059/
author: Security Arsenal
date: 2026/11/20
tags:
  - attack.execution
  - attack.t1059
logsource:
  category: process_creation
  product: linux
detection:
  selection_parent:
    ParentImage|endswith:
      - '/postgres'
      - '/mysqld'
      - '/mariadbd'
      - '/clickhouse-server'
      - '/oracle'
      - '/tnslsnr'
  selection_child:
    Image|endswith:
      - '/sh'
      - '/bash'
      - '/dash'
      - '/zsh'
      - '/python'
      - '/python3'
      - '/perl'
      - '/curl'
      - '/wget'
      - '/nc'
      - '/ncat'
      - '/socat'
  condition: selection_parent and selection_child
falsepositives:
  - Backup/ETL wrappers calling database utilities (these use mysql/pg_dump as the child, not the parent — validate any hits)
level: critical
---
title: Suspicious Shared Library or UDF Load in Database Plugin Paths
id: c4a7f2e8-1d6b-4e93-a5c2-7f8d1e3b9a06
status: experimental
description: Detects file creation of shared objects in database plugin, library, or extension directories, a classic persistence/execution technique via MySQL UDFs or PostgreSQL shared library loading.
references:
  - https://thehackernews.com/2026/11/researcher-demonstrates-database-rce.html
  - https://attack.mitre.org/techniques/T1505/
author: Security Arsenal
date: 2026/11/20
tags:
  - attack.persistence
  - attack.t1505
logsource:
  category: file_event
  product: linux
detection:
  selection_path:
    TargetFilename|contains:
      - '/usr/lib/mysql/plugin/'
      - '/usr/lib64/mysql/plugin/'
      - '/var/lib/postgresql/'
      - '/usr/lib/postgresql/'
      - '/usr/lib64/pgsql/'
      - '/usr/lib/clickhouse/'
  selection_ext:
    TargetFilename|endswith:
      - '.so'
      - '.so.'
  condition: selection_path and selection_ext
falsepositives:
  - Legitimate package installation or extension deployment during maintenance windows
level: high

Microsoft Sentinel / Defender KQL

This hunt query covers both Windows (via Defender process telemetry) and Linux database hosts (via Syslog/CEF ingestion), catching both the shell-spawn behavior and suspicious library loads.

KQL — Microsoft Sentinel / Defender
// Hunt 1: Database server processes spawning shells/interpreters
let DbProcNames = dynamic(["postgres", "mysqld", "mariadbd", "oracle", "tnslsnr", "clickhouse-server"]);
let ShellNames = dynamic(["cmd.exe", "powershell.exe", "pwsh.exe", "mshta.exe", "rundll32.exe", "sh", "bash", "dash", "python", "python3", "perl", "curl", "wget", "nc", "ncat", "socat"]);
DeviceProcessEvents
| where InitiatingProcessFileName in~ (DbProcNames)
| where FileName in~ (ShellNames)
| project TimeGenerated, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine, FileName, ProcessCommandLine, AccountName, ReportId
| order by TimeGenerated desc
;
// Hunt 2 (run separately): Suspicious auth activity against database services via Syslog
Syslog
| where ProcessName has_any ("postgres", "mysqld", "mariadbd", "clickhouse")
| where SyslogMessage has_any ("failed", "authentication failed", "invalid user", "no pg_hba.conf entry")
| summarize AuthFailures = count() by Computer, ProcessName, bin(TimeGenerated, 1h)
| where AuthFailures > 25
| order by AuthFailures desc

Velociraptor VQL

Use this artifact across your database server fleet to identify database daemons with anomalous child processes or unexpected network listeners.

VQL — Velociraptor
-- Hunt database server processes spawning shells or holding unusual connections
SELECT Pid, Ppid, Name, CommandLine, Exe, Username, CreateTime
FROM pslist()
WHERE Name =~ '(postgres|mysqld|mariadbd|oracle|tnslsnr|clickhouse)'
   OR CommandLine =~ '(shared_preload_libraries|CREATE FUNCTION|plugin_dir)'

-- Correlate: enumerate network connections held by database processes
SELECT Pid, Name, Status, Family, Type, Laddr, Lport, Raddr, Rport
FROM netstat()
WHERE Name =~ '(postgres|mysqld|mariadbd|oracle|clickhouse)'
  AND Rport NOT IN (5432, 3306, 1521, 9000, 8123)
  AND Raddr != ''

Hardening & Verification Script

Run this on Linux database hosts to audit the highest-risk configuration surfaces this research targets: excessive privileges, writable plugin/library paths, dangerous preload settings, and unexpected shell children of database daemons.

Bash / Shell
#!/bin/bash
# Database RCE exposure audit - PostgreSQL / MySQL / MariaDB / ClickHouse
echo "=== [1] DB daemons with unexpected child processes (potential active compromise) ==="
for pid in $(pgrep -x postgres mysqld mariadbd clickhouse-server oracle 2>/dev/null); do
  ps --ppid "$pid" -o pid,comm,args --no-headers 2>/dev/null | grep -E '(sh|bash|python|perl|curl|wget|nc )' && echo "!! PID $pid has shell-like children"
done

echo "=== [2] PostgreSQL: shared_preload_libraries and session_preload_libraries ==="
sudo -u postgres psql -tAc "SHOW shared_preload_libraries; SHOW session_preload_libraries;" 2>/dev/null || echo "PostgreSQL not present"

echo "=== [3] PostgreSQL: roles with SUPERUSER / pg_execute_server_program ==="
sudo -u postgres psql -tAc "SELECT rolname, rolsuper FROM pg_roles WHERE rolsuper; SELECT grantee FROM information_schema.role_table_grants WHERE table_name='pg_execute_server_program';" 2>/dev/null

echo "=== [4] MySQL/MariaDB: users holding FILE or SUPER privileges ==="
mysql -NBe "SELECT user,host FROM mysql.user WHERE File_priv='Y' OR Super_priv='Y';" 2>/dev/null || echo "MySQL not present"

echo "=== [5] MySQL plugin directory integrity (UDF abuse surface) ==="
ls -la /usr/lib/mysql/plugin/ /usr/lib64/mysql/plugin/ 2>/dev/null | head -40
find /usr/lib*/mysql/plugin/ -name '*.so' -newermt '30 days ago' 2>/dev/null

echo "=== [6] Recently modified shared objects in DB library paths ==="
find /usr/lib/postgresql/ /usr/lib64/pgsql/ /usr/lib/clickhouse/ -name '*.so*' -newermt '30 days ago' 2>/dev/null

echo "=== [7] Network exposure of database listeners ==="
ss -tlnp 2>/dev/null | grep -E ':(5432|3306|1521|9000|8123|9009)' 

echo "=== [8] ClickHouse: dangerous settings (allow experimental features / executable tables) ==="
grep -iE 'allow_experimental|executable' /etc/clickhouse-server/config.xml /etc/clickhouse-server/users.xml 2>/dev/null || echo "ClickHouse not present"

echo "=== Audit complete. Review any '!!' findings immediately. ==="

Remediation

1. Patch and Track Vendor Advisories — Now

No CVE identifiers have been assigned in the initial disclosure, so patching today means ensuring you are on the latest maintenance release of every engine you operate and subscribing to each vendor's security mailing list so the follow-up fixes land on your change calendar the day they ship:

Watch CISA KEV daily for the next two weeks. Public PoC against enterprise database engines is a strong KEV candidate, and a KEV listing carries a binding remediation deadline for federal agencies and a de facto deadline for everyone else.

2. Enforce Real Least Privilege (Assume the Grant Check Can Be Bypassed)

  • Remove SUPERUSER, pg_execute_server_program, and pg_read/write_server_files from every PostgreSQL role that does not absolutely require them.
  • Strip FILE, SUPER, and CREATE UDF-adjacent privileges from MySQL accounts; the FILE privilege in particular is a direct path from SQL to filesystem writes.
  • Audit every service account that touches a database. If it only needs read access to three schemas, that is all it gets — and it gets a unique, rotating credential.
  • Rotate database credentials for any account that has been exposed in code repositories, CI logs, or configuration management. This research makes credential hygiene a code-execution problem, not just a data-access problem.

3. Disable the Execution Primitives

  • PostgreSQL: keep shared_preload_libraries restricted to known extensions; set session_preload_libraries and local_preload_libraries explicitly; disallow untrusted languages (plpythonu, plperlu) entirely.
  • MySQL: ensure plugin_dir is not writable by the mysql user or any database-reachable path; consider secure_file_priv set to a dedicated, non-executable directory (or NULL where operationally possible).
  • ClickHouse: disable executable table functions and experimental features in users.xml unless explicitly required; ClickHouse's convenience features are an RCE accelerant.
  • Oracle: audit DBMS_JAVA, external procedure (extproc) exposure, and default accounts; restrict CREATE ANY privileges.

4. Segment and Egress-Control Database Hosts

A database server should accept connections only from known application tiers, and it should initiate almost nothing outbound. Enforce egress deny-by-default on database VLANs and alert on any outbound connection from a DB host to a non-corporate destination — that is your second reliable tripwire after shell-spawn detection.

5. Operationalize the Detections Above This Week

Deploy the Sigma rules, validate the Sentinel hunts against your estate, and baseline what your database processes normally spawn. When (not if) weaponized exploits for this research begin circulating, the organizations that detect the child process — rather than the CVE — are the ones that contain it in minutes instead of discovering it in a ransom note.

Related Resources

Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.