CVE-2021-21239
JSON

6.5medium

Open default xmlsec1 key-type preference

Severity
6.5medium CVSS:3.1 by GitHub_M
Exploit likelihood
1.29% (higher than 71% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-5p3x-r448-pc62PYSEC-2021-49

Description

PySAML2 is a pure python implementation of SAML Version 2 Standard. PySAML2 before 6.5.0 has an improper verification of cryptographic signature vulnerability. Users of pysaml2 that use the default CryptoBackendXmlSec1 backend and need to verify signed SAML documents are impacted. PySAML2 does not ensure that a signed SAML document is correctly signed. The default CryptoBackendXmlSec1 backend is using the xmlsec1 binary to verify the signature of signed SAML documents, but by default xmlsec1 accepts any type of key found within the given document. xmlsec1 needs to be configured explicitly to only use only _x509 certificates_ for the verification process of the SAML document signature. This is fixed in PySAML2 6.5.0.

Affected

Product or packageVersionsReported by
IdentityPython pysaml2< 6.5.0CVE List
pysaml2 (PyPI)before 6.5.0, before 46578df0695269a16f1c94171f1429873f90ed99GitHub Advisory Database, PyPA Advisory Database
pysaml2_project pysaml2before 6.5.0NVD
debian debian_linux9.0NVD

All scores

GitHub_M6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
GitHub6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
NVD4.3medium CVSS:2.0AV:N/AC:M/Au:N/C:N/I:P/A:N

Classification

What each source says

CVE List

PySAML2 is a pure python implementation of SAML Version 2 Standard. PySAML2 before 6.5.0 has an improper verification of cryptographic signature vulnerability. Users of pysaml2 that use the default CryptoBackendXmlSec1 backend and need to verify signed SAML documents are impacted. PySAML2 does not ensure that a signed SAML document is correctly signed. The default CryptoBackendXmlSec1 backend is using the xmlsec1 binary to verify the signature of signed SAML documents, but by default xmlsec1 accepts any type of key found within the given document. xmlsec1 needs to be configured explicitly to only use only _x509 certificates_ for the verification process of the SAML document signature. This is fixed in PySAML2 6.5.0.

GitHub Advisory Database
Impact

All users of pysaml2 that use the default CryptoBackendXmlSec1 backend and need to verify signed SAML documents are impacted. pysaml2 <= 6.4.1 does not ensure that a signed SAML document is correctly signed. The default CryptoBackendXmlSec1 backend is using the xmlsec1 binary to verify the signature of signed SAML documents, but by default, xmlsec1 accepts any type of key found within the given document. xmlsec1 needs to be configured explicitly to only use only x509 certificates for the verification process of the SAML document signature.

Patches

Users should upgrade to pysaml2 v6.5.0.

Workarounds

No workaround provided at this point.

References

This issue has been reported in the past at the xmlsec1 mailing list: https://www.aleksey.com/pipermail/xmlsec/2013/009717.html

Credits
  • Brian Wolff
For more information

If you have any questions or comments about this advisory:

NVD (es)

PySAML2 es una implementación de Python pura de SAML Versión 2 Estándar. PySAML2 versiones anteriores a 6.5.0, presenta una verificación inapropiada de una vulnerabilidad de firma criptográfica. Los usuarios de pysaml2 que utilizan el backend CryptoBackendXmlSec1 predeterminado y necesitan verificar los documentos SAML firmados están afectados. PySAML2 no garantiza que un documento SAML firmado esté correctamente firmado. El backend CryptoBackendXmlSec1 predeterminado está usando el binario xmlsec1 para verificar la firma de los documentos SAML firmados, pero por defecto xmlsec1 acepta cualquier tipo de clave que se encuentre dentro del documento dado. xmlsec1 debe configurarse explícitamente para usar solo _x509 certificates_ para el proceso de verificación de la firma del documento SAML. Esto es corregido en PySAML2 versión 6.5.0

References

https://github.com/IdentityPython/pysaml2/security/advisories/GHSA-5p3x-r448-pc62advisory, third-party-advisory, web
https://pypi.org/project/pysaml2package, product, third-party-advisory, web
https://www.aleksey.com/pipermail/xmlsec/2013/009717.htmlexploit, mailing-list, third-party-advisory, web
https://github.com/IdentityPython/pysaml2/releases/tag/v6.5.0third-party-advisory, web
https://github.com/IdentityPython/pysaml2/commit/46578df0695269a16f1c94171f1429873f90ed99fix, patch, third-party-advisory, web
https://lists.debian.org/debian-lts-announce/2021/02/msg00038.htmlmailing-list, third-party-advisory, web
https://nvd.nist.gov/vuln/detail/CVE-2021-21239advisory
https://github.com/IdentityPython/pysaml2package
https://github.com/pypa/advisory-database/tree/main/vulns/pysaml2/PYSEC-2021-49.yamlweb

Sources

SourceRecordLicence
CVE ListCVE-2021-21239 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-5p3x-r448-pc62 changed 2026-09-10CC-BY-4.0
NVDCVE-2021-21239 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2021-49 changed 2023-11-08CC-BY-4.0