SecureAIforTheWorld01/SecureLLM
π‘οΈ SecureAIforTheWorld
An open-source AI/ML pentesting tool that evaluates Large Language Models for security vulnerabilities, hallucination tendencies, and jailbreak resistance.
Built to help enterprises understand and improve the security posture of their deployed LLMs.
What It Does
SecureAIforTheWorld connects to your LLM via API and runs automated security assessments across three categories:
The tool generates a 0-100 security score per category and an overall weighted grade (A-F), along with detailed per-test findings showing exactly where your model is vulnerable.
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Gradio UI (4 tabs) β
βββββββββββββββ¬βββββββββββββββ¬ββββββββββββββββ¬βββββββββββββββββ€
β Model β Jailbreak β Hallucination β Run Evaluation β
β Connection β Dataset β Dataset β Dashboard β
ββββββββ¬βββββββ΄βββββββββββββββ΄ββββββββββββββββ΄βββββββββ¬ββββββββ
β β
βΌ βΌ
ββββββββββββββββ ββββββββββββββββββββ
β Connectors β β Score Aggregator β
β - Azure AI ββββββββββββββββββββββββββββΊβ - Category scores β
β - AWS Bedrockβ sends prompts β - Overall grade β
ββββββββββββββββ gets responses β - Recommendations β
ββββββββββ¬ββββββββββ
β
ββββββββββββββββββββββββββββΌβββββββββββ
βΌ βΌ βΌ
ββββββββββββββββββ ββββββββββββββββββββ ββββββββββ
β Jailbreak β β Hallucination β βScorers β
β Dataset (28) β β Test Runners β β- Factualβ
β 7 categories β β - Factual (30) β β- Faith β
β 4 sources β β - Faithful (45) β β- Jailbkβ
ββββββββββββββββββ ββββββββββββββββββββ ββββββββββQuick Start
Prerequisites
- Python 3.9+
- API access to Azure AI Foundry or AWS Bedrock
Install & Run
git clone https://github.com/YOUR_USERNAME/SecureAIforTheWorld.git
cd SecureAIforTheWorld
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python app.pyOpen http://127.0.0.1:7860 in your browser.
Usage
- Model Connection tab β Enter your provider, API key, endpoint, and deployment name. Click "Test Connection".
- Run Evaluation tab β Select which modules to run (jailbreak, factual, faithfulness) and click "Run Full Evaluation".
- Review results β See your overall score, category breakdown with grades, and detailed per-test findings.
Example: Azure AI Foundry
- Provider:
Azure AI Foundry - API Key: your key from Azure portal
- Endpoint:
https://your-resource.services.ai.azure.com - Deployment:
gpt-4.1
Scoring Methodology
Weights
- Jailbreak Resistance: 40% (most critical for enterprise security)
- Factual Accuracy: 30%
- Faithfulness: 30%
Heuristic Scoring Engine
Grading Scale
Jailbreak Attack Categories
The tool tests 7 categories of jailbreak attacks:
- Role Play β DAN, evil AI persona, fiction framing
- Encoding Tricks β Base64, ROT13, acrostic, string reversal
- Authority Manipulation β Fake system overrides, admin tokens, policy claims
- Multi-Turn β Gradual escalation, yes-pattern conditioning, flattery
- Context Overflow β Long prefix injection, attention exhaustion
- Instruction Injection β Translation injection, fake system prompts in content
- Ethical Bypass β Hypothetical framing, academic excuses, public info arguments
Sources: JailbreakBench, AdvBench, HarmBench + custom original prompts.
Project Structure
SecureAIforTheWorld/
βββ app.py # Gradio UI (4 tabs)
βββ requirements.txt # Pinned dependencies
βββ README.md # This file
βββ modules/
β βββ __init__.py
β βββ connectors.py # Azure AI Foundry + AWS Bedrock connectors
β βββ hallucination.py # Factual + Faithfulness test runners
β βββ score_aggregator.py # Scoring pipeline + report generation
β βββ scorers/
β βββ __init__.py
β βββ heuristic_scorer.py # Heuristic scoring (similarity, patterns)
β βββ llm_judge.py # LLM-as-judge scorer (future)
βββ datasets/
β βββ jailbreak_prompts.json # 28 attack prompts, 7 categories
β βββ factual_qa.json # 30 factual questions, 6 domains
β βββ faithfulness_contexts.json # 15 contexts, 45 questions
βββ tests/
βββ test_connectors.py # 21 tests
βββ test_datasets.py # 16 tests
βββ test_hallucination.py # 16 tests
βββ test_heuristic_scorer.py # 32 tests
βββ test_score_aggregator.py # 21 tests
βββ test_placeholder.py # 2 testsTotal: 106 automated tests
Supported Providers
Roadmap / Community Extensions
This is an MVP. The community is invited to extend it:
- [ ] LLM Judge scorer β Use a small model (Mistral-7B) as an evaluation judge
- [ ] More jailbreak categories β Token smuggling, multi-language attacks
- [ ] More model providers β Google Vertex AI, Hugging Face Inference
- [ ] PDF report export β Downloadable security assessment report
- [ ] API key security hardening β Env var fallback, memory clearing, security notices
- [ ] CI/CD integration β Run evaluations in pipelines, fail on score thresholds
- [ ] Historical tracking β Compare scores across model versions
Tech Stack
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-attack-category) - Add tests for your changes
- Run
pytest tests/ -vto verify - Submit a pull request
License
MIT
Acknowledgments
- OWASP LLM Top 10 for security taxonomy
- JailbreakBench for public attack research
- AdvBench (Zou et al., 2023)
- HarmBench (Mazeika et al., 2024)
- Hugging Face for free model hosting and Spaces
