Skip to main content

Cross-file attack path analysis and exploit synthesis for AI applications.

Project description

AITrace — Attack Path Analysis and Exploit Synthesis for AI Applications

Traces user-controlled data through AI framework call chains across files and generates working exploit payloads from confirmed attack paths. Static analysis — no running application needed.

Supports LangChain · LangGraph · AutoGen · CrewAI · Semantic Kernel · LlamaIndex · Haystack · RAG pipelines · MCP servers · OpenAI / Anthropic / Cohere / Vertex AI SDKs · ChromaDB · Pinecone · FAISS and more.


What it does

  • Traces attack paths — Follows user input, env vars, and external data through AI framework calls across modules (not single-file grep)
  • Confirms reachability — Cross-file call-graph analysis marks which paths actually reach LLM, agent, code-exec, or SQL sinks
  • Synthesizes exploits — With --exploit, emits codebase-specific PoC payloads aimed at confirmed sinks, plus static CONFIRMED / LIKELY / UNCERTAIN verdicts
  • Surfaces AI stack context — Inventories LLM SDKs, agents, RAG, vector stores, and MCP configs so the path has a clear target map
  • One HTML report — Walk findings and (optional) exploit payloads in the browser after each run

Optional: CycloneDX / SPDX AI BOM and Mermaid architecture diagram via -f.


Installation

Requirements: Python 3.9+ · No telemetry · Core analysis makes no external API calls

# Recommended
pipx install aitrace-cli
# or
uv tool install aitrace-cli

aitrace --help

From source:

git clone https://github.com/alishasinghania/AITrace-cli
cd AITrace-cli
pip install -e .

Usage

# Scan a local repo — writes aitrace-report.html and opens it
aitrace scan ./my-app

# Scan a remote GitHub repo directly (shallow clone, no setup needed)
aitrace scan https://github.com/owner/repo
aitrace scan https://github.com/owner/repo --exploit

# Generate PoC payloads from confirmed paths (+ RAG poison docs when RAG detected)
aitrace scan ./my-app --exploit

# Headless / CI — no browser
aitrace scan ./my-app --no-open

# Write to a specific directory
aitrace scan ./my-app -o ./results

# Optional machine-readable outputs
aitrace scan ./my-app -f cyclonedx -f spdx -f mermaid

# Policy gate — exits code 1 on violation (use in CI)
aitrace scan ./my-app --policy policy.yaml --no-open

# Write findings JSON + architecture graph
aitrace scan ./my-app --verbose

Output files

By default, all files are written into the scanned repository root. Use -o / --out-dir to choose another directory.

File When
aitrace-report.html Always (primary deliverable)
aitrace-exploits.json --exploit
aitrace-rag-poison-payload.txt --exploit + RAG detected
aitrace-cyclonedx.json -f cyclonedx
aitrace-spdx.json -f spdx
aitrace-component-diagram.mmd -f mermaid
aitrace-risk-report.md -f risk-md
aitrace-findings.json · arch graph --verbose

How it works

                      +-------------------------+
                      |      Your Codebase      |
                      |  Python · manifests     |
                      |  MCP configs · models   |
                      +----------+--------------+
                                 |
                                 v
                      +----------+--------------+
                      |     AITrace Scanner     |
                      +----------+--------------+
                                 |
          +----------------------+----------------------+
          |                      |                      |
          v                      v                      v
  +---------------+    +------------------+    +----------------+
  |   Discovery   |    |  Path Analysis   |    |  MCP Inspector |
  |               |    |                  |    |                |
  | · AI packages |    | · AST parser     |    | · tool desc    |
  | · agent shapes|    | · call graph     |    |   poisoning    |
  | · RAG / vector|    | · taint tracing  |    | · hardcoded    |
  | · model files |    | · pattern shapes |    |   credentials  |
  +---------------+    +------------------+    +----------------+
          \                     |                      /
           \                    v                     /
            +-------------------+--------------------+
            |            Analysis Engine             |
            |        PAT-001 … PAT-023 rules         |
            +-------------------+--------------------+
                                |
              +-----------------+-----------------+
              |                 |                 |
              v                 v                 v
     +----------------+  +-----------+  +----------------+
     |    Exploit     |  |   Risk    |  |    AI SBOM     |
     |  Synthesizer   |  |  Scoring  |  | CycloneDX/SPDX |
     |  (--exploit)   |  |  Policy   |  |   (-f flag)    |
     +----------------+  +-----------+  +----------------+
              \                |                 /
               \               v                /
                +-----------------------------+
                |      aitrace-report.html    |
                +-----------------------------+
  1. Discovery — Inventories AI packages, agent frameworks, vector stores, MCP servers, and model artifacts from manifests and imports.
  2. Path analysis — Builds a cross-file call graph, traces user-controlled data (routes, env vars, files) to LLM / exec / SQL sinks, and checks 23 structural vulnerability patterns.
  3. Exploit synthesis (--exploit) — Generates codebase-specific PoC payloads for confirmed paths with CONFIRMED / LIKELY / UNCERTAIN verdicts. Includes RAG poison documents for detected vector stores.
  4. Report — Single aitrace-report.html with grouped findings, MCP analysis, exploit gate, and architecture diagram.

Policy gate

Optional governance check for CI — not a substitute for path analysis:

aitrace init-policy
aitrace scan . --policy policy.yaml --no-open

Exit code 1 on violation. Example GitHub Actions step:

- name: AITrace policy gate
  run: aitrace scan . --policy policy.yaml --no-open

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aitrace_cli-0.1.0.tar.gz (199.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aitrace_cli-0.1.0-py3-none-any.whl (213.5 kB view details)

Uploaded Python 3

File details

Details for the file aitrace_cli-0.1.0.tar.gz.

File metadata

  • Download URL: aitrace_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 199.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for aitrace_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 45f23bfafef939ff36db337ef449f1a858c7a5be93b6ba6432105ff23ba441e5
MD5 a88abf0a27d536827151aee6efbb9966
BLAKE2b-256 49c1f0bd44f182a33cb551490a458c80b1f17add9d8759ad7d13f66b3c612ed2

See more details on using hashes here.

File details

Details for the file aitrace_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aitrace_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 213.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for aitrace_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d294f18f54be45dff50545defecf855a6070f50037be4931aa1862cb0626b29f
MD5 174df197b7003a9816d3fd7b191a0938
BLAKE2b-256 eb908ea53ad41692ee9db35a0bb180ee6502fcd2f5960108ce42c4eb4636ce02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page