Skip to main content

LLM security testing framework - test your AI deployments against prompt injection, jailbreaks, and more

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.0.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.0-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: akira_security-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 eb549e88ec86472d7001ffc2c6d2da10d72c4993fcd4d25b797c3eaf44e5a054
MD5 919e4431825c5638ac69d27afb9905de
BLAKE2b-256 7fbeba6bce9163d0c9d25e371b4cabcf9a094073311db13ebb9c6090dbb1db1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: akira_security-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 38.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e997d3618651ff971e01ec3fd39f9a61be3219ba5110928f105272a494104005
MD5 ad045fe8ad9b3ab3a5e685c878506fa1
BLAKE2b-256 4136ff95fd338b78dbbef63fae8da56f9a008c97ab06974b8441441be0b26034

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