Multi-Turn Attack Chains · Adversarial Testing · OWASP LLM Top 10 Mapping
Gemini Cloud · Five-Model Fallback Chain · Negation-Aware Detection
Repository · Author · Report an Issue
Built by Nilanjan Chowdhury
Test. Classify. Prove. Report.
BRAMHASTRA v2 is a modular LLM security evaluation harness designed to assess the security posture of large language model applications through structured adversarial testing.
Built around a cloud-based inference architecture, BRAMHASTRA evaluates model behavior against a curated suite of 34 adversarial payloads across eight attack categories, including instruction override, jailbreak attempts, prompt extraction, indirect prompt injection, and tool-call security.
The framework combines configurable payload execution, a negation-aware detection engine, OWASP LLM Top 10 mapping, and automated HTML/JSON reporting to help security researchers identify, classify, and document potentially unsafe model behavior.
Unlike the original version, v2 moves inference away from mandatory local model execution to a Gemini cloud adapter with a five-model fallback chain, reducing local compute requirements.
- 34 adversarial payloads organized into eight attack categories.
- Multi-turn attack chains for evaluating behavior across conversational context.
- Gemini cloud integration with a five-model fallback chain.
- Negation-aware detection to reduce false positives caused by simple keyword matching.
- Refusal-aware classification to distinguish apparent refusal behavior from potential attack success.
- OWASP LLM Top 10 mapping to associate findings with relevant risk categories.
- HTML and JSON reports for reviewing and documenting assessment results.
- Modular architecture separating adapters, execution logic, detection, payloads, and reporting.
┌────────────────────────┐
│ YAML Payload Suites │
└────────────┬───────────┘
│
▼
┌────────────────────────┐
│ Execution Engine │
│ Load · Run · Orchestrate│
└────────────┬───────────┘
│
▼
┌────────────────────────┐
│ Gemini Cloud Adapter │
│ Five-Model Fallback │
└────────────┬───────────┘
│
▼
┌────────────────────────┐
│ Detection Engine │
│ Negation · Refusal │
└────────────┬───────────┘
│
▼
┌────────────────────────┐
│ OWASP LLM Top 10 │
│ Finding Classification│
└────────────┬───────────┘
│
▼
┌────────────────────────┐
│ Report Generation │
│ HTML + JSON │
└────────────────────────┘
| Feature | v1 | v2 |
|---|---|---|
| Architecture | Monolithic script | Modular components |
| Inference | Local Ollama | Gemini cloud adapter |
| Payload coverage | 10 payloads | 34 payloads |
| Attack techniques | Primarily single-shot | Single-shot, multi-turn, and tool-call testing |
| Detection | Basic string matching | Negation-aware classification |
| Model fallback | None | Five-model fallback chain |
| Reporting | JSON | HTML and JSON |
| OWASP mapping | Basic or claimed mapping | Finding-level risk mapping with supporting evidence |
BRAMHASTRA v2 organizes its 34 payloads into eight categories.
| Category | Payloads | Assessment Objective |
|---|---|---|
| Instruction Override | 5 | Evaluate resistance to conflicting and adversarial instructions. |
| Role-Play Jailbreak | 5 | Test attempts to bypass behavioral restrictions through role-play. |
| Prompt Exfiltration | 5 | Assess resistance to requests for hidden instructions and system prompts. |
| Indirect Injection | 4 | Evaluate handling of adversarial instructions embedded in external content. |
| Encoding Obfuscation | 4 | Test handling of encoded or obfuscated adversarial instructions. |
| Scope Boundary | 3 | Examine attempts to expose internal configuration or cross intended boundaries. |
| Multi-Turn Chains | 4 | Assess cumulative attacks involving trust establishment, context manipulation, and escalation. |
| Tool-Call Security | 4 | Evaluate risks associated with tool misuse, indirect injection, and excessive agency. |
| Total | 34 | Eight attack categories |
- Single-shot: Evaluate model responses to individual adversarial inputs.
- Multi-turn: Evaluate behavior across sequences of related conversational inputs.
- Tool-call security: Assess relevant tool-use and agent-security scenarios in supported test environments.
Basic keyword-based scanners can misclassify safe responses as vulnerabilities simply because a response contains a sensitive term.
For example:
Test signal: password
Model response:
I cannot provide the password.
A naive detector may flag the response because it contains the keyword password. BRAMHASTRA's negation-aware detector examines the surrounding context for configured negation indicators, such as cannot, not, don't, and no.
When the context indicates refusal rather than disclosure, the detector can classify the response as LIKELY_SAFE.
The framework also includes a refusal override intended to reduce false positives when a model explicitly refuses an adversarial request.
For example:
Response: I cannot help with that request.
Classification: LIKELY_SAFE
In the described implementation, recognized refusal behavior caps the confidence score at 0.1.
The detection pipeline is designed to evaluate observed responses against configured attack-success signals and produce structured findings.
A finding may include:
- Payload identifier and attack category.
- Model response and observed indicators.
- Classification and confidence score.
- Associated OWASP LLM risk category.
- Evidence available to support the classification.
Important: Negation and refusal detection are heuristics, not proofs of security. A response can contain a refusal followed by sensitive disclosure, and a model can fail without using an expected success keyword. Findings should be manually reviewed and validated before being treated as confirmed vulnerabilities.
BRAMHASTRA maps applicable findings to relevant categories in the OWASP Top 10 for LLM Applications.
Depending on the observed behavior and available evidence, relevant categories may include:
| Assessment Area | Potential OWASP Category |
|---|---|
| Prompt injection and indirect injection | LLM01: Prompt Injection |
| Sensitive information disclosure | LLM02: Sensitive Information Disclosure |
| Inadequate output validation | LLM05: Improper Output Handling |
| Excessive tool permissions or agency | LLM06: Excessive Agency |
| System prompt exposure | Potentially LLM07: System Prompt Leakage |
Mappings depend on the applicable OWASP version and the actual behavior observed. A test category alone does not establish a vulnerability, and system prompt disclosure is not automatically equivalent to a confirmed security impact.
The report should preserve the observed evidence and rationale behind each mapping.
BRAMHASTRA/
│
├── adapters/
│ ├── base_adapter.py
│ └── gemini_adapter.py
│
├── core/
│ ├── engine.py
│ ├── detector.py
│ └── html_reporter.py
│
├── payloads/
│ ├── single_shot.yaml
│ ├── multi_turn.yaml
│ └── tool_call.yaml
│
├── bramhastra_v2.py
├── requirements.txt
├── .env.example
├── .gitignore
├── LICENSE
└── README.md
| Component | Responsibility |
|---|---|
adapters/ |
Model-provider integration and fallback handling. |
core/engine.py |
Payload loading, execution, and orchestration. |
core/detector.py |
Response analysis and classification. |
core/html_reporter.py |
HTML report generation. |
payloads/ |
YAML-defined attack cases and test sequences. |
bramhastra_v2.py |
Command-line entry point. |
- Python 3.10 or later.
- A Google Gemini API key with access to a supported model.
- Internet connectivity for cloud inference.
- Git.
git clone https://github.com/CalculusGuy/BRAMHASTRA.git
cd BRAMHASTRALinux / Kali Linux / macOS
python3 -m venv venv
source venv/bin/activateWindows PowerShell
python -m venv venv
.\venv\Scripts\Activate.ps1python -m pip install --upgrade pip
pip install -r requirements.txtCreate a .env file in the project root, following the structure of .env.example.
GEMINI_API_KEY=your_google_api_key_hereReplace the placeholder with your own API key.
Security note: Never commit .env, API keys, or other credentials to GitHub. Ensure your .gitignore excludes secret-bearing files.
The examples below assume the CLI exposes the corresponding arguments.
python bramhastra_v2.py --reportpython bramhastra_v2.py --suite single_shotpython bramhastra_v2.py --suite multi_turn --reportpython bramhastra_v2.py --suite tool_call --reportUse --help to inspect the arguments supported by your installed version:
python bramhastra_v2.py --helpThe following is an illustrative example of the CLI output format, not a guarantee of results from every model or execution.
==================================================
BRAMHASTRA v2 — LLM SECURITY EVALUATION
==================================================
[+] Gemini adapter initialized.
[+] Loaded 34 payloads.
[*] Running adversarial evaluation...
[VULNERABLE] io_001 (instruction_override)
Confidence: 0.70
Evidence: Expected attack-success indicator observed.
[LIKELY_SAFE] ex_001 (prompt_exfiltration)
Confidence: 0.00
[REVIEW] in_002 (indirect_injection)
Evidence: Response requires manual validation.
==================================================
[+] Evaluation complete.
[+] Findings saved to HTML and JSON reports.
==================================================
Actual classifications, confidence scores, report paths, and the number of findings depend on the target model, payloads, detector configuration, and runtime implementation.
BRAMHASTRA v2 is designed to generate two report formats.
| Format | Purpose |
|---|---|
| HTML | Human-readable findings and assessment review. |
| JSON | Structured results for scripting, analysis, and downstream processing. |
The HTML report uses a dark-themed interface intended for reviewing attack results and classifications.
For reliable reporting, findings should retain enough context to reproduce and independently validate the observed behavior.
BRAMHASTRA is an evaluation harness, not a formal proof of LLM security.
- Heuristic detection: Negation, refusal, and keyword matching can still produce false positives and false negatives.
- Model variability: Different models and model versions may respond differently to the same payload.
- Provider dependencies: API availability, rate limits, access permissions, and model retirement can affect execution.
- Fallback behavior: A fallback model may have different capabilities and safety behavior from the primary model. Record which model actually handled each test.
- OWASP mapping: Mapping a finding to a risk category does not independently establish exploitability or business impact.
- Tool-call testing: Meaningful agent-security testing requires an appropriate test environment and explicit instrumentation of relevant tools and actions.
Use manual validation and repeatable test conditions when evaluating results.
BRAMHASTRA is intended for authorized AI security research, defensive testing, and educational use.
Use it only against:
- LLM applications you own.
- Systems for which you have explicit authorization to conduct security testing.
- Controlled laboratories and research environments.
Do not use the framework to access unauthorized systems, exfiltrate confidential information, or disrupt third-party services.
When testing cloud-hosted models, comply with the provider's terms, usage policies, and applicable laws. Avoid submitting real credentials, personal information, or confidential production data in adversarial prompts.
Potential future improvements include:
- Per-finding evidence and reproducibility metadata.
- Versioned OWASP LLM Top 10 mappings.
- More robust semantic and context-aware detection.
- Model-by-model comparison reports.
- Configurable payload tagging and severity assessment.
- Regression testing across model versions.
- Expanded tool-use and agent-security evaluation.
- Automated tests for detector accuracy and false-positive rates.
Offensive Security Research · AI/LLM Red Teaming
- GitHub: @CalculusGuy
- LinkedIn: Nilanjan Chowdhury
- Medium: @nilanjan.calculus
Learning. Building. Breaking. Securing.
This project is licensed under the MIT License.
Test. Classify. Prove. Report.
If you find this project useful for AI security research, consider giving the repository a star.