Overview
Template-based exploit generator that classifies vulnerability types from CVE data and produces Python exploit code with evasion techniques for 8+ vulnerability categories.
Description
The AIExploitGenerator class generates exploit code from CVE data. Its generate_exploit_from_cve method classifies the vulnerability type from the CVE description, then selects a template for sql_injection, xss, web_rce, xxe, deserialization, file_read, authentication_bypass, or buffer_overflow. Templates include x86/x64 buffer overflow, web RCE, and deserialization patterns. Evasion techniques (encoding, obfuscation, AV evasion, WAF bypass) can be applied based on the evasion_level parameter.
Usage
- Exploit generation: Call generate_exploit_from_cve(cve_data, target_info) to produce exploit code
- Evasion: Set target_info["evasion_level"] to "none"/"basic"/"advanced" for evasion techniques
- Flask endpoint: Available at /api/vuln-intel/exploit-generate
Code Reference
Source Location
- Repository: HexStrike AI
- File: hexstrike_server.py
- Lines: L7027-7213 (AIExploitGenerator class)
Signature
class AIExploitGenerator:
def __init__(self):
self.exploit_templates: Dict[str, Any] # buffer_overflow, web_rce, deserialization, etc.
self.evasion_techniques: Dict[str, List[str]] # encoding, obfuscation, av_evasion, waf_bypass
def generate_exploit_from_cve(
self,
cve_data: Dict[str, Any],
target_info: Dict[str, Any]
) -> Dict[str, Any]:
"""Generate working exploit from real CVE data with specific implementation."""
def _classify_vulnerability(self, description: str) -> str:
"""Classify vulnerability type from description."""
Import
from hexstrike_server import AIExploitGenerator
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| cve_data |
Dict[str, Any] |
Yes |
Contains cve_id, description, exploitability_level
|
| target_info |
Dict[str, Any] |
Yes |
Contains target_os, target_arch, exploit_type, evasion_level, target_ip, target_port
|
Outputs
| Name |
Type |
Description
|
| success |
bool |
Whether generation succeeded
|
| cve_id |
str |
CVE identifier
|
| vulnerability_type |
str |
Classified vuln type (sql_injection, xss, web_rce, etc.)
|
| exploit_code |
str |
Python exploit code string
|
| instructions |
str |
Usage instructions for the exploit
|
| evasion_applied |
str |
Evasion level applied
|
| implementation_type |
str |
"real_cve_based"
|
Usage Examples
Generating an Exploit from CVE Data
from hexstrike_server import AIExploitGenerator
generator = AIExploitGenerator()
cve_data = {
"cve_id": "CVE-2024-1234",
"description": "Remote code execution vulnerability in the web application's API endpoint",
"exploitability_level": "HIGH"
}
target_info = {
"target_os": "linux",
"target_arch": "x64",
"exploit_type": "poc",
"evasion_level": "basic",
"target_ip": "192.168.1.100",
"target_port": 8080
}
result = generator.generate_exploit_from_cve(cve_data, target_info)
print(f"Vulnerability type: {result['vulnerability_type']}")
print(f"Evasion: {result['evasion_applied']}")
print(result["exploit_code"])
Related Pages
Implements Principle
Requires Environment