Skip to content

Add Anthropic SDK code sample demonstrating ASI03 privilege escalation#803

Open
DanielMendozaC wants to merge 1 commit into
OWASP:mainfrom
DanielMendozaC:add-anthropic-privilege-escalation-sample
Open

Add Anthropic SDK code sample demonstrating ASI03 privilege escalation#803
DanielMendozaC wants to merge 1 commit into
OWASP:mainfrom
DanielMendozaC:add-anthropic-privilege-escalation-sample

Conversation

@DanielMendozaC
Copy link
Copy Markdown

Add Anthropic SDK code sample demonstrating ASI03 privilege escalation

Key Changes:

  • New code sample demonstrating ASI03 (Identity & Privilege Abuse)
  • Uses Anthropic Python SDK with tool calling
  • Includes Dockerfile as required by CONTRIBUTING.md

Added:

  • insecure_agent.py - Over privileged file management agent
  • README.md - Vulnerability writeup, OWASP mapping, attack walkthrough, mitigations
  • Dockerfile, requirements.txt, .env.example
  • data/ - Test files including one with embedded prompt injection

What this adds

New code sample under agentic_top_ten/frameworks/anthropic/privilege_escalation/ demonstrating ASI03: Identity & Privilege Abuse.

The example is a file management agent built with the Anthropic Python SDK. It has deliberate security flaws: over privileged tools, no authorization checks, no input sanitization, and no audit logging. A prompt injection embedded in a data file tricks the agent into deleting files it should not touch.

Files

  • insecure_agent.py - The vulnerable agent (~200 lines)
  • README.md - Vulnerability writeup with OWASP ASI03 and LLM Top 10 mapping, attack walkthrough, and mitigations
  • Dockerfile - Run locally with Docker
  • requirements.txt - Python dependencies
  • data/ - Test files including the poisoned report

Why

The agentic_top_ten/frameworks/ section currently has two examples (pydantic, mastra), both covering the same vulnerability. This adds a third framework (Anthropic SDK) covering a different risk category (ASI03). It also includes a Dockerfile as required by CONTRIBUTING.md.

Tested

Ran the agent locally. The prompt injection in report_q3.txt successfully triggers unauthorized file deletions, confirming the vulnerability works as documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant