mukul975/anthropic-cybersecurity-skills/detecting-data-and-model-poisoning
Claude Code and agent skill by mukul975/anthropic-cybersecurity-skills
- community
Checking that the SKILL.md file is still in the repository.
Identify poisoned training data and backdoored ML models across the pipeline using IBM's Adversarial Robustness Toolbox (activation clustering, spectral signatures, trigger reconstruction), Cleanlab for label-quality issues, and supply-chain checks like weight-hash verification and safetensors enforcement. Use before training or deploying on third-party/user-contributed data or downloaded checkpoints, during ML supply-chain reviews, or when investigating model misbehavior tied to specific inputs (suspected backdoor trigger).
Install
npx vskill@latest install mukul975/anthropic-cybersecurity-skills/detecting-data-and-model-poisoningSKILL.md
The same SKILL.md was published earlier as mukul975/anthropic-cybersecurity-skills/detecting-data-and-model-poisoning.
Detecting Data and Model Poisoning
Authorized-use-only notice: This skill includes routines that craft poisoned samples and backdoor triggers for defensive validation. Generate and use poisoned data and backdoored models only in isolated test environments you control. Never deploy a backdoored model or distribute poisoned datasets.
Overview
Data poisoning and model backdooring attack the integrity of an ML system at training time rather than at inference. In data poisoning (MITRE ATLAS AML.T0020 Poison Training Data), an adversary injects manipulated samples into the training, fine-tuning, or RAG corpus so the resulting model misbehaves — degraded accuracy, targeted misclassification, or an attacker-chosen bias. In model backdooring (MITRE ATLAS AML.T0018 Backdoor ML Model), the model behaves normally on clean inputs but produces an attacker-chosen output whenever a hidden trigger (a pixel patch, a rare token, a phrase) is present. Both are amplified by ML supply-chain compromise (AML.T0010): poisoned public datasets, trojaned pre-trained weights downloaded from a hub, or a malicious model serialization. This is OWASP LLM04:2025 Data and Model Poisoning.
Detection spans the pipeline. On the data side: provenance and integrity checks, statistical outlier and label-flip detection, and de-duplication of suspiciously near-identical samples. On the model side: activation-clustering and spectral-signature analysis (which exploit the fact that poisoned samples activate the network differently than clean ones) and trigger reconstruction. On the supply-chain side: verifying weights hashes/signatures and refusing unsafe serialization formats (pickle-based .bin/.pt) in favor of safetensors. This skill implements all three using IBM's Adversarial Robustness Toolbox (ART), Cleanlab for label-quality issues, and integrity tooling.
When to Use
- Before training/fine-tuning on third-party or user-contributed data.
- Before deploying a model built on a downloaded pre-trained checkpoint.
- During an ML supply-chain security review.
- When investigating anomalous model behavior tied to specific inputs (possible backdoor trigger).
- As a CI/CD gate that scans datasets and model artifacts before they enter the pipeline.
Prerequisites
- Python 3.10+ and a virtual environment.
- Install the tooling:
Objectives
- Verify dataset and model-weight provenance and integrity (hashes/signatures, safe formats).
- Detect label-quality issues and outliers in training data with Cleanlab.
- Detect poisoned samples in a trained model using ART activation clustering.
- Confirm findings with ART spectral-signature analysis.
- Probe a suspect model for backdoor triggers and quantify trigger-induced misclassification.
- Produce a poisoning-assessment report mapped to ATLAS AML.T0020 / AML.T0018.
MITRE ATT&CK Mapping
| ID | Official Name | Relevance | |
|---|---|---|---|
| AML.T0020 | Poison Training Data | Injection of manipulated samples into the training corpus | |
| AML.T0018 | Backdoor ML Model | Trigger-activated hidden behavior in the trained model | |
| AML.T0010 | ML Supply Chain Compromise | Poisoned public datasets / trojaned downloaded weights | |
| AML.T0024 | Exfiltration via ML Inference API | Some poisoning aims to leak data via the model's responses |
Workflow
1. Verify data and model provenance/integrity
Refuse artifacts whose hash/signature you cannot verify, and prefer safetensors over pickle-based formats (pickle can execute code on load).
2. Detect label/data-quality issues with Cleanlab
Cleanlab finds mislabeled, outlier, and near-duplicate samples — common signatures of label-flip poisoning.
3. Detect poisoned samples via ART activation clustering
ActivationDefence clusters per-class activations; a class whose activations split into two distinct clusters indicates injected (poisoned) samples.
4. Confirm with ART spectral signatures
Spectral signatures use the covariance spectrum of feature representations to surface poisoned samples — a strong second signal.
5. Probe the model for backdoor triggers
Test whether a candidate trigger flips predictions to an attacker target class far above the clean baseline.
6. Quarantine, retrain, and report
Remove flagged samples (intersection of Cleanlab + ART signals is highest-confidence), retrain on the cleaned set, and re-test for the trigger. Document: artifact provenance, samples flagged by each method, trigger ASR before/after, and ATLAS mapping. Recommend dataset provenance controls, signed weights (safetensors + sigstore/cosign), and ongoing pipeline scanning.
Tools and Resources
| Tool | Purpose | Source | |
|---|---|---|---|
| Adversarial Robustness Toolbox | Activation clustering & spectral-signature poisoning defenses | https://github.com/Trusted-AI/adversarial-robustness-toolbox | |
| Cleanlab | Label/data-quality issue detection | https://github.com/cleanlab/cleanlab | |
| safetensors | Safe (non-pickle) weight serialization | https://github.com/huggingface/safetensors | |
| OWASP LLM04:2025 | Data and Model Poisoning reference | https://genai.owasp.org/llmrisk/llm042025-data-and-model-poisoning/ | |
| MITRE ATLAS | AI threat technique taxonomy | https://atlas.mitre.org/ |
Detection Method Reference
| Layer | Method | Tool | Signal | |
|---|---|---|---|---|
| Supply chain | Hash/signature + safe format | sha256/safetensors | Tampered or unsafe artifact | |
| Data | Label issues / outliers | Cleanlab | Mislabeled / injected samples | |
| Model | Activation clustering | ART ActivationDefence | Per-class activation split | |
| Model | Spectral signatures | ART SpectralSignatureDefense | Outlier covariance spectrum | |
| Model | Trigger probing | custom | High trigger attack-success-rate |
Validation Criteria
- [ ] Dataset and weight provenance/integrity verified (hashes, safe format)
- [ ] Unsafe pickle-based artifacts identified and avoided
- [ ] Cleanlab label-issue scan run and suspicious samples listed
- [ ] ART activation clustering executed with flagged sample indices
- [ ] ART spectral-signature analysis run as confirmation
- [ ] Backdoor trigger probe quantifies attack-success-rate vs. baseline
- [ ] Highest-confidence poisoned samples quarantined (multi-method overlap)
- [ ] Model retrained on cleaned data and re-tested for the trigger
- [ ] Findings mapped to MITRE ATLAS AML.T0020 / AML.T0018 and OWASP LLM04:2025
- [ ] Report delivered with remediation (provenance, signed weights, pipeline scanning)
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/detecting-data-and-model-poisoning/SKILL.md
Popularity
- Repository stars
- 27,514
- Repository forks
- 3,334
- 7-day trend score
- 51
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mukul975/anthropic-cybersecurity-skills/detecting-data-and-model-poisoning)