Système RAG du Guide de test de sécurité Web OWASP avec ChromaDB, MCP pour Claude Code
Un système de génération augmentée par récupération (RAG) qui indexe le Guide de test de sécurité web de l'OWASP (WSTG) dans une base de données vectorielle, offrant un accès instantané aux méthodologies de test de sécurité via l'API REST et MCP (Model Context Protocol) pour l'intégration avec Claude Code.
WSTG-INPV-05)| Catégorie | ID WSTG | Description |
|---|
| Collecte d'informations | WSTG-INFO | Prise d'empreintes, énumération, cartographie |
| Configuration | WSTG-CONF | Test de configuration du serveur/de la plateforme |
| Gestion des identités | WSTG-IDNT | Enregistrement des utilisateurs, provisionnement des comptes |
| Authentification | WSTG-ATHN | Test de connexion, politique de mots de passe, MFA |
| Autorisation | WSTG-ATHZ | Élévation de privilèges, IDOR, contrôle d'accès |
| Gestion des sessions | WSTG-SESS | Jetons de session, cookies, fixation |
| Validation des entrées | WSTG-INPV | SQLi, XSS, injection de commandes, SSTI |
| Gestion des erreurs | WSTG-ERRH | Messages d'erreur, traces de pile |
| Cryptographie | WSTG-CRYP | TLS, chiffrement, hachage |
| Logique métier | WSTG-BUSL | Contournement de workflow, téléchargement de fichiers |
| Côté client | WSTG-CLNT | DOM XSS, clickjacking, WebSockets |
| Test des API | WSTG-APIT | REST, GraphQL, sécurité des API |
cd RAG_runner
pip install -r requirements.txt
python3 build_database.py
Cette commande va :
python3 -m server.http_server
Le serveur s'exécute sur http://localhost:5004
# Health check
curl http://localhost:5004/health
# Search for SQL injection testing
curl -X POST http://localhost:5004/search \
-H "Content-Type: application/json" \
-d '{"query": "SQL injection testing methodology"}'
# Get specific WSTG test case
curl http://localhost:5004/wstg/WSTG-INPV-05
| Point de terminaison | Méthode | Description |
|---|---|---|
/health | GET | Vérification de l'état |
/info | GET | Statistiques de la base de données |
/list | GET | Lister tous les documents |
/categories | GET | Lister les catégories et les ID WSTG |
/doc/{id} | GET | Obtenir le document par ID |
/wstg/{id} | GET | Obtenir tous les fragments pour l'ID WSTG |
/search | POST | Recherche sémantique |
{
"query": "SQL injection testing",
"n_results": 5,
"category": "input_validation",
"wstg_id": "WSTG-INPV-05"
}
Ajoutez à ~/.claude.json :
{
"mcpServers": {
"owasp-wstg-rag": {
"command": "python3",
"args": ["/path/to/OWASP_WSTG_Rag/RAG_runner/server/mcp_client.py"],
"env": {
"WSTG_RAG_URL": "http://localhost:5004"
}
}
}
}
| Outil | Description |
|---|---|
search_wstg | Rechercher des méthodologies de test dans le WSTG |
search_test_methodology | Rechercher des guides pratiques de test |
search_test_objectives | Rechercher des objectifs de test |
get_wstg_test_case | Obtenir le cas de test complet par ID WSTG |
get_wstg_document | Obtenir le document par ID |
list_wstg_categories | Lister toutes les catégories et les ID WSTG |
wstg_health | Vérification de l'état |
wstg_info | Statistiques de la base de données |
# Search for SQL injection testing methodology
search_wstg("SQL injection testing methodology")
# Get specific test case
get_wstg_test_case("WSTG-INPV-05")
# Search within a category
search_wstg("authentication bypass", category_filter="authentication")
# Get test objectives for IDOR
search_test_objectives("IDOR insecure direct object reference")
OWASP_WSTG_Rag/
├── README.md
├── CLAUDE.md # Claude Code project guide
├── raw_data/ # OWASP WSTG HTML source files
│ ├── 01-Information_Gathering/
│ ├── 02-Configuration_and_Deployment_Management_Testing/
│ ├── 03-Identity_Management_Testing/
│ ├── 04-Authentication_Testing/
│ ├── 05-Authorization_Testing/
│ ├── 06-Session_Management_Testing/
│ ├── 07-Input_Validation_Testing/
│ ├── 08-Testing_for_Error_Handling/
│ ├── 09-Testing_for_Weak_Cryptography/
│ ├── 10-Business_Logic_Testing/
│ ├── 11-Client-side_Testing/
│ └── 12-API_Testing/
└── RAG_runner/
├── build_database.py # Main build pipeline
├── requirements.txt
├── parsers/
│ └── wstg_parser.py # HTML parser for WSTG
├── chunking/
│ └── chunker.py # Semantic chunking
├── server/
│ ├── vector_store.py # ChromaDB wrapper
│ ├── http_server.py # REST API server
│ └── mcp_client.py # MCP tools for Claude Code
└── data/
├── processed/ # Intermediate JSON files
└── chroma_db/ # Vector database
┌─────────────────────────────────────────────────────────────────┐
│ OWASP WSTG HTML Files │
│ (raw_data/*.html) │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ wstg_parser.py │
│ Parse HTML → Structured JSON │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ chunker.py │
│ Create Semantic Chunks for RAG │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ ChromaDB Vector Store │
│ (data/chroma_db/) │
└────────────────────────────┬────────────────────────────────────┘
│
┌──────────────┴──────────────┐
▼ ▼
┌──────────────────────────┐ ┌──────────────────────────┐
│ http_server.py │ │ mcp_client.py │
│ REST API :5004 │ │ MCP for Claude Code │
│ │ │ │
│ GET /health │ │ search_wstg() │
│ GET /info │ │ get_wstg_test_case() │
│ GET /wstg/{id} │ │ search_test_methodology │
│ POST /search │ │ list_wstg_categories() │
└──────────────────────────┘ └──────────────────────────┘
Intégrez Claude Code pour obtenir un accès instantané aux méthodologies de test de l'OWASP lors des évaluations de sécurité :
User: "How do I test for SQL injection?"
Claude: [Queries WSTG RAG]
→ Returns WSTG-INPV-05 methodology with:
- Test objectives
- Step-by-step testing procedures
- Example payloads
- Tools to use
Utilisez l'API REST pour intégrer les méthodologies WSTG dans des pipelines de sécurité automatisés :
import requests
# Get testing methodology for current test
response = requests.post('http://localhost:5004/search', json={
'query': 'session fixation testing',
'n_results': 3
})
methodology = response.json()['results']
Référence rapide pour les méthodologies de test de sécurité lors de formations ou de défis CTF.
Ce projet utilise du contenu du Guide de test de sécurité web de l'OWASP, qui est sous licence Creative Commons Attribution - Partage dans les mêmes conditions 4.0.