GitHub Actions A Cloudy Day for Security - Part 1 #207
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤖 Automated Content Update
This PR was automatically generated by the HackTricks News Bot based on a technical blog post.
📝 Source Information
🎯 Content Summary
Scope: Part 1 of a two‑part series on hardening GitHub Actions against adversaries with read or write (contributor) access. It explains how workflow expressions are rendered, how script injection leads to code execution on runners, why YAML‑only defenses are bypassable by collaborators, and how to correctly use branch protections, environments, and tag protections to enforce a four‑eyes principle. No CVEs; this is about design/usage pitfalls.
How GitHub Actions work: Workf...
🔧 Technical Details
Script injection via workflow expressions: Any user‑controlled context (e.g.,
github.event.issue.title) interpolated directly into arun:step becomes part of the shell program after rendering, enabling command substitution and arbitrary code execution (e.g., issue title$(id)). Mitigation: first map context toenv:, then reference with shell variables ($TITLE), never${{ env.TITLE }}in the command.Reader‑triggered execution paths: Treat contexts from
issues,issue_comment,discussion(_comment),fork,watch,pull_request(_review)(_comment), andpull_request_targetas untrusted because readers can trigger them (sometimes indirectly viaworkflow_run/workflow_call). Validate event fields case‑by‑case using GitHub’s risky‑context guidance.Secrets exfiltr...
🤖 Agent Actions
I analyzed the blog and the existing HackTricks GitHub Actions content, explored the repository, and implemented updates to the most relevant pages. The core new technical material is about expression/script injection in GitHub Actions, the correct mitigation pattern, and the governance controls needed to prevent collaborators from bypassing YAML-internal restrictions. I also added a collaborator-level secrets exfiltration PoC and strengthened guidance for branch, environment, and tag protections.
Summary of changes made:
Why these locations:
References added (where applicable):
No new files were created; instead, I filled in and enhanced the existing, intended sections to preserve structure and navigability.
This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.
📚 Repository Maintenance
All .md files have been checked for proper formatting (headers, includes, etc.).
🗑️ File Cleanup