Attackers who reach a database server or obtain application credentials export tables with the vendor’s own utilities. That makes the process telemetry on database hosts and the query telemetry from the database engine the two best places to look. The goal is separating a person running a dump from the application doing its normal work.
Signals at a Glance
| Signal | Where | ATT&CK |
|---|---|---|
mysqldump, pg_dump or mongodump executed interactively or from a shell | Process creation, auditd | T1005 |
bcp ... out or sqlcmd -Q "SELECT ..." -o writing to a file | Process creation | T1005 |
| Query returning millions of rows to an account that normally returns hundreds | DB audit, pg_stat_statements | T1030 |
| Application account connecting from a new host or interactive tool | DB connection logs | T1078 |
| Large dump file appearing, then archived or transferred | File events | T1074.001 |
Dump Utilities on the Host
Dump utilities run regularly from backup jobs, so the discriminators are the parent process and the account. A dump launched from an interactive shell, a web-server process or a remote execution service is not a backup:
title: Database Dump Utility Launched From Interactive Or Web Context
logsource:
category: process_creation
detection:
tools:
Image|endswith:
- '/mysqldump'
- '/pg_dump'
- '/pg_dumpall'
- '/mongodump'
- '\\mysqldump.exe'
- '\\pg_dump.exe'
- '\\bcp.exe'
bcp_out:
CommandLine|contains: ' out '
sqlcmd_export:
Image|endswith: '\\sqlcmd.exe'
CommandLine|contains:
- ' -o '
- ' -Q '
suspicious_parent:
ParentImage|endswith:
- '/bash'
- '/sh'
- '/php-fpm'
- '/w3wp.exe'
- '\\cmd.exe'
- '\\powershell.exe'
condition: (tools or sqlcmd_export) and suspicious_parent
level: medium
# tune/validate: allowlist scheduled backup users and their parent job runners
Telemetry From the Engine
The engine knows how many rows each statement returned. PostgreSQL’s pg_stat_statements makes the check a single query, and SQL Server, MySQL and Oracle audit logs offer comparable fields:
-- PostgreSQL: statements returning very large result sets, by role
-- tune/validate: requires pg_stat_statements; reset or snapshot to measure windows
SELECT userid::regrole AS role,
calls,
rows,
round(rows::numeric / NULLIF(calls, 0)) AS rows_per_call,
left(query, 120) AS query_sample
FROM pg_stat_statements
WHERE rows > 1000000
AND query ILIKE 'select%'
ORDER BY rows DESC
LIMIT 50;
- Compare each account against its own history. A reporting role returning a million rows nightly is routine; the same role returning ten million at 02:00 from a new client address is not.
- Alert on authentication to the database from a host that is not in the application tier, using connection logs or the firewall in front of the database.
- Restrict direct database access for administrators through a bastion or PAM tool, so interactive dumps are logged and attributable.
- Watch for the dump file afterwards: a new large
.sql,.bakor.csvfile in a temp directory is a staging indicator.
SigmaHQ and Elastic rules for database utility abuse, Splunk ESCU analytics for SQL Server and MySQL audit data, vendor audit-logging documentation, and Falco or auditd rules on database hosts. Baseline your own environment — backup tooling, ETL and reporting jobs legitimately export large datasets.
Build Detections That Fire
Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.
- Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
- Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
- 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Stay ahead of emerging threats. Get notified when we publish new intelligence reports and advisories.
Subscribe to Alerts