GitHub Actions Workflow Run Rapidly Deleted
editGitHub Actions Workflow Run Rapidly Deleted
editDetects when a GitHub Actions workflow run is deleted within 30 minutes of its creation. Adversaries who abuse Actions for execution or secret theft may delete short-lived runs afterward to remove job logs that show the malicious steps.
Rule type: esql
Rule indices: None
Severity: low
Risk score: 21
Runs every: 5m
Searches indices from: now-39m (Date Math format, see also Additional look-back time)
Maximum alerts per execution: 100
References:
Tags:
- Domain: Cloud
- Domain: SaaS
- Platform: GitHub
- Use Case: Threat Detection
- Tactic: Defense Evasion
- Data Source: Github
- Data Source: GitHub Audit Logs
- Service: GitHub Actions
- Rule Type: ES|QL
- Resources: Investigation Guide
Version: 1
Rule authors:
- Elastic
Rule license: Elastic License v2
Investigation guide
editTriage and analysis
Investigating GitHub Actions Workflow Run Rapidly Deleted
workflows.delete_workflow_run is recorded when a run is deleted. GitHub does not always emit a separate audit event for deleting only the logs; the run deletion itself is the reliable cover-up signal. This rule correlates workflow-run creation and deletion events for the same organization, repository, and workflow when they occur within 30 minutes.
Possible investigation steps
-
Review
user.name,github.repo,github.data.workflow_id, and the correlated creation and deletion timestamps. - Determine which workflow file ran and whether it was recently added or modified.
-
Look for
git.pushbygithub-actions[bot]or unexpectedGITHUB_TOKENusage around the same time. -
Check org/repo secrets access (
api.requestfor secrets) from the same actor.
False positive analysis
- Admins pruning old CI history.
- Tools that delete runs after collecting artifacts.
Response and remediation
- If unauthorized, disable the suspect workflow and rotate secrets used by Actions.
-
Review commits to
.github/workflows/and restrictGITHUB_TOKENpermissions. - Preserve remaining Actions logs and audit events for the incident window.
Rule query
editFROM logs-github.audit-*
| WHERE event.module == "github" AND data_stream.dataset == "github.audit"
AND event.action IN (
"workflows.created_workflow_run",
"workflows.delete_workflow_run"
)
| EVAL
Esql.is_workflow_run_created = event.action == "workflows.created_workflow_run",
Esql.is_workflow_run_deleted = event.action == "workflows.delete_workflow_run"
| STATS
Esql.workflow_run_created_count = SUM(CASE(Esql.is_workflow_run_created, 1, 0)),
Esql.workflow_run_deleted_count = SUM(CASE(Esql.is_workflow_run_deleted, 1, 0)),
Esql.workflow_run_created_at = MIN(CASE(Esql.is_workflow_run_created, @timestamp, null)),
Esql.workflow_run_deleted_at = MAX(CASE(Esql.is_workflow_run_deleted, @timestamp, null)),
user.name = VALUES(user.name),
github.actor_ip = VALUES(github.actor_ip),
github.hashed_token = VALUES(github.hashed_token),
github.programmatic_access_type = VALUES(github.programmatic_access_type),
github.user_agent = VALUES(github.user_agent),
github.data.workflow_run_id = VALUES(github.data.workflow_run_id)
BY github.org, github.repo, github.data.workflow_id
| EVAL Esql.time_diff_seconds = DATE_DIFF(
"second", Esql.workflow_run_created_at, Esql.workflow_run_deleted_at
)
| WHERE Esql.workflow_run_created_count > 0
AND Esql.workflow_run_deleted_count > 0
AND Esql.time_diff_seconds >= 0
AND Esql.time_diff_seconds <= 1800
AND DATE_DIFF("minute", Esql.workflow_run_deleted_at, NOW()) <= 10
| KEEP
Esql.workflow_run_created_at,
Esql.workflow_run_deleted_at,
Esql.time_diff_seconds,
Esql.workflow_run_created_count,
Esql.workflow_run_deleted_count,
user.name,
github.org,
github.repo,
github.actor_ip,
github.hashed_token,
github.programmatic_access_type,
github.user_agent,
github.data.workflow_id,
github.data.workflow_run_id
Framework: MITRE ATT&CKTM
-
Tactic:
- Name: Defense Evasion
- ID: TA0005
- Reference URL: https://attack.mitre.org/tactics/TA0005/
-
Technique:
- Name: Indicator Removal
- ID: T1070
- Reference URL: https://attack.mitre.org/techniques/T1070/