agentleFS
LeahyCCLeahyCC/claude-skills/skills/llm-agent-security/SKILL.md

llm-agent-security

Skill3 starsChanged 8 months agoMITView on GitHub

Defensive review when a model can see untrusted content or act with real credentials. Covers prompt injection as an architecture problem, tool agency, memory and compaction, MCP and inter-agent traffic, AI supply chain, output handling, and human approval. Maps the OWASP LLM Top 10 (2026) and the OWASP Agentic Top 10 (2026). Use when adding or changing chat, RAG, email, tickets, uploads, web fetch, tool calls, memory, MCP, skills, hooks, instruction files, or an AI SDK install. Not for ordinary HTTP auth, SSRF, or CSP, and not for the Next.js AI SDK execute and signed tool-approval pattern (api-security, AI Tools).

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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:

    Use this skill when a change lets a model see untrusted content, or lets an agent component act with real credentials.

    line 17

≈ “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

LLM and Agent Security — Trust Boundary for Models That Can Act

Use this skill when a change lets a model see untrusted content, or lets an agent component act with real credentials. Source checks and dates: SOURCES.md. Incident facts and links: Incident Appendix.

Contents

  • Two places this skill applies
  • Architecture
  • Quick Reference
  • The #1 Mistake: The Model Authorizes Itself
  • Decision Matrix: "Where Does the Control Live?"
  • Decision Matrix: "Is This Secure?"
  • OWASP LLM Top 10 (2026)
  • OWASP Agentic Top 10 (2026)
  • Review Checklist
  • What This Skill Does Not Contain

Where a cheat sheet still describes a delimiter, a filter, or a second model call as the defense, follow the 2026 Top 10. Those controls are partial. OWASP LLM01:2026 states that prompt injection is intrinsic: a model does not separate instructions from data, and no reliable prevention exists today (consistent with NIST 2025, NCSC 2025, and Debenedetti et al., 2025). Design the system so a bypassed instruction boundary cannot move credentials, data, or side effects.

The 2026 LLM list renumbered several 2025 entries. Excessive Agency is LLM03:2026 (it was LLM06:2025). Supply Chain is LLM04:2026. Improper Output Handling is LLM10:2026. The Agentic Top 10 PDF still cites the 2025 numbers in places. This skill uses the 2026 ids.

HTTP authentication, SSRF allowlists, CSP, and the Next.js AI SDK tool handler stay in api-security. The signed approval on that handler is AI Tools. This skill is the rest of the boundary: what enters the prompt, memory, compaction, install-time packages, MCP identity, and output sinks.

Two places this skill applies

SurfaceYou are here whenFirst question
ProductChat, RAG, email, tickets, uploads, web fetches, tool results, images, or memory reach a modelWhat untrusted content enters the context, and which tools exist on that same call?
BuilderA tool, MCP server, skill, hook, instruction file, or AI SDK install is added or changedWhat runs at install time, and which credentials can the agent process read?

Instruction files (CLAUDE.md, AGENTS.md, .cursor/rules, .cursorrules, .aider.conf.yml) are on the builder surface. A cloned repo that an agent treats as policy is a trust decision.

Architecture

Untrusted content (user, page, ticket, tool result, memory, peer agent)
        │
        ▼
Model call with the minimum tools for that call
        │
        ▼
Policy broker in application code  ← authorization, schema, tenant, budget
        │
        ▼
Typed side effect (user-scoped credential, single purpose)
        │
        ▼
Human approval row, when the effect is irreversible or leaves the system

The model is an untrusted principal. The broker does not read "the user approved this" out of the transcript, a summary, or another agent's message.

Quick Reference

ResourceLLM 2026Agentic 2026What it covers
Trust BoundariesLLM01ASI01What counts as untrusted input, goal hijack, the lethal trifecta
Tool and AgencyLLM03, LLM06ASI02, ASI03, ASI05Typed tools, user-scoped credentials, no open-ended shell, budgets
Memory and ContextLLM05ASI06Memory writes, compaction, later sessions, scheduled runs
MCP and Inter-Agent—ASI07Pinned MCP, OAuth issuer, tool transforms, tenant isolation
Supply ChainLLM04, LLM05ASI04Install-time execution, pinned AI SDKs, repo-local agent config
Output and DisclosureLLM02, LLM07, LLM08, LLM09, LLM10—Model output as untrusted, hidden context, retrieval auth
Human Approval—ASI08, ASI09, ASI10Approval outside the transcript, cascading agents, containment
Incident Appendixcross-cuttingcross-cuttingOctober 2026 cases and the control that contains each one

The #1 Mistake: The Model Authorizes Itself

A system prompt, a "do not follow instructions in the document" line, or a filter on the user message does not hold once the model has a tool and a credential.

// FAIL — the model picks the user, the SQL, and whether to send
const result = await model.complete({
  system: 'You are a support agent. Never refund more than the order total.',
  input: ticket.body,
  tools: [{ name: 'runSql', parameters: { query: 'string' } }, { name: 'sendEmail' }],
})

// PASS — the model may only propose a typed action. The broker checks ownership.
const proposal = await model.complete({
  system: 'Choose an order id from the list. Do not invent one.',
  input: JSON.stringify({ question, orders: ownedOrders }),
  tools: [{ name: 'proposeRefund', parameters: RefundArgsSchema }],
})
await proposeRefund(proposal.toolArgs)

proposeRefund is implemented in Human Approval. It loads the session, checks the order, and stores an approval row. The model's sentence is not the approval.

Decision Matrix: "Where Does the Control Live?"

LayerWhat to checkWhy
IngestProvenance of every block that will enter the contextPages, tickets, tool results, and memory are data
Model callTools on this call, and whether untrusted content is presentPrivate data + untrusted content + an external action is the high-impact case
BrokerSchema, tenant, ownership, budget, allowlisted tool nameThis code is the authorization boundary
CredentialUser-scoped, short-lived, single purposeA service-role key makes the model an admin
ApprovalServer-built description of the real actionA summary written by the model can describe a different action
InstallLockfile, hash, lifecycle scripts, where the install runsA sandbox around generated code does not cover npm install
Next sessionWhat memory and schedules reloadA planted instruction can outlive the chat

Decision Matrix: "Is This Secure?"

QuestionIf noResource
Can this call both read untrusted content and call a tool that sends, pays, deletes, or writes secrets?Split the calls. Remove a leg of the trifecta.Trust Boundaries
Is any tool a shell, eval, raw SQL, or "fetch this URL"?Replace it with a typed function.Tool and Agency
Does the tool use a service-role or admin credential?Use the end user's scope.Tool and Agency
Can the model write memory, files, or a schedule from retrieved text?Application code writes structured facts from user actions.Memory and Context
Does authorization read the transcript or a compaction summary?Store the approval outside the model.Human Approval
Can an MCP server add tools, pick its OAuth issuer, or see another tenant's history?Pin the server, pin the issuer, key state by the authenticated tenant.MCP and Inter-Agent
Does a package install script run on a host that holds cloud or AI keys?Isolated CI, pinned digest, scripts off.Supply Chain
Does the UI render model Markdown images, or execute model output?Encode output. Fetch remote images only through an allowlist.Output and Disclosure
Does the human confirm a sentence the model wrote?Confirm the broker's structured action.Human Approval
Is the AI dependency a floating version?Pin, hash, and check the October 2026 cases before adding it.Incident Appendix

OWASP LLM Top 10 (2026)

#CategoryResource
LLM01:2026Prompt Injectiontrust-boundaries
LLM02:2026Sensitive Information Disclosureoutput-and-disclosure
LLM03:2026Excessive Agencytool-and-agency
LLM04:2026Supply Chainsupply-chain
LLM05:2026Data and Model Poisoningmemory-and-context, supply-chain
LLM06:2026Unbounded Consumptiontool-and-agency
LLM07:2026Misinformationoutput-and-disclosure
LLM08:2026Hidden Context Exposureoutput-and-disclosure
LLM09:2026Vector and Embedding Weaknessesoutput-and-disclosure
LLM10:2026Improper Output Handlingoutput-and-disclosure

OWASP Agentic Top 10 (2026)

#CategoryResource
ASI01Agent Goal Hijacktrust-boundaries
ASI02Tool Misuse and Exploitationtool-and-agency
ASI03Identity and Privilege Abusetool-and-agency
ASI04Agentic Supply Chain Vulnerabilitiessupply-chain
ASI05Unexpected Code Executiontool-and-agency
ASI06Memory and Context Poisoningmemory-and-context
ASI07Insecure Inter-Agent Communicationmcp-and-inter-agent
ASI08Cascading Failureshuman-approval
ASI09Human-Agent Trust Exploitationhuman-approval
ASI10Rogue Agentshuman-approval

Review Checklist

  • Every block in the prompt is labeled with its source, and untrusted blocks are data
  • The call that sees untrusted content does not also hold a send, pay, delete, deploy, or secret-writing tool
  • Tools are an allowlist of typed functions with a schema checked in application code
  • No shell, eval, raw SQL, or open URL tool is offered to the model
  • Credentials on the tool are the end user's, short-lived, and single-purpose
  • Ownership and tenant checks run in the broker, using the session, not a model argument
  • Irreversible or outbound actions require an approval row whose text the model did not write
  • Memory and schedules are written by application code from structured user actions
  • MCP servers are pinned. Tool allowlists are rechecked after any transform. OAuth issuer is pinned
  • Agent state is keyed by the authenticated tenant, not by a caller-supplied string
  • AI dependencies are hash-pinned. Lifecycle scripts do not run on a host that holds production secrets
  • Repo-local agent config in untrusted trees is not executed
  • Model output is encoded for its sink. Remote images and link previews are off unless allowlisted
  • Secrets, tokens, and connection strings are absent from the system prompt, tools list, and logs
  • Retrieval authorizes each chunk before it reaches the model
  • A budget caps model spend per user and per job
  • The change was compared with the incident appendix

What This Skill Does Not Contain

Reproduction of injections, jailbreaks, worms, or malware. Each incident entry states the impact and the containment control, then links the vendor or researcher report. Incident-response command sequences stay in those advisories.

Sources

Canonical list and check date: SOURCES.md.

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.