CVE-2025-66578
JSON

6.0medium

robrichards/xmlseclibs has an Libxml2 Canonicalization error which can bypass Digest/Signature validation

Severity
6.0medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.26% (higher than 18% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-c4cc-x928-vjw9

Description

xmlseclibs is a library written in PHP for working with XML Encryption and Signatures. Versions 3.1.3 contain an authentication bypass vulnerability due to a flaw in the libxml2 canonicalization process during document transformation. When libxml2’s canonicalization is invoked on an invalid XML input, it may return an empty string rather than a canonicalized node. xmlseclibs then proceeds to compute the DigestValue over this empty string, treating it as if canonicalization succeeded. This issue is fixed in version 3.1.4. Workarounds include treating canonicalization failures (exceptions or nil/empty outputs) as fatal and aborting validation, and/or adding explicit checks to reject when canonicalize returns nil/empty or raises errors.

Affected

Product or packageVersionsReported by
robrichards xmlseclibs< 3.1.4CVE List
robrichards/xmlseclibs (Packagist)before 3.1.4GitHub Advisory Database
xmlseclibs_project xmlseclibsbefore 3.1.4NVD

All scores

GitHub_M6.0medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:L/A:L
GitHub6.0medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:L/A:L
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Classification

CWE-248

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

xmlseclibs is a library written in PHP for working with XML Encryption and Signatures. Versions 3.1.3 contain an authentication bypass vulnerability due to a flaw in the libxml2 canonicalization process during document transformation. When libxml2’s canonicalization is invoked on an invalid XML input, it may return an empty string rather than a canonicalized node. xmlseclibs then proceeds to compute the DigestValue over this empty string, treating it as if canonicalization succeeded. This issue is fixed in version 3.1.4. Workarounds include treating canonicalization failures (exceptions or nil/empty outputs) as fatal and aborting validation, and/or adding explicit checks to reject when canonicalize returns nil/empty or raises errors.

GitHub Advisory Database
Summary

An authentication bypass vulnerability exists due to a flaw in the libxml2 canonicalization process, which is used by xmlseclibs during document transformation. This weakness allows an attacker to generate a valid signature once and reuse it indefinitely. In practice, a signature created during a previous interaction - or through a misconfigured authentication flow - can be replayed to bypass authentication checks.

Details

When libxml2’s canonicalization is invoked on an invalid XML input, it may return an empty string rather than a canonicalized node. xmlseclibs then proceeds to compute the DigestValue over this empty string, treating it as if canonicalization succeeded.

https://github.com/robrichards/xmlseclibs/blob/f4131320c6dcd460f1b0c67f16f8bf24ce4b5c3e/src/XMLSecurityDSig.php#L296

Impact

Digest bypass: By crafting input that causes canonicalization to yield an empty string, the attacker can manipulate validation to pass incorrectly.

Signature replay on empty canonical form: If an empty string has been signed once (e.g., in a prior interaction or via a misconfigured flow), that signature can potentially be replayed to bypass authentication.

Suggested remediation

Treat canonicalization failures (exceptions or nil/empty outputs) as fatal and abort validation. Add explicit checks: reject when canonicalize returns nil/empty or raise

NVD (es)

xmlseclibs es una biblioteca escrita en PHP para trabajar con Cifrado y Firmas XML. Las versiones 3.1.3 contienen una vulnerabilidad de omisión de autenticación debido a un fallo en el proceso de canonicalización de libxml2 durante la transformación de documentos. Cuando la canonicalización de libxml2 es invocada en una entrada XML inválida, puede devolver una cadena vacía en lugar de un nodo canonicalizado. xmlseclibs entonces procede a calcular el DigestValue sobre esta cadena vacía, tratándola como si la canonicalización hubiera tenido éxito. Este problema está solucionado en la versión 3.1.4. Las soluciones provisionales incluyen tratar los fallos de canonicalización (excepciones o salidas nulas/vacías) como fatales y abortar la validación, y/o añadir comprobaciones explícitas para rechazar cuando canonicalize devuelve nulo/vacío o genera errores.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-66578 changed 2025-12-09CVE Terms of Use
GitHub Advisory DatabaseGHSA-c4cc-x928-vjw9 changed 2025-12-09CC-BY-4.0
NVDCVE-2025-66578 changed 2026-10-07Public domain