Skip to main content

Open-source iterative threat modeling powered by LLMs - STRIDE + MAESTRO frameworks with DREAD scoring

Project description

Paranoid

Open-source, self-hosted, iterative threat modeling powered by LLMs.

Paranoid takes system descriptions (text, diagrams, or code via MCP) and produces comprehensive STRIDE + MAESTRO threat models through an LLM-powered pipeline with deterministic fallback. Configure 1–15 automated iteration passes, then review threats in a human-in-the-loop approve/reject cycle.

Features

  • Zero Infrastructure: SQLite + sqlite-vec. One command to run: docker compose up
  • Multi-Provider LLM: Anthropic, OpenAI, or Ollama (fully local/air-gapped)
  • Dual Framework Support: STRIDE (traditional) + MAESTRO (AI/ML) auto-detected or run in parallel
  • DREAD Risk Scoring: Automatic risk assessment with 5 dimensions (0-50 scale) for severity classification
  • Structured Input Templates: XML-tagged component descriptions with assumption enforcement
  • Iterative Refinement: 1–15 configurable iteration passes with gap analysis
  • Deterministic Fallback: Rule engine ensures known threats aren't missed
  • MCP Integration: Pull code context from any MCP server (Antigravity-Link, etc.)
  • Dual JSON Formats: Simple (lightweight, ~2KB) or Full (complete models + DREAD, ~45KB)
  • CI/CD Ready: CLI + GitHub Action output SARIF for PR annotations
  • Export Formats: PDF, JSON (simple/full), Markdown, SARIF

Quick Start

Installation

Choose the installation method that works best for you:

Option 1: PyPI (Recommended)

Install from PyPI using pip:

pip install paranoid-cli

Verify installation:

paranoid --version

Option 2: Docker

Pull and run the Docker image:

# Pull latest image
docker pull yourusername/paranoid:latest

# Run threat modeling
docker run --rm \
  -v $(pwd):/workspace \
  -e ANTHROPIC_API_KEY=sk-ant-xxx \
  yourusername/paranoid:latest \
  paranoid run /workspace/system.md

Option 3: Standalone Binary (No Python Required)

Download the pre-built binary for your platform from GitHub Releases:

Linux (x86_64):

wget https://github.com/yourusername/paranoid/releases/latest/download/paranoid-linux-x64
chmod +x paranoid-linux-x64
./paranoid-linux-x64 --help

macOS (ARM64 - Apple Silicon):

wget https://github.com/yourusername/paranoid/releases/latest/download/paranoid-macos-arm64
chmod +x paranoid-macos-arm64
./paranoid-macos-arm64 --help

Windows (x86_64): Download paranoid-windows-x64.exe from releases and run from Command Prompt or PowerShell.

Option 4: From Source (Development)

Clone the repository and install in development mode:

git clone https://github.com/yourusername/paranoid
cd paranoid
pip install -e .

Configuration

Option 1: Interactive Wizard (Recommended)

# Run the setup wizard
paranoid config init

# Follow the prompts to configure:
#   - LLM Provider (Anthropic/OpenAI/Ollama)
#   - API Key
#   - Model name
#   - Default iterations

# View your configuration
paranoid config show

Option 2: Environment Variables

# Create .env file
cp .env.example .env

# Edit .env and add your API key
ANTHROPIC_API_KEY=sk-ant-xxx
DEFAULT_PROVIDER=anthropic
DEFAULT_MODEL=claude-sonnet-4-20250514
DEFAULT_ITERATIONS=3

Run Your First Threat Model

CLI (Recommended):

# Run STRIDE threat modeling on example
python -m cli.main run examples/stride-example-api-gateway.md

# Or after installation
paranoid run examples/stride-example-api-gateway.md

# With your own system description
paranoid run my-system.md

# See all options
paranoid run --help

Output:

Configuration:
  Provider: anthropic
  Model: claude-sonnet-4-20250514
  Iterations: 3
  Framework: STRIDE
  Input: stride-example-api-gateway.md

  Output: stride-example-api-gateway_threats.json
  Format: simple

[>] summarize: Generating system summary...
[[OK]] summarize: Summary generated: 196 chars
[>] extract_assets: Identifying assets and entities...
[[OK]] extract_assets: Identified 14 assets/entities
[>] extract_flows: Extracting data flows and trust boundaries...
[[OK]] extract_flows: Identified 12 flows, 6 boundaries
[>] generate_threats [iter 1]: Generating threats (iteration 1/3)...
[[OK]] generate_threats [iter 1]: Generated 10 threats
...
[[OK]] complete: Pipeline complete: 2 iterations, 17 threats

================================================================================
THREAT MODEL COMPLETE
================================================================================
Total Threats:      17
Iterations:         2
Duration:           115.0 seconds
Output:             stride-example-api-gateway_threats.json

Test Harness (Development):

python test_pipeline.py
# Interactive menu with 4 test scenarios

Python API:

from backend.pipeline.runner import run_pipeline_for_model
from backend.providers.anthropic import AnthropicProvider
from backend.models.enums import Framework

provider = AnthropicProvider(api_key="your-key")

async for event in run_pipeline_for_model(
    model_id="web-app-001",
    description="E-commerce web application...",
    framework=Framework.STRIDE,
    provider=provider,
    max_iterations=3,
):
    print(f"[{event.step}] {event.message}")

CLI Commands

Configuration Management

# Interactive setup wizard (first-time setup)
paranoid config init

# Reconfigure (overwrite existing config)
paranoid config init --force

# Display current configuration
paranoid config show

# Configuration file location: ~/.paranoid/config.json

Running Threat Models

# Basic usage (auto-detects framework from input)
paranoid run system.md

# Structured templates (auto-detects STRIDE vs MAESTRO)
paranoid run examples/stride-example-api-gateway.md
paranoid run examples/maestro-example-rag-chatbot.md

# JSON output (simple format - lightweight, ~2-3 KB)
paranoid run system.md --output threats.json

# JSON output (full format - complete models + DREAD + events, ~45 KB)
paranoid run system.md --format full -o complete.json

# Force dual framework (STRIDE + MAESTRO in parallel)
paranoid run system.md --maestro

# Override iteration count (1-15)
paranoid run system.md --iterations 7

# Override framework auto-detection
paranoid run system.md --framework MAESTRO

# Quiet mode (suppress real-time output, show only summary)
paranoid run system.md --quiet

# Verbose mode (show detailed event data with complete models)
paranoid run system.md --verbose

# Help
paranoid --help
paranoid run --help
paranoid config --help

Version Information

# Show version, Python version, dependencies, and current configuration
paranoid version

JSON Output Formats

Paranoid supports two JSON export formats optimized for different use cases:

Simple Format (default, ~2-3 KB):

  • Lightweight threat summaries (name, category, target, impact, likelihood, mitigation count)
  • Execution metadata (iterations, duration, threat counts)
  • Perfect for: CI/CD dashboards, quick reviews, status tracking
  • No events, no complete Pydantic models

Full Format (~45 KB):

  • Complete Pydantic models (Assets, Flows, Threats with all fields)
  • DREAD risk assessment scores (Damage, Reproducibility, Exploitability, Affected Users, Discoverability)
  • Full pipeline event audit trail
  • Perfect for: Detailed analysis, archival, integration with other tools
# Simple format (default)
paranoid run system.md -o threats.json

# Full format
paranoid run system.md --format full -o complete.json

Example Simple Format:

{
  "execution": {
    "total_threats": 17,
    "iterations_completed": 2,
    "duration_seconds": 115.0
  },
  "threats": [
    {
      "name": "JWT Token Forgery",
      "category": "Spoofing",
      "target": "API Gateway",
      "impact": "Complete authentication bypass",
      "likelihood": "Medium",
      "mitigation_count": 3
    }
  ]
}

Example Full Format:

{
  "threats": [
    {
      "name": "JWT Token Forgery",
      "stride_category": "Spoofing",
      "description": "Malicious actor can forge JWT tokens...",
      "target": "API Gateway",
      "impact": "Complete authentication bypass",
      "likelihood": "Medium",
      "dread": {
        "damage": 10,
        "reproducibility": 7,
        "exploitability": 5,
        "affected_users": 10,
        "discoverability": 5
      },
      "mitigations": [
        "Implement strict JWT signature validation",
        "Monitor for suspicious token patterns",
        "Implement token blacklisting capability"
      ]
    }
  ],
  "assets": [...],
  "flows": [...],
  "events": [...]
}

Structured Input Templates

Paranoid supports rich XML-tagged templates for better context and assumption enforcement:

STRIDE Template (traditional systems):

  • Component description with technology stack, interfaces, data handling
  • 6 structured assumption sections (security controls, in-scope, out-of-scope, focus areas, etc.)

MAESTRO Template (AI/ML systems):

  • Extended component description with mission alignment, agent profile
  • 9 structured assumption sections (mission constraints, AI-specific controls, agentic considerations, etc.)

See examples/ for full template examples.

Model Configuration

⚠️ Important: Use Claude Sonnet (or newer) for reliable structured output generation.

# In .env file
DEFAULT_MODEL=claude-sonnet-4-20250514

Models Tested:

  • claude-haiku-4-5-20251001 - Fails with JSON parsing errors on complex outputs
  • claude-sonnet-4-20250514 - Validated end-to-end, reliable for production use

Architecture

  • Backend: FastAPI + SQLite + sqlite-vec
  • Frontend: Planned for Phase 10 (v1.0 is pipeline-only)
  • LLM Providers: Anthropic / OpenAI / Ollama (protocol-based, swappable)
  • Pipeline: Plain async functions (no LangChain, no LangGraph)
  • Embeddings: Local via fastembed (ONNX, BAAI/bge-small-en-v1.5)
  • Models: Pydantic v2 for all data validation
  • Frameworks: STRIDE (traditional) + MAESTRO (AI/ML security)

Documentation

User Documentation

Developer Documentation

Test Results

Latest Validation (2026-03-24):

  • ✅ Parser validation: PASSING (no API key required)
  • ✅ STRIDE pipeline: PASSING (15-25 threats)
  • ✅ STRIDE+MAESTRO dual framework: PASSING (24 threats, 213s, 2 iterations)
  • ✅ Assumption enforcement: VALIDATED
  • ✅ Gap-driven iteration stopping: VALIDATED

See TESTING.md for detailed results.

License

Apache 2.0


Development Status

v1.0 Release Candidate - CLI Complete!

Completed:

  • ✅ Phase 1: Scaffold (FastAPI + Svelte setup)
  • ✅ Phase 2: Persistence layer (SQLite + sqlite-vec)
  • ✅ Phase 3: Pydantic models (ported + extended)
  • ✅ Phase 4: LLM provider layer (Anthropic, OpenAI, Ollama)
  • ✅ Phase 5: STRIDE + MAESTRO prompts
  • ✅ Phase 6: Core pipeline (8 nodes, iteration logic, SSE, dual framework, structured input)
  • CLI Phase 1: MVP (basic paranoid run command, console output)
  • CLI Phase 2: Configuration Management (interactive wizard, ~/.paranoid/config.json)
  • CLI Phase 3: JSON Export (simple/full formats, --output flag, DREAD scoring)
  • CLI Phase 4: Structured Input Support (auto-detect, --maestro flag)
  • CLI Phase 5: Advanced Options & Polish (--quiet, --verbose, --iterations, --framework, paranoid version)
  • CLI Phase 6: Packaging & Release (PyPI, Docker Hub, standalone binaries, GitHub Actions)

Ready for Release:

  • 🎉 CLI is production-ready (6/6 phases complete, 100%)
  • 🎉 Available on PyPI as paranoid-cli
  • 🎉 Docker images on Docker Hub (multi-arch: amd64, arm64)
  • 🎉 Standalone binaries for Linux, macOS, Windows

Future Features (v2.0+):

  • 📋 Phase 6.9: RAG retrieval integration
  • 📋 Phase 7: Rule engine + seed data
  • 📋 Phase 8: MCP client
  • 📋 Phase 9: API routes (REST + SSE)
  • 📋 Phase 10: Frontend (Svelte UI)

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

paranoid_cli-1.0.1.tar.gz (85.5 kB view details)

Uploaded Source

Built Distribution

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

paranoid_cli-1.0.1-py3-none-any.whl (84.1 kB view details)

Uploaded Python 3

File details

Details for the file paranoid_cli-1.0.1.tar.gz.

File metadata

  • Download URL: paranoid_cli-1.0.1.tar.gz
  • Upload date:
  • Size: 85.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paranoid_cli-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4739acd346ef656fc4dd8f8ea391fb1ee75aa551af8874c50feaee14a90bba77
MD5 070abe27dcc314e7926ebc85606b0078
BLAKE2b-256 5fe57d891eb7285852e5e978662a3a2a8c48387897cdcdbd10e4f44cbb49daa7

See more details on using hashes here.

Provenance

The following attestation bundles were made for paranoid_cli-1.0.1.tar.gz:

Publisher: release.yml on theAstiv/paranoid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file paranoid_cli-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: paranoid_cli-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 84.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paranoid_cli-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 822e94c20d6a623d897f52b3119c38408a2b70a0a5cfa3db0cee133c74b63767
MD5 7a87ca0c2db9ab35fd841c155bd76210
BLAKE2b-256 b79a40f4d4f817d2c2cbd7c1e61acd75bd877259905963e1f0fb36cc13088d5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for paranoid_cli-1.0.1-py3-none-any.whl:

Publisher: release.yml on theAstiv/paranoid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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