Elastic Open-Sources CI/CD Abuse Detector Using Regex Signals and Claude Analysis

· Original article ↗

Summary

Elastic Security Labs open-sourced cicd-abuse-detector, a CI template combining 50+ regex and metadata signals with Claude analysis to flag suspicious workflow changes across GitHub Actions, GitLab CI, and Azure DevOps.

Key points

  • The detector scans changed CI/CD-related files for 50+ regex and metadata signals, then sends the signals and full diff to Claude for a structured threat assessment.
  • It supports GitHub Actions, GitLab CI, and Azure DevOps, diffing files individually with a 10,000-character cap.
  • Verdicts include severity, confidence, reasoning, evidence, and recommendations; configured workflows can alert, create issues, or fail a pull request, and optionally send records to Elasticsearch.
  • Elastic says its detection patterns were tested against offensive tools and incidents including Nord Stream, ArtiPACKED, HackerBot-Claw, and Shai-Hulud; the project includes 19 malicious and four benign example diffs and an automated test suite.
  • The article identifies risks including secret harvesting, privileged pull_request_target workflows, broad token permissions, mutable action references, and backdated commits.
  • Recommended defenses include pinning actions to commit SHAs, limiting secret and token permissions, avoiding unsafe use of pull_request_target, and disabling persisted checkout credentials when appropriate.

Article Details

Defense Focus
Detect suspicious CI/CD workflow changes at the pull request or protected-branch stage, before they can be used to steal secrets or compromise software delivery.
Detection Methods
  • Scan per-file diffs with more than 50 regex and metadata signals for risky workflow changes, including secret interpolation, privileged pull_request_target triggers, untrusted pull request checkouts, double-base64 encoding, LD_PRELOAD, and automatic VS Code tasks.
  • Use Claude to assess the signal summary and full diff alongside author profile and commit metadata, including temporal analysis for backdated commits.
  • Correlate verdicts across GitHub Actions, GitLab CI, and Azure DevOps in Elasticsearch using ES|QL.
Data Sources
  • Changed CI/CD-relevant files and per-file diffs from pull requests or pushes to protected branches
  • Author profile and commit metadata
  • CI/CD platform, repository, actor, event type, and run URL metadata
  • Structured detector verdicts, including severity, confidence, reasoning, and evidence
Rule Types
  • Regex-based signal patterns
  • Structured JSON verdicts validated against a JSON Schema
  • ES|QL correlation queries
Platforms
  • GitHub Actions
  • GitLab CI
  • Azure DevOps
  • Elasticsearch
  • Slack
  • GitHub Issues
Defensive Actions
  • Pin CI actions to specific SHAs rather than tags or branches.
  • Scope secrets to individual steps and use short-lived, ephemeral tokens where possible.
  • Avoid pull_request_target unless necessary; do not check out pull request head code in the same workflow when using it.
  • Set explicit, minimal permissions for each workflow and job.
  • Set persist-credentials: false on checkout and account for token exposure when uploading artifacts.
  • Configure alerts and PR checks to respond to verdict severity, and optionally index verdicts in Elasticsearch for cross-platform correlation.

MITRE ATT&CK

CVE

Malware

Vendors

Products

Tools

Countries

Industries

Related Articles