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

Principle:0sec labs 0 Patch Verify

From Leeroopedia
Knowledge Sources
Domains Binary_Analysis, Patching, Verification
Last Updated 2026-10-30 00:00 GMT

Overview

Technique for proposing a fix that closes a confirmed PoV without breaking functionality, verified by re-running the PoV against the patched artifact and checking for regressions.

Description

Patch and verify is the "second half" of automated vulnerability remediation. Once a PoV is confirmed, the system proposes a fix in three layers of increasing maturity: B0 (deterministic located fix recommendation from bug-class templates — zero dependency, always-on), Mode A (LLM-generated source diff, rebuild, and verify), and B1 (binary micro-patch for x86-64 ELF). A patch is verified ONLY when the confirmed PoV no longer reproduces against the patched artifact AND no regression is observed. This mirrors PoV-is-truth's discipline: the proof of a patch is that the PoV stops reproducing, not that the diff looks correct.

Usage

Use this principle when a vulnerability pipeline needs to not only find but also fix bugs. It is optional (gated on an environment variable) and operates only on findings with confirmed PoVs.

Theoretical Basis

The verification contract is:

# Abstract algorithm (NOT real implementation)
for finding in confirmed_findings:
    patch = propose_fix(finding)  # B0 recommendation, Mode A source diff, or B1 binary patch
    patched_artifact = apply_patch(binary, patch)
    pov_still_reproduces = run_pov(patched_artifact, finding.pov)
    regression = check_regression(patched_artifact, test_suite)
    patch.verified = (not pov_still_reproduces) and (not regression)

The three layers trade off maturity and dependencies:

  • B0: Bug-class → fix-template mapping (e.g., strcpy → strncpy with bounds). Deterministic, zero-dep, always produced.
  • Mode A: LLM generates a unified diff from RCA data. Rebuild + verify. Capped at 3 iterations.
  • B1: Binary micro-patch (immediate-clamp guard) for x86-64 ELF. Self-contained when tooling is present.

Related Pages

Implemented By

Page Connections

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