{"id":"CVE-2021-21238","aliases":["CVE-2021-21238","GHSA-f4g9-h89h-jgv9","PYSEC-2021-48"],"related":[],"kind":"vulnerability","state":"published","title":"SAML XML Signature wrapping","summary":"PySAML2 is a pure python implementation of SAML Version 2 Standard. PySAML2 before 6.5.0 has an improper verification of cryptographic signature vulnerability. All users of pysaml2 that need to validate signed SAML documents are impacted. The vulnerability is a variant of XML Signature wrapping because it did not validate the SAML document against an XML schema. This allowed invalid XML documents to be processed and such a document can trick pysaml2 with a wrapped signature. This is fixed in PySAML2 6.5.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"PySAML2 is a pure python implementation of SAML Version 2 Standard. PySAML2 before 6.5.0 has an improper verification of cryptographic signature vulnerability. All users of pysaml2 that need to validate signed SAML documents are impacted. The vulnerability is a variant of XML Signature wrapping because it did not validate the SAML document against an XML schema. This allowed invalid XML documents to be processed and such a document can trick pysaml2 with a wrapped signature. This is fixed in PySAML2 6.5.0.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nAll users of pysaml2 that use the default `CryptoBackendXmlSec1` backend and need to verify signed SAML documents are impacted. `pysaml2 <= 6.4.1` does not validate the SAML document against an XML schema. This allows invalid XML documents to trick the verification process, by presenting elements with a valid signature inside elements whose content has been malformed. The verification is offloaded to `xmlsec1` and `xmlsec1` will not validate every signature in the given document, but only the first it finds in the given scope.\n\n### Patches\n\nUsers should upgrade to pysaml2 `v6.5.0`.\n\n### Workarounds\n\nNo workaround provided at this point.\n\n### References\n\nNo references provided at this point.\n\n### Credits\n\n- Victor Schönfelder Garcia (isits AG International School of IT Security)\n- Juraj Somorovsky (Paderborn University)\n- Vladislav Mladenov (Ruhr University Bochum)\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [pysaml2](https://github.com/IdentityPython/pysaml2)\n* Email us at [the incident-response address](mailto:incident-response@idpy.org)","format":"markdown","source":"ghsa"},{"lang":"es","text":"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. Todos los usuarios de pysaml2 que necesitan comprobar documentos SAML firmados están afectados. La vulnerabilidad es una variante del empaquetado de firma XML porque no validó el documento SAML con un esquema XML. Esto permitió que documentos XML sean procesados no válidos y dicho documento puede engañar a pysaml2 con una firma empaquetada. Esto es corregido en PySAML2 versión 6.5.0","source":"nvd"}],"published":"2021-01-21T14:12:16.000Z","modified":"2026-09-10T03:49:13.856Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:N/C:N/I:P/A:N","score":4.3,"rating":"MEDIUM"}],"cwes":["CWE-347"],"affected":[{"ranges":[{"version":"< 6.5.0","status":"affected"}],"vendor":"IdentityPython","product":"pysaml2","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"6.5.0"}],"ecosystem":"PyPI","package":"pysaml2","purl":"pkg:pypi/pysaml2","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"6.5.0"}],"vendor":"pysaml2_project","product":"pysaml2","cpe":"cpe:2.3:a:pysaml2_project:pysaml2:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"1d8fd268f5bf887480a403a7a5ef8f048157cc14"},{"type":"ecosystem","introduced":"0","status":"affected","fixed":"6.5.0"}],"ecosystem":"PyPI","package":"pysaml2","purl":"pkg:pypi/pysaml2","repo":"https://github.com/IdentityPython/pysaml2","source":"pysec"}],"references":[{"url":"https://pypi.org/project/pysaml2","tags":["package","product","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/IdentityPython/pysaml2/releases/tag/v6.5.0","tags":["third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/IdentityPython/pysaml2/security/advisories/GHSA-f4g9-h89h-jgv9","tags":["advisory","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/IdentityPython/pysaml2/commit/1d8fd268f5bf887480a403a7a5ef8f048157cc14","tags":["fix","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21238","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/IdentityPython/pysaml2","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/pysaml2/PYSEC-2021-48.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-21238","url":"https://www.cve.org/CVERecord?id=CVE-2021-21238","licence":"CVE Terms of Use","modified":"2024-08-03T18:09:15.156Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f4g9-h89h-jgv9","url":"https://github.com/advisories/GHSA-f4g9-h89h-jgv9","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:13.856Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-21238","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21238","licence":"Public domain","modified":"2026-06-17T03:35:06.173Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-48","url":"https://osv.dev/vulnerability/PYSEC-2021-48","licence":"CC-BY-4.0","modified":"2023-11-08T04:04:39.068Z"}],"updatedAt":"2026-11-25T22:57:59.715Z","epss":{"score":0.01096,"percentile":0.66484,"date":"2026-12-01T12:00:22.000Z"}}