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:0xSteph Pentest ai Intensity Scaled Replay

From Leeroopedia
Knowledge Sources
Domains Security_Testing, Verification, Optimization
Last Updated 2026-10-23 14:00 GMT

Overview

Replay count for idempotent oracle verification scales with scan intensity, trading verification confidence against noise budget — stealth runs replay twice, aggressive runs replay five times.

Description

The Intensity-Scaled Replay heuristic tunes the N/N replay count of the `IdempotentReplayOracle` based on the engagement's scan intensity. The oracle re-runs an exploit attempt N times and only marks the finding as verified when all N attempts succeed, which eliminates single-shot luck (false positives from timing-dependent or flaky conditions).

The intensity levels map to replay counts:

  • `stealth` → N=2 (fewer hits, lower noise)
  • `safe` → N=2 (fewer hits, lower noise)
  • `normal` → N=3 (balanced)
  • `aggressive` → N=5 (more hits, higher confidence)

This respects the operator's noise budget: a stealth engagement (e.g., on a production system) makes fewer verification requests, while an aggressive engagement (e.g., in a staging environment) makes more for higher confidence.

Usage

Apply this heuristic when:

  • Tuning verification strictness — increase replay count for higher confidence by using `aggressive` intensity; decrease for stealth by using `stealth` or `safe`.
  • Building custom oracles — use `IdempotentReplayOracle.for_intensity(attempt, intensity)` to auto-select the correct N.
  • Debugging false positives — if a finding flips between candidate and verified on repeated runs, the replay count may be too low for the target's variability.

The Insight (Rule of Thumb)

  • Action: Set the idempotent replay count N based on scan intensity, not a fixed value.
  • Value: `REPLAY_N_BY_INTENSITY = {"stealth": 2, "safe": 2, "normal": 3, "aggressive": 5}`. Default fallback is N=3.
  • Trade-off: Higher N increases confidence (fewer false positives from single-shot luck) but increases noise (more requests to the target) and time. Lower N is stealthier but may miss verification of genuinely flaky conditions.
  • Compatibility: Works with any oracle that uses `IdempotentReplayOracle` as its base, including differential privilege oracles that reuse the replay loop via `diff_builder`.

Reasoning

A single successful exploit attempt could be luck — a race condition that happened to win, a timing-dependent response that happened to align, or a cache that happened to miss. N/N replay eliminates this: if the exploit is real, it should succeed every time (idempotent).

The intensity scaling recognizes that stealth and aggressive engagements have different priorities. A stealth engagement on a production system must minimize traffic; N=2 is the minimum that still eliminates single-shot luck. An aggressive engagement in a controlled environment can afford N=5 for maximum confidence.

The `for_intensity` factory method (`IdempotentReplayOracle.for_intensity`) makes this transparent: callers pass the engagement's intensity string and get the correct N automatically, avoiding the need to hardcode replay counts at each call site.

Code Evidence

Replay count mapping from `engine/verifier.py:54-59`:

REPLAY_N_BY_INTENSITY: dict[str, int] = {
    "stealth": 2,
    "safe": 2,
    "normal": 3,
    "aggressive": 5,
}

Factory method from `engine/verifier.py:86-98`:

@classmethod
def for_intensity(
    cls,
    attempt: Callable[[], Awaitable[bool]],
    intensity: str = "normal",
    kind: OracleKind = OracleKind.idempotent_replay,
    diff_builder: Callable[[bool, int, int], str] | None = None,
) -> IdempotentReplayOracle:
    return cls(
        attempt,
        REPLAY_N_BY_INTENSITY.get(intensity, 3),
        kind=kind,
        diff_builder=diff_builder,
    )

N/N verification logic from `engine/verifier.py:100-112`:

async def verify(self) -> OracleResult:
    successes = 0
    for _ in range(self._n):
        if await self._attempt():
            successes += 1
    passed = successes == self._n

Rate limiter intensity profiles from `engine/rate_limiter.py:18-48`:

profiles = {
    "stealth": cls(requests_per_second=2.0, max_concurrent_tools=1, ...),
    "normal": cls(requests_per_second=10.0, max_concurrent_tools=3, ...),
    "aggressive": cls(requests_per_second=0.0, max_concurrent_tools=10, ...),
}

Related Pages

Page Connections

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