You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Offensive-security toolkit for authorized red-team engagements.
offsec-ai is a Python library and CLI that combines classic network reconnaissance with modern AI/LLM security testing. It probes live AI/LLM endpoints for the OWASP LLM Top 10, scans and actively attacks Model Context Protocol (MCP) servers for known CVEs, and performs full-stack infrastructure security assessments.
Legal Notice: Active attack features (mcp-attack, openclaw-attack, k8s-attack, auth-attack, a2a-attack, postman-attack, deep mode) require the --i-have-authorization flag. Only use against systems you own or have explicit written permission to test.
Features
New in v2.7.0 — Postman Collection Security Scanner & Attacker
Feature
Description
📬 Postman Scanner
Parses Postman Collection v2.x exports, resolves {{variables}} from environment files, probes every endpoint, and runs static analysis: missing auth on sensitive routes, unresolved variables, verbose error disclosure, secrets in responses, wildcard CORS
🔑 Secret Detection
10 regex patterns scan response bodies for leaked credentials — AWS keys, OpenAI keys, GitHub PATs, JWTs, generic bearer tokens, Slack webhooks, and more
⚔️ Postman Attacker
Authorization-gated active OWASP API Top 10 testing: safe mode (auth bypass only) and deep mode (auth bypass + BOLA/IDOR + mass assignment + injection + SSRF) against every endpoint in the collection
🧩 Variable Resolution
{{baseUrl}}, {{token}}, and custom variables resolved from both collection-level and environment file; unresolved placeholders flagged as PM-ADV-CFG-001
🎯 Target Override
--target/-T rewrites the host/scheme of every endpoint so a single collection can be aimed at any environment (dev / staging / prod)
🤖 LLM Judge Integration
Optional judge enriches LOW/MEDIUM findings with provider reasoning and synthesises an exploit_chain_summary across all triggered attacks
New in v2.6.0 — A2A (Agent-to-Agent) Protocol Security
Feature
Description
🤝 A2A Scanner
Fetches the Agent Card (/.well-known/agent-card.json), parses declared skills/capabilities/security schemes, probes authentication posture, and runs 8-phase static analysis against 10 A2A security advisories
🔐 Auth Posture Check
Sends an unauthenticated SendMessage JSON-RPC probe to detect open task endpoints; maps securitySchemes to OAuth2/OIDC/Bearer/mTLS/apiKey/none
Regex-based scan of the Agent Card JSON for leaked API keys, tokens, and credentials (OpenAI sk-, AWS AKIA, GitHub ghp_, Slack, etc.)
📋 10 A2A Advisories
A2A-ADV-2025-001 through 010 — from missing securitySchemes and unauthenticated task access to unsigned Agent Cards, SSRF via push-notification webhooks, and plaintext HTTP endpoints
⚔️ A2A Attacker
Authorized red-team module with safe mode (auth-bypass probes) and deep mode (auth bypass + SSRF webhook + message injection + task enumeration + JSON-RPC manipulation)
🤖 Optional LLM Judge
Enriches MEDIUM/LOW findings with provider reasoning; shows LLM Judge: gemini in the results panel and footer
New in v2.5.0 — Universal LLM Judge "Powered By" + OWASP Web Scanner Judge Support
Feature
Description
🔍 OWASP Web Scanner LLM Judge
owasp-scan now accepts --llm-judge; enriches MEDIUM/LOW findings with provider reasoning; upgrades LOW→MEDIUM when confidence > 0.7; verbose mode shows per-finding LLM (X%): ...
📢 "Powered by" display everywhere
Every --llm-judge command now shows LLM Judge: gemini (or openai / anthropic) inside the result panel and prints LLM Judge powered by: gemini as a footer — consistent across all 9 modules
🐛 k8s-scan / k8s-attack bug fix
Both commands previously used LLMJudge() directly (bypassing is_available()), which could crash with no API key. Fixed to use LLMJudge.from_env() + is_available() — the same safe pattern used by all other commands
📋 OwaspFinding enrichment
Two new optional fields: `llm_reasoning: str
New in v2.4.0 — OIDC / OAuth 2.0 / SAML Auth Protocol Security
Feature
Description
🔑 Auth Protocol Scanner
Passive detection of OIDC, OAuth 2.0, and SAML endpoints; fingerprints provider (Google, Entra ID, Keycloak, Auth0, Okta, Cognito, etc.); parses discovery documents and SAML metadata
PKCE enforcement, implicit flow, state parameter, alg=none in JWT, JWKS cache-control, SAML signing certificates, XML Signature Wrapping surface
🤖 Optional LLM Judge
Triages MEDIUM/LOW auth findings; shows LLM Judge: gemini (or openai / anthropic) in every scan/attack panel; falls back to rule-based when no API key is set
⚔️ Auth Attacker
Authorized red-team probes — safe mode: open redirect, state bypass, PKCE bypass; deep mode adds JWT alg=none, scope escalation, authorization code replay, SAML XSW (5 variants), JWKS confusion
Findings mapped to K01–K10; 10+ advisories (K8S-ADV-###) + real CVEs (CVE-2018-1002105, CVE-2019-11253, CVE-2020-8558, CVE-2021-25741, CVE-2022-3294)
🤖 Optional LLM Judge
LLMJudge triages ambiguous findings and generates remediation advice; supports OpenAI, Anthropic, and Google Gemini; rule-based fallback when no API key is set
OCL-ADV-001 through OCL-ADV-010 — from unauthenticated REST/WebSocket access to insecure sandbox modes, DM policy exposure, and API-key leakage via config endpoint
⚔️ OpenClaw Attacker
Authorized active exploitation: prompt injection, SSRF via webhook, session history dump, WebSocket message injection; optional --llm-judge for attack-path narrative
New in v2.0.0 — AI / LLM Security
Feature
Description
🤖 AI OWASP Top 10 Scanner
Black-box probing of live LLM/chat API endpoints for all 10 OWASP LLM categories
🔬 Rule-based + LLM Judge
Pattern-based detection + optional LLM judge (OpenAI / Anthropic / Gemini) via [ai] extra
Scans and actively tests A2A protocol agent endpoints for security vulnerabilities. The A2A protocol (Google, 2025) is an open standard enabling AI agents to communicate via JSON-RPC 2.0 over HTTP. Agents publish an Agent Card at /.well-known/agent-card.json declaring their capabilities, skills, and security schemes.
Scans and actively attacks every API endpoint defined in a Postman Collection v2.x export. Supports variable resolution from Postman environment files, target override for cross-environment testing, and optional LLM judge enrichment.
Security Checks Performed
Check ID
Severity
Description
PM-ADV-AUTH-001
High
No auth header/scheme on a sensitive endpoint (admin, user, payment, …)
PM-ADV-CFG-001
Medium
Unresolved {{variable}} placeholders in URL or headers
# Safe mode (auth bypass only) — must provide --i-have-authorization
offsec-ai mcp-attack https://mcp.example.com/mcp --i-have-authorization
# Deep mode (all attacks)
offsec-ai mcp-attack https://mcp.example.com/mcp \
--i-have-authorization --mode deep
# JSON output
offsec-ai mcp-attack https://mcp.example.com/mcp \
--i-have-authorization --output attack-report.json
Python API
importasynciofromoffsec_aiimportMCPAttacker, MCPScanner, AuthorizationRequiredasyncdefmain():
# Authorization is enforced at instantiationtry:
bad=MCPAttacker() # raises AuthorizationRequiredexceptAuthorizationRequired:
passattacker=MCPAttacker(authorized=True)
# Optional: use scan result to guide attacksscanner=MCPScanner("https://mcp.example.com/mcp")
scan_result=awaitscanner.scan()
report=awaitattacker.attack(
target="https://mcp.example.com/mcp",
transport="http",
mode="deep",
scan_result=scan_result,
)
print(f"Attacks run: {report.attacks_run}")
print(f"Triggered: {len(report.triggered_results)}")
forrinreport.triggered_results:
print(f" [{r.severity.value}] {r.title}")
asyncio.run(main())
OIDC / OAuth 2.0 / SAML Auth Protocol Security
Passive scanner and authorized attacker for identity provider endpoints across OIDC, OAuth 2.0, and SAML 2.0. Requires no credentials — all probes are passive HTTP requests unless attack mode is explicitly enabled.
Security Checks
Check ID
Protocol
Severity
Description
OFFSEC-AUTH-PKCE-001
OIDC/OAuth2
HIGH
PKCE not supported
OFFSEC-AUTH-PKCE-002
OIDC/OAuth2
MEDIUM
PKCE supported but not required
OFFSEC-AUTH-IMPL-001
OIDC/OAuth2
HIGH
Implicit flow enabled
OFFSEC-AUTH-JWTALGN-001
OIDC
HIGH
alg=none accepted in JWKS
OFFSEC-AUTH-STATE-001
OIDC/OAuth2
MEDIUM
State parameter not enforced
OFFSEC-AUTH-JWKS-001
OIDC
LOW
JWKS endpoint lacks cache-control
OFFSEC-AUTH-SAML-NOSIG
SAML
HIGH
No signing certificate in metadata
OFFSEC-AUTH-SAML-NOACS
SAML
MEDIUM
No AssertionConsumerService endpoint
OFFSEC-AUTH-SAML-XSW
SAML
INFO
XML Signature Wrapping attack surface
CVE Database (sample)
CVE
Severity
Description
CVE-2019-3778
CRITICAL
Spring Security OAuth — open redirect via malformed redirect_uri
See docs/auth.md for the full guide including CVE detail, remediation advice, and SAML testing tips.
OpenClaw Gateway Security
OpenClaw is a self-hosted AI-assistant gateway that bridges messaging platforms (Telegram, Discord, Slack, etc.) to LLM backends. Because OpenClaw instances are often internet-exposed, misconfigurations lead to unauthenticated LLM access, conversation history disclosure, SSRF, and prompt injection surfaces.
Scanner (openclaw-scan)
Five-phase passive assessment — no exploitation:
Phase
What it does
1 — Fingerprint
Probe /health, /status, /api/v1/status; match headers/body against OpenClaw signatures; extract version and gateway ID
2 — Endpoint Enumeration
Probe all known API paths (/api/v1/*, /ws/*, /webhooks); flag endpoints leaking API keys or tokens in response bodies
3 — Authentication Posture
Detect unauthenticated REST API access; probe for unauthenticated WebSocket upgrade on /ws and /api/v1/ws
4 — Configuration Assessment
Parse /api/v1/config for DM policy and sandbox mode settings
5 — CVE / Misconfiguration
Cross-reference findings against advisory database; produce severity-ranked vulnerability list
See docs/openclaw.md for the full guide including remediation advice.
Kubernetes Cluster Security
Black-box scanning and authorized red-team testing of exposed Kubernetes cluster components, aligned with the OWASP Kubernetes Top 10 (2025). No kubernetes SDK or kubeconfig required — all probes are over the network via httpx.
offsec-ai --help
Commands:
ai-owasp-scan Probe a live LLM/AI endpoint for AI OWASP Top 10
mcp-scan Scan an MCP endpoint for security vulnerabilities
mcp-attack Perform authorized active testing against an MCP server
a2a-scan Scan an A2A (Agent-to-Agent) protocol agent for security vulnerabilities
a2a-attack Authorized active attack against an A2A agent endpoint
openclaw-scan Five-phase passive security scan of an OpenClaw AI gateway
openclaw-attack Authorized active attack against an OpenClaw gateway
k8s-scan Black-box Kubernetes cluster security scan (OWASP K8s Top 10)
k8s-attack Authorized active red-team attack against Kubernetes components
auth-scan Passive OIDC / OAuth 2.0 / SAML auth protocol security scan
auth-attack Authorized active attack against auth/identity endpoints
postman-scan Passively scan every API endpoint defined in a Postman Collection v2.x
postman-attack Perform authorized active security testing against a Postman Collection
scan Scan target hosts for open ports
l7-check Check for L7 protection services (WAF, CDN, etc.)
full-scan Port scan + L7 protection detection
cert-check Analyze SSL/TLS certificate chain
cert-chain Analyze complete certificate chain and trust path
cert-info Show detailed certificate information
dns-trace Trace DNS records and analyze L7 protection
owasp-scan OWASP Top 10 2021/2025 vulnerability scanner (--llm-judge supported)
hybrid-identity Check for Azure AD/ADFS hybrid identity setup
mtls-check Check for mTLS authentication support
mtls-gen-cert Generate a self-signed certificate for mTLS testing
mtls-validate-cert Validate client certificate and private key files
service-detect Detect service version and information
Docker
The image is published to two registries on every version tag:
Registry
Image
Docker Hub
htunnthuthu/offsec-ai
GitHub Container Registry
ghcr.io/htunn/offsec-ai
# Docker Hub
docker run --rm htunnthuthu/offsec-ai:latest ai-owasp-scan https://api.example.com/v1/chat/completions
docker run --rm htunnthuthu/offsec-ai:latest mcp-scan https://mcp.example.com/mcp
docker run --rm htunnthuthu/offsec-ai:latest a2a-scan https://agent.example.com
docker run --rm htunnthuthu/offsec-ai:latest scan example.com
docker run --rm htunnthuthu/offsec-ai:latest owasp-scan example.com
# Mount a local collection for postman-scan / postman-attack
docker run --rm -v $(pwd):/work htunnthuthu/offsec-ai:latest \
postman-scan /work/collection.json -T https://api.example.com
docker run --rm -v $(pwd):/work htunnthuthu/offsec-ai:latest \
postman-attack /work/collection.json --i-have-authorization --mode deep -T https://api.example.com
# GitHub Container Registry (ghcr.io) — no Docker Hub account required
docker run --rm ghcr.io/htunn/offsec-ai:latest ai-owasp-scan https://api.example.com/v1/chat/completions
docker run --rm ghcr.io/htunn/offsec-ai:latest a2a-scan https://agent.example.com
docker run --rm ghcr.io/htunn/offsec-ai:latest scan example.com
docker run --rm -v $(pwd):/work ghcr.io/htunn/offsec-ai:latest \
postman-scan /work/collection.json -T https://api.example.com
# Save output to host
docker run --rm -v $(pwd):/app/output ghcr.io/htunn/offsec-ai:latest \
ai-owasp-scan https://api.example.com/v1/chat/completions \
--output /app/output/llm-report.json
# LLM Judge — openai, anthropic, or gemini key auto-detected; no extra install needed
docker run --rm \
-e OPENAI_API_KEY=sk-... \
ghcr.io/htunn/offsec-ai:latest \
ai-owasp-scan https://api.example.com/v1/chat/completions --llm-judge
# Custom OpenAI-compatible backend (Ollama, LM Studio, Azure OpenAI…)
docker run --rm \
-e OFFSEC_LLM_BASE_URL=http://host.docker.internal:11434/v1 \
-e OFFSEC_LLM_MODEL=llama3 \
ghcr.io/htunn/offsec-ai:latest \
ai-owasp-scan https://api.example.com/v1/chat/completions --llm-judge
See docs/DOCKER.md for the full Docker reference including CI/CD integration, Kubernetes jobs, Makefile publish targets, and troubleshooting.
Configuration
Environment Variables
Variable
Description
OPENAI_API_KEY
Enable OpenAI-based LLM judge
ANTHROPIC_API_KEY
Enable Anthropic-based LLM judge
OFFSEC_LLM_BASE_URL
Custom OpenAI-compatible base URL for LLM judge
Optional Extras
pip install "offsec-ai[ai]"# Adds openai + anthropic for LLM judge
Security & Ethics
This tool is designed for authorized security assessments only.
Active attack features display an authorization banner and require --i-have-authorization
MCPAttacker(authorized=False) raises AuthorizationRequired at instantiation — cannot be bypassed
Default scan modes are passive (safe mode) and will not modify target systems
Do not use against systems you do not own or lack explicit written permission to test