[Bug] Potential command injection risk in auto_assign_reviewers GitHub Actions workflow

未关闭
#11,400 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
bash, github-actions
领域
ci-cd, security

调研方向

首先检查 .github/workflows/auto_assign_reviewers.yml,跟踪从 pull_request_target 事件开始、经过中间映射和 shell 求值的已更改文件元数据。将不安全的处理替换为不会根据文件名构造 shell 代码的路径,然后验证不受信任的 pull request 无法注入命令,同时保持所需的 reviewer 分配行为和权限不变。

由索引模型根据 Issue 内容生成。

描述

RT-Thread Version

master branch, commit 630f4fa7a37ca99af5952946eea327cf9f1df21c Affected file: .github/workflows/auto_assign_reviewers.yml

Hardware Type/Architectures

Not hardware-specific. This issue affects a GitHub Actions workflow in the repository, not a specific BSP, board, MCU, or CPU architecture.

Develop Toolchain

Other

Describe the bug

This is a security-sensitive GitHub Actions workflow issue. I am intentionally not including the full PoC payload in this public issue. I can provide the detailed validation case privately to the maintainers if needed.

Summary

The affected workflow appears to be:

.github/workflows/auto_assign_reviewers.yml

The workflow processes pull request changed-file metadata in a pull_request_target context. The changed file names are attacker-controlled input. The workflow then stores these file names in an intermediate mapping and later reconstructs shell data structures from that mapping using shell evaluation logic.

If pull request file names are not safely encoded before reaching shell evaluation, specially crafted file names may be interpreted as shell syntax. This can lead to command injection in the GitHub Actions workflow.

Current version checked

I checked the current master branch at:

630f4fa7a37ca99af5952946eea327cf9f1df21c

At this commit, the relevant workflow structure still appears to be present.

Security impact

If exploitable, an attacker who can open or update a pull request may be able to execute shell commands in the affected GitHub Actions workflow context.

This is security-relevant because the workflow runs under pull_request_target and has pull request write permission.

I did not attempt to read, print, exfiltrate, or use any token or secret. I also did not run a destructive test against the project infrastructure.

High-level technical indicators

The risky pattern appears to involve:

  • pull_request_target workflow trigger;
  • reading changed file names from pull request metadata;
  • writing pull request file names into an intermediate mapping without sufficient encoding;
  • reconstructing shell variables from that mapping using shell evaluation;
  • running the workflow with pull-requests: write permission.

I am omitting the exact payload and reproduction filename from this public issue to avoid making the issue directly exploitable.

Suggested remediation

Possible remediation approaches:

  1. Avoid using shell eval on data derived from pull request metadata.
  2. Do not construct shell code from pull request file names.
  3. Treat all pull request file names as untrusted input.
  4. Use a safe JSON processing path, such as Python json or direct jq processing, instead of converting JSON data into shell assignments.
  5. Safely encode or reject file names containing shell metacharacters before processing.
  6. Reduce permissions for jobs that process untrusted pull request metadata.
  7. Consider splitting the workflow into:
    • a low-privilege job that computes reviewer information;
    • a separate trusted job that performs pull request write operations only after consuming sanitized output.

Private details

I can provide maintainers with:

  • exact source-to-sink explanation;
  • affected workflow snippets;
  • current commit evidence;
  • non-destructive maintainer-side validation steps;
  • full PoC details using a harmless marker only.

Please let me know the preferred way to share those details privately.

Other additional context

GitHub Actions workflow environment.

Relevant context:

  • GitHub Actions
  • pull_request_target event
  • ubuntu-22.04 runner
  • bash / jq based workflow scripts
主要语言
C
星标
12.4k
派生
5.5k
平均合并
3 天 7 小时
30 天内合并 PR
79

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RT-Thread/rt-thread 的其他 Issue

查看 RT-Thread/rt-thread 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。