GitHub Artifact Download from Cross-Fork Workflow
Description
The "download artifacts" API, and various custom actions encapsulating it, doesn't differentiate between artifacts that were uploaded by forked repositories and base repositories, which could lead privileged workflows to download artifacts that were created by forked repositories and that are potentially poisoned.
Query
Detection:
- Group:
- ID: CrossForkWorkflowRun
RuleID: GitHub.CrossFork.Workflow.Run
- ID: ArtifactDownload
RuleID: GitHub.Webhook.WorkflowArtifactDownload
MatchCriteria:
field_name:
- GroupID: CrossForkWorkflowRun
Match: workflow_run.id
- GroupID: ArtifactDownload
Match: workflow_job.run_id
EventEvaluationOrder: Chronological
LookbackWindowMinutes: 1800
Schedule:
RateMinutes: 1440
TimeoutMinutes: 10
Rule dependencies
⚠ Higher-order rule. It fires on other rules' alerts, not on raw events, so it cannot fire on its own. Deploy the rules it depends on too.
Depends on
-
correlates · Panther group
GitHub.CrossFork.Workflow.Runwithin 1800m -
correlates · Panther group
GitHub.Webhook.WorkflowArtifactDownloadwithin 1800m
Analyst notes
- Consider ensuring that the artifact download job uses the specific run_id for the generated artifact. It is recommended to specify which run id or commit hash to download the artifact from.
- Consider filtering out artifacts created from pull requests.
- Consider limiting the possibility for outside collaborators to trigger workflows.
- Sanitize cross-fork contents.