detecting-supply-chain-attacks-in-ci-cd
它能做什么
这个工具可以检查你的代码自动化系统(CI/CD)中的安全漏洞,这些漏洞可能被用来攻击你的软件供应链。它会查找不安全的操作、代码注入以及敏感信息泄露等问题。
适用场景
- ✓当你在调查可能的供应链攻击时。
- ✓当你在搭建或加强自动化流程的安全性时。
- ✓当你想确认安全监控工具是否覆盖了已知风险时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-supply-chain-attacks-in-ci-cd/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“扫描我的GitHub Actions工作流,查找供应链安全风险。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会分析你自动化系统的配置文件,查找有风险的写法,比如使用未锁定版本的代码,或者可能被注入恶意命令的地方。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Detecting Supply Chain Attacks in CI/CD
When to Use
- When investigating security incidents that require detecting supply chain attacks in ci cd
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Familiarity with security operations concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Instructions
Scan CI/CD workflow files for supply chain risks by parsing GitHub Actions YAML, checking for unpinned dependencies, script injection vectors, and secrets exposure.
import yaml
from pathlib import Path
for wf in Path(".github/workflows").glob("*.yml"):
with open(wf) as f:
workflow = yaml.safe_load(f)
for job_name, job in workflow.get("jobs", {}).items():
for step in job.get("steps", []):
uses = step.get("uses", "")
if uses and "@" in uses and not uses.split("@")[1].startswith("sha"):
print(f"Unpinned action: {uses} in {wf.name}")
Key supply chain risks:
- Unpinned GitHub Actions (using @main instead of SHA)
- Script injection via ${{ github.event }} expressions
- Overly permissive GITHUB_TOKEN permissions
- Third-party actions with write access to repo
- Dependency confusion via public/private package name collision
Examples
# Check for script injection in run steps
for step in job.get("steps", []):
run_cmd = step.get("run", "")
if "${{" in run_cmd and "github.event" in run_cmd:
print(f"Script injection risk: {run_cmd[:80]}")
常见问题
什么是软件供应链攻击?
这是一种攻击方式:攻击者先入侵你在开发中使用的某个正规组件(比如某个工具或代码库),再借此感染你的软件或系统。
'unpinned actions'是什么意思?
意思是在使用某个操作(一段小型自动化脚本)时,没有指定确切的版本号。这样做有风险,因为该操作可能在你不知情的情况下被更新,夹带恶意代码。
什么是'依赖混淆'(dependency confusion)?
这是一种攻击技巧:攻击者会创建一个与公司内部软件包同名的恶意包,并把它发布到公共仓库中。如果配置不当,你的系统可能会下载这个恶意版本,而不是正确的内部包。
详情
作者的原始描述
Scans GitHub Actions workflows and CI/CD pipeline configurations for supply chain attack vectors including unpinned actions, script injection via expressions, dependency confusion, and secrets exposure. Uses PyGithub and YAML parsing for automated audit. Use when hardening CI/CD pipelines or investigating compromised build systems. '
热度
- GitHub 星标
- 35k
- 排名
- #7878
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。