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:0sec labs 0 Static Hypothesis Scan

From Leeroopedia
Knowledge Sources
Domains Binary_Analysis, Static_Analysis, Taint_Analysis
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete tool for static source→sink data-flow hypothesis generation provided by the 0verse analyze module.

Description

The scan function performs backward taint slicing from sink instructions (e.g. system, strcpy) to source instructions (e.g. getenv, read) over a decompiled instruction list, producing Finding hypotheses tagged by origin (slice, foxguard, bugclass:*, seed:*). foxguard_union merges an external static pre-pass's hypotheses into the queue. prime_bugclasses runs five bug-class lenses (cmdi, overflow, intoverflow, fmtstring, uaf) over decompiled C to produce tagged hypotheses with inter-procedural taint support.

Usage

Import these functions when you need to generate static vulnerability hypotheses from decompiled code. They are called internally by the 0verse pipeline after decompilation and before the LLM triage funnel.

Code Reference

Source Location

  • Repository: 0security
  • File: 0verse/src/zeroverse/analyze.py:L90-140 (scan), analyze.py:L274-305 (foxguard_union), 0verse/src/zeroverse/bugclasses.py:L1275-1294 (prime_bugclasses)

Signature

def scan(
    adapter: ILAdapter,
    model: TaintModel,
    insts: list[Inst],
) -> list[Finding]:
    """Backward-slice from sinks to sources; return source→sink findings."""

def foxguard_union(
    findings: list[Finding],
    decompiled_c: dict[str, str],
    *,
    max_hyps: int = 20,
) -> tuple[list[Finding], str]:
    """Run foxguard static pre-pass; union hypotheses into the queue."""

def prime_bugclasses(
    decompiled_c: dict[str, str],
    *,
    max_per_class: int = 16,
    callgraph: dict[str, list[str]] | None = None,
) -> list[Finding]:
    """Run five bug-class lenses over decompiled C; return tagged hypotheses."""

@dataclass
class Finding:
    source: str          # e.g. "getenv"
    sink: str            # e.g. "system"
    function: str        # containing function name
    source_addr: int
    sink_addr: int
    path_len: int
    origin: str = ""     # slice | foxguard | bugclass:* | seed:*

Import

from zeroverse.analyze import scan, foxguard_union, Finding
from zeroverse.bugclasses import prime_bugclasses

I/O Contract

Inputs

Name Type Required Description
adapter ILAdapter Yes Decompiled program adapter (for backward slicing)
model TaintModel Yes Taint model mapping symbols to source/sink roles
insts list[Inst] Yes Instruction list from decompilation
decompiled_c dict[str,str] For foxguard/prime Function→C code map
callgraph dict[str,list[str]] No Caller→callees for inter-procedural taint

Outputs

Name Type Description
return list[Finding] Source→sink data-flow paths as hypotheses

Usage Examples

Via the pipeline (automatic)

from zeroverse.api import scan as api_scan

# scan() runs decompilation → scan() → foxguard_union → prime_bugclasses internally
result = api_scan("./target")
for f in result.findings:
    print(f"{f.bug_class}: {f.function} → {f.sink} (origin: {f.hypothesis})")

Direct hypothesis generation

from zeroverse.analyze import scan, foxguard_union
from zeroverse.bugclasses import prime_bugclasses

# After decompilation produces adapter + insts:
findings = scan(adapter, taint_model, insts)
findings, note = foxguard_union(findings, decompiled_c)
bugclass_findings = prime_bugclasses(decompiled_c, callgraph=callgraph)
all_findings = findings + bugclass_findings

Related Pages

Implements Principle

Requires Environment

Page Connections

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