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

Heuristic:0x4m4 Hexstrike ai CTF Complexity Analysis

From Leeroopedia
Knowledge Sources
Domains CTF, Optimization, Estimation
Last Updated 2026-10-10 00:00 GMT

Overview

Heuristic for estimating CTF challenge complexity from description text using length, technical term density, and multi-step indicators to adjust time estimates.

Description

The CTFWorkflowManager analyzes challenge descriptions to compute a complexity multiplier (0.0-1.0) that adjusts the base time estimate. The scoring considers three factors: description length (>500 chars = +0.3, >200 chars = +0.1), technical term density (22 security terms checked, +0.05 per term, capped at +0.4), and multi-step indicators (6 sequential keywords like "first", "then", "next", capped at +0.3). The final complexity multiplier is 1.0 + (complexity_score * 0.3), meaning a maximum complexity description increases the time estimate by 30%.

Usage

Use this heuristic when estimating time for CTF challenges. Applied by CTFWorkflowManager.create_ctf_challenge_workflow to adjust the base time (difficulty x category multiplier) based on description complexity.

The Insight (Rule of Thumb)

  • Action: Calculate complexity_score from the challenge description, then apply complexity_mult = 1.0 + (complexity_score * 0.3)
  • Values:
    • Length: >500 chars = +0.3, >200 chars = +0.1
    • Technical terms: +0.05 per term (capped at +0.4), from a list of 22 terms
    • Multi-step indicators: +0.1 per indicator (capped at +0.3), from 6 keywords
  • Trade-off: Longer, more technical descriptions with sequential steps get higher time estimates; simple descriptions get the base time.
  • Final score: capped at 1.0 (min(complexity_score, 1.0))

Reasoning

Longer descriptions typically mean more requirements and constraints to analyze. Technical terms indicate advanced concepts that require specialized tools and expertise. Multi-step indicators ("first", "then", "next", "after", "finally", "step") suggest the challenge involves a sequential workflow, which takes longer to solve. The 0.3 multiplier on the final score ensures that even maximum complexity (1.0) only adds 30% to the time estimate, preventing overestimation. The category multiplier (pwn=1.5, rev=1.4, crypto=1.3) handles the inherent difficulty of different CTF categories, while the complexity score handles challenge-specific variation.

Code Evidence

Complexity analysis from `hexstrike_server.py:3186-3214`:

def _analyze_description_complexity(self, description: str) -> float:
    complexity_score = 0.0
    description_lower = description.lower()

    # Length-based complexity
    if len(description) > 500:
        complexity_score += 0.3
    elif len(description) > 200:
        complexity_score += 0.1

    # Technical term density
    technical_terms = [
        "algorithm", "encryption", "decryption", "vulnerability", "exploit",
        "buffer overflow", "sql injection", "xss", "csrf", "authentication",
        "authorization", "cryptography", "steganography", "forensics",
        "reverse engineering", "binary analysis", "memory corruption",
        "heap", "stack", "rop", "shellcode", "payload"
    ]

    term_count = sum(1 for term in technical_terms if term in description_lower)
    complexity_score += min(0.4, term_count * 0.05)

    # Multi-step indicators
    multi_step_indicators = ["first", "then", "next", "after", "finally", "step"]
    step_count = sum(1 for indicator in multi_step_indicators if indicator in description_lower)
    complexity_score += min(0.3, step_count * 0.1)

    return min(1.0, complexity_score)

Complexity multiplier application from `hexstrike_server.py:2949-2952`:

description_complexity = self._analyze_description_complexity(challenge.description)
complexity_mult = 1.0 + (description_complexity * 0.3)
workflow["estimated_time"] = int(base_time * category_mult * complexity_mult * 60)

Related Pages

Page Connections

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