PostgreSQL COPY PROGRAM Command Execution
Identifies PostgreSQL "COPY" statements that invoke an operating-system command through the "PROGRAM" option. A superuser or role with "pg_execute_server_program" can use this feature to execute arbitrary commands as…
Description
Identifies PostgreSQL "COPY" statements that invoke an operating-system command through the "PROGRAM" option. A superuser or role with "pg_execute_server_program" can use this feature to execute arbitrary commands as the PostgreSQL service account, a technique used after credential compromise and by cryptomining campaigns.
Detection logic
Its licence does not clear it for publishing here
Sunturai publishes a detection's own text where the licence it arrived under has been reviewed and permits it, and Elastic License 2.0 has not. The query as its source wrote it, its canonical form and the hash that pins this revision are in the workspace record.
Detection requirements
- Platform
- ContainersESXiIaaSIdentity ProviderLinuxmacOSNetwork DevicesOffice SuiteSaaSWindows
The rule states no platform. This is derived from the ATT&CK technique it maps to.
- Log source category
- event_index
Known benign triggers
- Database administrators and scheduled data-processing jobs may legitimately use COPY PROGRAM for import or export workflows. Confirm the command, client address, database role, maintenance context, and resulting process activity before escalating.
MITRE ATT&CK mappings
0 exclusive techniques.This is coverage no other published rule has; it is not this rule's total technique count.
References
| Reference | Cited by |
|---|---|
| attack.mitre.org/techniques/T1059/ | 7from 2 sources |
| www.aquasec.com/blog/pg_mem-a-malware-hidden-in-the-postgres-processes/ | Only this detection cites it |
| www.postgresql.org/docs/current/sql-copy.html | 2from 2 sources |
| www.wiz.io/blog/postgresql-cryptomining | Only this detection cites it |
From the source
- At source
- Open at source
- Upstream identifier
- 8ab64631-17ee-46b9-9800-9acacbeee1b3
- Tagged by the source as
- Data Source: Network Packet CaptureDomain: NetworkNoise: UnknownPerformance: FastResources: Investigation GuideRule Type: Event Correlation (EQL)Tactic: ExecutionUse Case: Network Security MonitoringUse Case: Threat Detection
Licence
- Published under
- Elastic License 2.0Read the licence
- Attribution
- Required
Authorship
- Written by
- Published
- Sep 20, 2026
- Version
- 3