Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0x4m4 Hexstrike ai VulnerabilityCorrelator

From Leeroopedia
Knowledge Sources
Domains Attack_Chain_Discovery, Vulnerability_Management, Security
Last Updated 2026-10-10 00:00 GMT

Overview

Vulnerability correlation engine that discovers multi-stage attack chains by matching vulnerabilities to attack patterns (initial access, privilege escalation, persistence) and computing overall success probability.

Description

The VulnerabilityCorrelator class finds multi-vulnerability attack chains for a target software. Its find_attack_chains method searches for vulnerabilities matching attack patterns (remote_execution, privilege_escalation, persistence, lateral_movement, data_exfiltration) and constructs chains with stages, success probabilities, and complexity ratings. Each chain's overall probability is the product of its stage probabilities. The method returns chains with recommendations for testing order.

Usage

  • Attack chain discovery: Call find_attack_chains(target_software, max_depth) to find multi-stage chains
  • Pattern matching: _find_vulnerabilities_by_pattern matches vulnerabilities to attack pattern types
  • Flask endpoint: Available at /api/vuln-intel/attack-chains

Code Reference

Source Location

  • Repository: HexStrike AI
  • File: hexstrike_server.py
  • Lines: L8510-8629 (VulnerabilityCorrelator class)

Signature

class VulnerabilityCorrelator:
    def __init__(self):
        self.attack_patterns: Dict[str, List[str]]  # pattern_type → keywords
        self.software_relationships: Dict[str, List[str]]  # platform → related software

    def find_attack_chains(self, target_software: str, max_depth: int = 3) -> Dict[str, Any]:
        """Find multi-vulnerability attack chains."""

    def _find_vulnerabilities_by_pattern(self, software: str, pattern_type: str) -> List[Dict[str, Any]]:
        """Find vulnerabilities matching attack pattern."""

    def _generate_chain_recommendations(self, chains: List[Dict[str, Any]]) -> str:
        """Generate recommendations for attack chains."""

Import

from hexstrike_server import VulnerabilityCorrelator

I/O Contract

Inputs

Name Type Required Description
target_software str Yes Software name to find chains for
max_depth int No Maximum chain depth (default 3)

Outputs

Name Type Description
total_chains int Number of attack chains found
attack_chains List[Dict] Each chain has chain_id, stages, overall_probability, complexity
recommendation str Human-readable recommendation text

Usage Examples

Finding Attack Chains

from hexstrike_server import VulnerabilityCorrelator

correlator = VulnerabilityCorrelator()

result = correlator.find_attack_chains("Apache HTTP Server", max_depth=3)
print(f"Found {result['total_chains']} attack chains")

for chain in result["attack_chains"]:
    print(f"\nChain {chain['chain_id']}: {chain['complexity']}")
    print(f"  Overall probability: {chain['overall_probability']:.2%}")
    for stage in chain["stages"]:
        print(f"  Stage {stage['stage']}: {stage['objective']} - {stage['vulnerability']['cve_id']}")

print(f"\nRecommendation: {result['recommendation']}")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment