Implementation:0sec labs 0 detect variants
| Knowledge Sources | |
|---|---|
| Domains | Binary_Analysis, Variant_Analysis, Bug_Detection |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete tool for applying a seed matcher to a fleet member and ranking candidate variant sites, provided by the 0verse fleet module.
Description
The detect_variants function applies the seed's matcher (bugclass lens or seedbug matcher) to a fleet member's decompiled functions (or raw bytes when no decompiler is available via a symbol pass). It returns ranked VariantCandidate objects, highest reference-similarity first. Candidates are deduplicated per (function, sink), keeping the strongest match. The detector field records the origin (lens:*, seed:*, symbol-pass).
Usage
Import this function when you need to find candidate variant sites of a known bug class in a fleet binary. It is Step 3 of the fleet variant analysis workflow.
Code Reference
Source Location
- Repository: 0security
- File: 0verse/src/zeroverse/fleet.py:L485-527
Signature
def detect_variants(
seed: FleetSeed,
member: FleetMember,
) -> list[VariantCandidate]:
"""Apply the seed's matcher to a fleet member; return ranked candidates."""
@dataclass(frozen=True)
class VariantCandidate:
member: str # binary path
function: str # function containing the candidate
sink: str # sink symbol
source: str # source symbol
similarity: float # to the reference shape (1.0 when no reference)
route: str # userland | firmware | kernel-verify
detector: str # "lens:<class>" | "seed:<id>" | "symbol-pass"
decompiled_c: str = ""
Import
from zeroverse.fleet import detect_variants, VariantCandidate
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| seed | FleetSeed | Yes /// The matcher (bugclass lens or seedbug matcher) | |
| member | FleetMember | Yes /// Decompiled functions or raw bytes |
Outputs
| Name | Type | Description |
|---|---|---|
| return | list[VariantCandidate] | Ranked candidates (highest similarity first), deduped per (function, sink) |
Usage Examples
Detect variants in a fleet
from zeroverse.fleet import seed_from_archetype, ingest_fleet, detect_variants
seed = seed_from_archetype("cmdi")
members = ingest_fleet("/fleet/binaries/")
for m in members:
candidates = detect_variants(seed, m)
for c in candidates:
print(f"{m.name}:{c.function} → {c.sink} (sim={c.similarity:.2f}, by={c.detector})")
Symbol pass for stripped firmware
from zeroverse.fleet import seed_from_archetype, ingest_fleet, detect_variants
seed = seed_from_archetype("firmware:cgi-cmdi")
# No decompiler available → ingest_fleet returns empty decompiled dicts
members = ingest_fleet("/firmware/", decompile=False)
for m in members:
candidates = detect_variants(seed, m) # falls back to _symbol_pass
print(f"{m.name}: {len(candidates)} candidates (symbol pass)")