agentleFS
patonkikhpatonkikh/APES/skills/security/ai-threat-modeling/skill.md

ai-threat-modeling

Skill3 starsChanged 4 months agoMITView on GitHub

Produce a threat model for AI/LLM applications using STRIDE and LINDDUN adapted for model inference, RAG, agents, and tool use. Use when working on LLM security, OWASP reviews, threat modeling, guardrails, or prompt injection.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Document system boundary and AI-specific assets:

    line 26
  2. Distinctive:

    Add AI-specific variants: prompt injection, model inversion, training data poisoning, adversarial inputs.

    line 49
  3. Distinctive:

    Use data-flow diagrams aligned with C4 container level.

    line 127

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

AI Threat Modeling

Purpose

Produce a threat model for AI/LLM applications using STRIDE and LINDDUN adapted for model inference, RAG, agents, and tool use.

Input: System architecture (containers, data flows), AI pipeline description, asset inventory, trust boundaries
Output: AI Threat Model document with assets, threats, attack trees, risk ratings, and control recommendations Examples: See examples.md for worked input/output.


Workflow

Step 1: Define scope and assets

Document system boundary and AI-specific assets:

AssetTypeSensitivityOwner

Include: system prompts, fine-tuned weights, embeddings, vector stores, conversation logs, API keys, user PII, tool credentials.

Step 2: Draw trust boundaries

Map data flow across boundaries:

  • User → application → LLM provider
  • Application → RAG retrieval → document store
  • Agent → tools/APIs → external systems
  • Training/fine-tuning pipeline (if applicable)

Step 3: Apply STRIDE per component

For each container/component, enumerate threats:

ComponentSpoofingTamperingRepudiationInfo disclosureDoSElevation

Add AI-specific variants: prompt injection, model inversion, training data poisoning, adversarial inputs.

Step 4: Apply LINDDUN for privacy

For flows involving personal data:

LinkLeakageIdentifiabilityNon-repudiationDetectabilityDisclosureUnawarenessNon-compliance

Focus on: conversation retention, embedding reversibility, cross-user retrieval leakage.

Step 5: Build attack trees

For top risks, decompose attack paths:

Goal: Exfiltrate system prompt
├── Direct injection in user input
├── Indirect via poisoned RAG document
└── Tool output manipulation

Step 6: Rate and prioritize

Score each threat: Likelihood (1–5) × Impact (1–5) = Risk score.

Threat IDSTRIDE/LINDDUNLikelihoodImpactRiskExisting control

Step 7: Recommend controls

Map threats to mitigations: preventive, detective, corrective. Reference OWASP LLM Top 10 where applicable.

Step 8: Validate

Run Validation checklist.


Decision Rules

ConditionAction
No architecture diagramStop; request container/data-flow diagram or run architecture/container-diagram-builder
Agent with tool accessExpand elevation and tampering analysis for tool abuse
RAG over private documentsPrioritize LINDDUN info disclosure and cross-tenant leakage
Third-party LLM APIInclude provider trust boundary and data residency threats
Fine-tuning on user dataAdd training data poisoning and membership inference threats
Risk score ≥ 15 without controlMark as blocker; require mitigation before production

Validation

  • All AI-specific assets listed with sensitivity classification
  • Trust boundaries cover LLM provider, RAG, tools, and storage
  • STRIDE applied to every in-scope component
  • LINDDUN applied where PII or conversation data flows
  • Top 5 risks have attack trees or attack path descriptions
  • Each High/Critical risk has recommended control
  • Controls traceable to OWASP LLM categories where relevant
  • Residual risks documented explicitly

Anti-patterns

  • Generic STRIDE without AI context — missing prompt injection, RAG poisoning, tool abuse.
  • Threats without attack paths — abstract labels without exploitable scenarios.
  • Ignoring supply chain — overlooking model provider, plugin, and embedding API risks.
  • Single-boundary model — treating the LLM as a black box with no internal data flows.
  • Controls without verification — recommending "input validation" without test criteria.

Best Practices

  • Combine STRIDE (security) and LINDDUN (privacy) in one unified model.
  • Use data-flow diagrams aligned with C4 container level.
  • Prioritize threats by exploitability in the actual deployment (internet-facing vs internal).
  • Link each control to a measurable verification method (test, monitor, audit).
  • Re-run threat model when adding tools, RAG sources, or model changes.
  • Involve domain owners for LINDDUN unawareness and compliance gaps.

Output Structure

# AI Threat Model: [System Name]

## Scope
- **In scope:** [components]
- **Out of scope:** [components]

## Assets
| Asset | Sensitivity | Location |
|-------|-------------|----------|

## Trust Boundaries
[Diagram or boundary table]

## STRIDE Analysis
| Component | Threats | Risk | Controls |
|-----------|---------|------|----------|

## LINDDUN Analysis
| Data flow | Privacy threats | Risk | Controls |
|-----------|-----------------|------|----------|

## Attack Trees
### [Top threat name]
[Tree or path description]

## Risk Register
| ID | Threat | Score | Status | Owner |
|----|--------|-------|--------|-------|

## Open Items
- [ ] [Unmitigated threat]

Next Skills

OutcomeRecommended Skill
Test injection attack pathssecurity/prompt-injection-detector
Design pipeline controlssecurity/guardrails-builder
OWASP gap analysissecurity/owasp-llm-reviewer
Governance and policy frameworksecurity/ai-governance-advisor
Document architecture decisionsarchitecture/adr-generator

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.