Skip to content

cilock verify: bound the pre-auth inclusion-proof bridge loop (P×C quadratic DoS) #279

Description

@colek42

Found by the red-team over testifysec/judge#5559 (pre-existing — byte-identical to main, comment-only diff).

cilock/cli/inclusion_bridge.go expandSubjectsWithInclusionProofs runs at verify.go:438 on RAW loaded envelopes before any DSSE/functionary signature check. The loop at ~214-238 is ~P×C p.Verify calls when all proofs share one root and all fail (the added[p.TreeRoot] short-circuit and the break are never reached); each iteration re-decodes the audit path. One 512 MiB bundle of ~1 KB envelopes split into ~250K inclusion-proof envelopes + matching commitments → ~6e10 verify calls → hours-to-days hang. The always-inline change makes the sibling per-commitment BuildSidecar loop unconditionally reachable, compounding it.

Fix: cap the number of proofs+commitments processed (or dedup commitments by root and proofs by (FileDigest,TreeRoot)) before the nested loop; break the inner loop after the first matching-root commitment regardless of Verify outcome; decode each audit path once per proof. Bound the whole pre-auth pass.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions