You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A critical expression injection vulnerability exists in .github/workflows/pr_format_bot.yml that allows any external attacker to achieve arbitrary command execution in the RT-Thread CI environment and abuse the workflow's GITHUB_TOKEN to approve pull requests — enabling a supply chain attack path.
Since the workflow uses pull_request_target, it runs in the context of the base repository (RT-Thread/rt-thread) with access to the base repo's secrets and GITHUB_TOKEN. The attacker controls the branch name from their fork.
Because $() command substitution is evaluated inside bash double quotes, a branch name like:
Additionally, the GITHUB_TOKEN was exfiltrated via base64 encoding to confirm full command execution capability.
All PRs were closed immediately after the demonstration.
Impact
Supply Chain Attack: An attacker can self-approve their own malicious PRs. If branch protection relies on bot approvals or if a maintainer trusts the bot approval, backdoored code enters the master branch.
RT-Thread's reach: With 11,800+ stars and deployment across billions of IoT/embedded devices (industrial, automotive, consumer), a compromised master branch could affect downstream firmware builds globally.
Arbitrary Command Execution: The attacker achieves RCE in RT-Thread's CI environment, able to run any command the GitHub-hosted runner allows.
Suggested Fix
Replace the direct expression interpolation with an environment variable:
When GitHub Actions expressions are assigned to environment variables via env:, they are set as literal strings and NOT interpreted by the shell — preventing injection.
This vulnerability was discovered by Wilson Cyber Research during authorized CI/CD security research. We respectfully request credit for the discovery in any advisory, changelog, or commit message addressing this fix.
Summary
A critical expression injection vulnerability exists in
.github/workflows/pr_format_bot.ymlthat allows any external attacker to achieve arbitrary command execution in the RT-Thread CI environment and abuse the workflow'sGITHUB_TOKENto approve pull requests — enabling a supply chain attack path.Vulnerability Details
Workflow:
.github/workflows/pr_format_bot.ymlTrigger:
pull_request_target(types: [opened])GITHUB_TOKEN Permissions:
pull-requests: write,contents: readThe workflow directly interpolates the attacker-controlled branch name (
github.event.pull_request.head.ref) into a bashrun:block on line 44:Since the workflow uses
pull_request_target, it runs in the context of the base repository (RT-Thread/rt-thread) with access to the base repo's secrets andGITHUB_TOKEN. The attacker controls the branch name from their fork.Because
$()command substitution is evaluated inside bash double quotes, a branch name like:...results in the
ghCLI approving the target PR using the workflow'sGITHUB_TOKENwithpull-requests: writepermissions.Proof of Concept
The following attack was demonstrated (and immediately cleaned up):
gh pr review 11280 --approvepayloadpull_request_targetworkflow fired immediately on PR docs: trim trailing space in README #11281ghcommand in RT-Thread's CI contextgithub-actions[bot]with body "lgtm"Additionally, the
GITHUB_TOKENwas exfiltrated via base64 encoding to confirm full command execution capability.All PRs were closed immediately after the demonstration.
Impact
Suggested Fix
Replace the direct expression interpolation with an environment variable:
When GitHub Actions expressions are assigned to environment variables via
env:, they are set as literal strings and NOT interpreted by the shell — preventing injection.References
Credit
This vulnerability was discovered by Wilson Cyber Research during authorized CI/CD security research. We respectfully request credit for the discovery in any advisory, changelog, or commit message addressing this fix.
GitHub: @sourcecodereviewer
Timeline