Title: Security: Branch name injection in `pr-auto-commit.yaml` — actively exploited by hackerbot-claw · Issue #7311 · RustPython/RustPython · GitHub
Open Graph Title: Security: Branch name injection in `pr-auto-commit.yaml` — actively exploited by hackerbot-claw · Issue #7311 · RustPython/RustPython
X Title: Security: Branch name injection in `pr-auto-commit.yaml` — actively exploited by hackerbot-claw · Issue #7311 · RustPython/RustPython
Description: Summary The pr-auto-commit.yaml workflow is vulnerable to shell command injection via branch names. The ${{ github.event.pull_request.head.ref }} expression is interpolated directly into run: blocks without sanitization, allowing an atta...
Open Graph Description: Summary The pr-auto-commit.yaml workflow is vulnerable to shell command injection via branch names. The ${{ github.event.pull_request.head.ref }} expression is interpolated directly into run: block...
X Description: Summary The pr-auto-commit.yaml workflow is vulnerable to shell command injection via branch names. The ${{ github.event.pull_request.head.ref }} expression is interpolated directly into run: block...
Opengraph URL: https://github.com/RustPython/RustPython/issues/7311
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Security: Branch name injection in `pr-auto-commit.yaml` — actively exploited by hackerbot-claw","articleBody":"## Summary\n\nThe `pr-auto-commit.yaml` workflow is vulnerable to **shell command injection via branch names**. The `${{ github.event.pull_request.head.ref }}` expression is interpolated directly into `run:` blocks without sanitization, allowing an attacker to execute arbitrary commands on the GitHub Actions runner with access to repository secrets (including `AUTO_COMMIT_PAT`).\n\n**This vulnerability has already been exploited.** On March 2, 2026, the account [`hackerbot-claw`](https://github.com/hackerbot-claw) — an autonomous bot that has been [attacking CI/CD pipelines across major open source projects](https://www.stepsecurity.io/blog/hackerbot-claw-github-actions-exploitation) — opened two PRs ([#7308](https://github.com/RustPython/RustPython/pull/7308), [#7309](https://github.com/RustPython/RustPython/pull/7309)) with a malicious branch name designed to trigger code execution. The payload partially executed on the CI runner but failed due to a base64 encoding issue — not because of any security control.\n\n## Vulnerable Code\n\n**File:** `.github/workflows/pr-auto-commit.yaml`\n\n**Primary injection point — \"Push formatting changes\" step (line ~97):**\n\n```yaml\n- name: Push formatting changes\n if: steps.check-changes.outputs.has_changes == 'true'\n run: |\n git push origin HEAD:${{ github.event.pull_request.head.ref }}\n```\n\n**Secondary injection point — \"Comment on PR\" step (line ~119):**\n\n```yaml\ngit pull origin ${{ github.event.pull_request.head.ref }}\n```\n\nBecause the workflow uses `pull_request_target`, it runs in the context of the base repository with access to secrets and write permissions. The attacker controls the branch name (`head.ref`) via their fork.\n\n### Evidence from workflow runs\n\n- **[Run 22563211110](https://github.com/RustPython/RustPython/actions/runs/22563211110)** (PR #7308): The injection step was **skipped** because `has_changes` was `false` — the trivial change to `bench.sh` didn't trigger formatting differences.\n\n- **[Run 22563415110](https://github.com/RustPython/RustPython/actions/runs/22563415110)** (PR #7309): The injection step **executed**. The build log shows `base64: invalid input`, confirming the shell evaluated the command substitution. The full payload failed due to an encoding issue in the branch name, but the `base64 -d` command did run on the runner.\n\n## Impact\n\nIf the payload had succeeded, the attacker would have had access to:\n\n- **`AUTO_COMMIT_PAT`** — a Personal Access Token available as a secret in this workflow, which could be used to push commits, modify code, or potentially take over the repository (similar to [what happened to aquasecurity/trivy](https://www.stepsecurity.io/blog/hackerbot-claw-github-actions-exploitation#attack-6-aquasecuritytrivy--full-repository-compromise) in the same campaign)\n- **`GITHUB_TOKEN`** with `contents: write` and `pull-requests: write` permissions\n\n## Context\n\nhttps://www.stepsecurity.io/blog/hackerbot-claw-github-actions-exploitation\n","author":{"url":"https://github.com/varunsh-coder","@type":"Person","name":"varunsh-coder"},"datePublished":"2026-03-02T06:43:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/7311/RustPython/issues/7311"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9bc7e69b-8129-fce9-b6c0-938d3755893c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C68A:15BB49:181C068:1FBD61B:6A5C703A |
| html-safe-nonce | b4a927068f0e37b5f898192eb41572136b0dbfd980359069356d8847ce484f17 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjhBOjE1QkI0OToxODFDMDY4OjFGQkQ2MUI6NkE1QzcwM0EiLCJ2aXNpdG9yX2lkIjoiNDU0ODExMDUzMTMxNjk2OTUzMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8a2b46703cd52a4ea84dc0a8e3fae5be390e1dd91d489ab637e2236fe9cdee52 |
| hovercard-subject-tag | issue:4009601667 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/RustPython/RustPython/7311/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1b690ab139e6a6806046c648b179400e64bc9fac9b2236f40c465af96a424338/RustPython/RustPython/issues/7311 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1b690ab139e6a6806046c648b179400e64bc9fac9b2236f40c465af96a424338/RustPython/RustPython/issues/7311 |
| og:image:alt | Summary The pr-auto-commit.yaml workflow is vulnerable to shell command injection via branch names. The ${{ github.event.pull_request.head.ref }} expression is interpolated directly into run: block... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | varunsh-coder |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width