llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · libp2p

GHSA-HRFR-7729-443M

QUIC transport: libp2p-TLS proof-of-possession not enforced (peer-identity authentication bypass)

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
9.1
Crítica
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición4 dDesde la divulgación, 15 nov 2026, 11:46 a. m.
Detección3 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Monitoreo
Detectada +1
15 nov 26
16 nov 26
19 nov 26
20 nov 26
15 nov 26
16 nov 26
18 nov 26
19 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-HRFR-7729-443M divulgada · CVSS 9.1 (GitHub)
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

Affected: PyPI `libp2p` >= 0.3.0, <= 0.8.1: every release since the QUIC transport first shipped in 0.3.0, including the latest. QUIC transport only; TLS-over-TCP, secio and Noise are NOT affected.
Patched: not yet released. The fix is in the private advisory fork, PR #1 (https://github.com/libp2p/py-libp2p-ghsa-hrfr-7729-443m/pull/1).
Severity: Critical, CVSS:3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N (9.1). CWE-347, CWE-295, CWE-252.
Vulnerable function: `PeerAuthenticator.verify_peer_certificate` (`libp2p/transport/quic/security.py`).

### Summary
The QUIC transport's libp2p-TLS peer verification never actually checks the proof-of-possession (PoP) signature in a remote peer's certificate. The signature is "verified" with a call whose return value is discarded, so an invalid signature passes. An attacker can present a TLS certificate that embeds any victim's libp2p public key without owning the victim's private key, and py-libp2p will accept the connection as that victim.

TLS-over-TCP, secio, and Noise are not affected — they perform the equivalent check correctly. QUIC is the only affected transport. QUIC is opt-in (`new_host(enable_quic=True)` / an explicit `quic-v1` listen address).

First verified at py-libp2p main @ `79985430` (package 0.7.0), Python 3.13.15, aioquic 1.3.0. Re-confirmed 2026-11-15 on main @ `55965649` (0.8.1); the vulnerable `try/except` is still present. The same code is in every tagged release from v0.3.0 to v0.8.1.

### Root cause
`PeerAuthenticator.verify_peer_certificate` in `libp2p/transport/quic/security.py` builds the PoP payload and calls `public_key.verify(...)` inside a `try/except`, expecting a bad signature to raise:

signature_payload = b"libp2p-tls-handshake:" + cert_public_key_bytes
try:
    public_key.verify(signature_payload, signature)
except Exception as e:
    raise QUICPeerVerificationError(f"Invalid signature in libp2p extension: {e}")

But `public_key` is a libp2p `PublicKey`, whose `verify()` returns a bool and does not raise on an invalid signature (`libp2p/crypto/keys.py:59` abstract `-> bool`; `libp2p/crypto/ed25519.py:46-51` catches `BadSignatureError` and returns `False`; secp256k1/rsa/ecdsa equivalently). On a bad signature `verify()` returns `False`, the `try` completes without raising, the return value is discarded, and verification falls through to success. The PoP check is a no-op.

### Impact
Peer identity on QUIC is derived from the public key in the certificate's libp2p extension (`ID.from_pubkey(public_key)`), gated on the PoP. With the PoP disabled:

  1. Impersonation to a listener (no network interception needed). Inbound QUIC connections have expected peer ID `None` (`libp2p/transport/quic/listener.py:1094` -> `connection.py:681` `verify_peer_identity(cert, None)`), so py accepts whatever identity the certificate claims. An attacker dials a py-libp2p QUIC listener with a cert embedding any target's public key and a bogus PoP; the listener believes the peer is that target. Defeats authorization/connection-gating keyed on peer ID.
  2. MITM of an authenticated dial (on-path / address control). When py dials `V` it sets `expected_peer_id = V` and checks `derived == expected`. The attacker embeds `V`'s public key so the check passes, while the channel is secured with the attacker's own certificate key. An attacker who receives the dial (DHT/peer-record poisoning, DNS, on-path, malicious relay/rendezvous) terminates the "authenticated" connection as `V` and reads/writes all traffic.

In both cases the attacker never possesses the victim's libp2p private key.

### Proof of concept
A self-contained script runs the real production verifier (`QUICTLSConfigManager.verify_peer_identity`, no mocks) with a forged certificate embedding the victim's public key but a PoP signed by an unrelated throwaway key; the vulnerable build accepts it as the victim. Available privately on request along with a patch branch.

### Patch
Check the boolean return, matching the already-correct TLS-over-TCP code (`libp2p/security/tls/certificate.py:356`):

if not public_key.verify(signature_payload, signature):
    raise QUICPeerVerificationError(
        "Invalid signature in libp2p extension: "
        "proof-of-possession does not match the embedded public key"
    )

Fix and regression test are in the private fork: https://github.com/libp2p/py-libp2p-ghsa-hrfr-7729-443m/pull/1 (branch `advisory-fix-1`, commit `cc56123a`). `tests/core/transport/quic/test_quic_inbound_auth.py::test_verify_rejects_forged_proof_of_possession` fails without the fix and passes with it. `tests/core/transport/quic` and `tests/core/security`: 326 passed, 2 skipped. ruff, mypy and pyrefly are clean. Earlier, valid go-libp2p -> py `/quic-v1` interop also still succeeded with the fix.

### Workaround
Until patched, do not enable the QUIC transport (`enable_quic=False` / omit `quic-v1` listen addresses); use TLS-over-TCP or Noise.

### References
- libp2p TLS spec (PoP over `"libp2p-tls-handshake:" || certPubKey`): https://github.com/libp2p/specs/blob/master/tls/tls.md
- Correct in-repo reference: `libp2p/security/tls/certificate.py:356`
- CWE-347, CWE-295, CWE-252

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

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
libp2p≥ 0.3.0 ≤ 0.8.1
0.3.0
0.8.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypilibp2p
Sin parche — — 0.8.1 afectada
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/libp2p/py-libp2p/security/advisories/GHSA-hrfr-7729-443m

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