Skip to content
Skillpedia
Agents35k · #5655

detecting-data-and-model-poisoning

Helps your agent spot corrupted training data or flawed machine learning models. Useful before training or using data from outside sources.

What it does

This tool checks if training data or AI models have been intentionally corrupted. It looks for anomalies that could cause the model to misbehave or have hidden flaws.

When to use it

  • ✓Before training a model with data that isn't yours.
  • ✓When using a pre-trained model downloaded from the internet.
  • ✓When suspecting a model is behaving strangely.

Example of what to ask your AI

“Check if this downloaded model is safe before using it.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-data-and-model-poisoning/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-data-and-model-poisoning/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The tool uses techniques to analyze the data and the model. It looks for unusual patterns in the training data and checks if the model reacts strangely to certain hidden 'triggers'.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill detecting-data-and-model-poisoning

Or download just the file:

curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/detecting-data-and-model-poisoning/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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:
python -m venv .venv && source .venv/bin/activate

# IBM Adversarial Robustness Toolbox — poisoning detection defenses
pip install adversarial-robustness-toolbox

# Cleanlab — label/data quality issue detection
pip install cleanlab

# Modeling + safe serialization + hashing
pip install numpy scikit-learn safetensors

# (Choose one framework backend ART can wrap)
pip install tensorflow   # or: pip install torch

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).

# Verify a downloaded checkpoint against a published SHA-256
sha256sum model.safetensors
# compare to the hub-published digest

# Flag unsafe pickle-based weights in a directory
find ./models -type f \( -name "*.bin" -o -name "*.pt" -o -name "*.pkl" -o -name "*.ckpt" \)
# safe_load.py — load weights without executing pickle
from safetensors.numpy import load_file
weights = load_file("model.safetensors")   # no arbitrary code execution

…

FAQ

What is 'data poisoning'?

It's when someone inserts fake or manipulated data into a model's training to make it err or have biases.

What is 'model backdooring'?

It's when a model works normally but performs an unwanted action when a specific word or image (the 'trigger') appears in the input.

Why check the 'supply chain'?

To ensure that models and data you download from other sources haven't been tampered with to contain security flaws or 'backdoors'.

Details

Original description by the author

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 checkpoi

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularity

GitHub stars
35k
Ranking position
#5655
License
Apache-2.0
Updated
8/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills