Skip to main content

Test your AI deployments against security vulnerabilities.

Project description

Akira Logo

LLM Security Testing Framework

License

Akira is a security testing framework for LLM-powered applications. Test your AI deployments against prompt injection, jailbreaks, data extraction, denial-of-service, and more.

Installation

# From PyPI
uv pip install akira-security

# With optional dependencies
uv pip install akira-security[aws]        # AWS Bedrock/SageMaker support
uv pip install akira-security[huggingface] # HuggingFace support
uv pip install akira-security[all]        # Everything

# From source (for development)
git clone https://github.com/akira-security/akira
cd akira
uv pip install -e ".[dev]"

Three Ways to Run Attacks

1. Library API (CI/CD, Scripts)

from akira import scan, create_target

target = create_target("anthropic", api_key="sk-...", model="claude-sonnet-4-20250514")

# Run all attacks
result = await scan(target)

# Run specific category
result = await scan(target, category="dos")

# Run specific attacks
result = await scan(target, attacks=["magic_string"])

print(f"Vulnerabilities: {result.vulnerable}/{result.total}")
for name, r in result.results.items():
    if r.success:
        print(f"  [VULN] {name}: {r.confidence:.0%}")

2. CLI Commands (Automation, Scripting)

# Scan with all attacks
akira scan -t https://api.anthropic.com/v1 -T anthropic -k $KEY --all

# Scan specific category
akira scan -t $URL -T anthropic -k $KEY --category dos

# JSON output for pipelines
akira scan -t $URL -T anthropic -k $KEY --all --json > results.json

# Quiet mode + file output
akira scan -t $URL -T anthropic -k $KEY --all --quiet -o results.json

# Run single attack
akira run magic_string -t $URL -T anthropic -k $KEY

# Fingerprint unknown endpoint
akira fingerprint -t https://myapp.com/chat -T api -k $KEY

# Generate HTML report
akira report results.json -o report.html

3. Interactive Console (Exploration, Manual Testing)

$ akira

akira > use magic_string
akira(magic_string) > target anthropic https://api.anthropic.com/v1 -k $KEY
akira(magic_string) > show options
akira(magic_string) > set location system_prompt
akira(magic_string) > run

[*] Executing magic_string...
[+] VULNERABLE (confidence: 95%)

Console Commands:

Command Description
use <attack> Select attack module
info Show attack details
show modules List all attacks
show options Show configurable options
set <opt> <val> Set option value
target <type> <url> Set target
run Execute attack
check Quick probe
search <term> Search attacks
back Deselect attack

Target Types

Type Description
anthropic Anthropic Claude API
openai OpenAI API
api Any REST endpoint (custom request/response format)
hf_inference HuggingFace Inference API
bedrock AWS Bedrock
sagemaker AWS SageMaker

Generic API Target

For LLM-powered endpoints that aren't direct provider APIs:

akira scan -t https://myapp.com/chat -T api -k $KEY \
  --request-template '{"message": "$payload"}' \
  --response-path 'data.reply' \
  --all

Attack Categories

Category Description
dos Denial of service
injection Prompt injection
jailbreak Safety bypass
extraction System prompt / data extraction
evasion Detection evasion
poisoning Training data poisoning
multiturn Multi-turn conversation attacks
tool_abuse Function/tool calling exploits
rag_poison RAG retrieval poisoning
agent_hijack Agentic workflow hijacking

Contributing Attacks

Create akira/attacks/<name>/attack.py:

from akira import attack, Option
from akira.core.target import Target

@attack(
    name="my_attack",
    description="What it does",
    category="injection",
    severity="high",
    author="you",
)
async def my_attack(
    target: Target,
    payload: Option("Injection payload", default="ignore previous") = None,
):
    response = await target.send(payload)
    return {"vulnerable": "secret" in response, "confidence": 0.9}

Each attack lives in its own folder with optional payload files. See CONTRIBUTING.md for details.

License

MIT

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

akira_security-0.1.1.tar.gz (4.0 MB view details)

Uploaded Source

Built Distribution

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

akira_security-0.1.1-py3-none-any.whl (38.5 kB view details)

Uploaded Python 3

File details

Details for the file akira_security-0.1.1.tar.gz.

File metadata

  • Download URL: akira_security-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for akira_security-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a743d0a057f4cf8609c6ec7c85978bd2d7e24fa890fca6596fa5ba725576962a
MD5 c212f40c5db5af8e5ca8f69a787dbdfe
BLAKE2b-256 f5428f0573372e701baa3c9a2729a4ae039be3fd3eccddaa9bb5e244bde38cae

See more details on using hashes here.

File details

Details for the file akira_security-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: akira_security-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 38.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for akira_security-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 23cdcddbb9fa051bbc27b6c08219946c9fea8eb43e77828e05bee0b853f64c92
MD5 b87f43c580d15cd00c51474a1c2710cd
BLAKE2b-256 40dbb3026f390425b8eaac0eee25a5f81ccc49f5a79e9bb60fd5d2d4b9e0f3e9

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