CVE-2026-57580 Overview
CVE-2026-57580 is a critical account takeover vulnerability in authentik, an open-source identity provider. The flaw affects inbound Security Assertion Markup Language (SAML) sources configured with the non-default USERNAME_LINK or EMAIL_LINK user-matching modes. authentik interprets an XML comment embedded in a NameID differently than the signing identity provider, allowing an attacker to inject a comment that truncates the value used for account matching while the signed assertion remains valid. The vulnerability is fixed in versions 2026.2.6 and 2026.5.5.
Critical Impact
An attacker with an account on the source identity provider who can set their own NameID can bind their external identity to a victim's authentik account, granting full takeover without the victim's password or the identity provider's private key.
Affected Products
- authentik versions prior to 2026.2.6
- authentik versions prior to 2026.5.5
- Inbound SAML sources using USERNAME_LINK or EMAIL_LINK user-matching modes
Discovery Timeline
- 2026-08-18 - CVE-2026-57580 published to the National Vulnerability Database (NVD)
- 2026-08-18 - Last updated in NVD database
Technical Details for CVE-2026-57580
Vulnerability Analysis
The vulnerability is an interpretation conflict [CWE-436] between authentik and the upstream SAML identity provider. When a signed SAML assertion contains a NameID element such as victim<!--x-->@attacker.example, authentik reads only the text preceding the XML comment. The identity provider, however, canonicalizes the assertion using exclusive canonicalization (xml-exc-c14n), which strips comments before computing the signature digest.
The signed value therefore includes the full string, but authentik acts on the truncated value. When the source is configured to link accounts by username or email, the truncated value maps to a victim's existing account. The attacker's external identity is then persistently bound to the victim, and subsequent logins succeed even without the crafted comment.
Sources using the default unique-identifier matching mode and authentik's outbound SAML Provider role are not affected.
Root Cause
The root cause is in the SAML source model at authentik/sources/saml/models.py. authentik used lxml's Element.text attribute to read the NameID value. Element.text returns only the character data up to the first child node, so any XML comment silently truncates the returned string. Because comment-excluding canonicalization removes comments before the digest is computed, a signed value can be truncated after signing while its signature remains valid.
Attack Vector
Exploitation requires an account on the upstream SAML identity provider and the ability to set the account's NameID. The attacker sets a NameID containing an XML comment that truncates to a victim's username or email, then initiates an inbound SAML login to authentik. authentik validates the signature against the full value, extracts the truncated value, and links the attacker's identity to the victim's account.
# Patch: authentik/common/saml/utils.py (new helper)
# Source: https://github.com/goauthentik/authentik/commit/6bd00f09f1f6b5bc5212a10340418fa1b264f02c
"""Shared SAML XML helpers"""
from collections.abc import Iterator
from typing import cast
from lxml.etree import _Element
def get_element_text(element: _Element) -> str:
"""Return the full text content of an XML element.
``Element.text`` only returns the text up to the first child node, so a value
containing an XML comment (for example ``admin<!--x-->_user``) is silently
truncated to ``admin``. Comment-excluding signature canonicalization
(``xml-exc-c14n``) strips those comments before the digest is computed, so a
signed value can be truncated after signing while keeping the signature valid.
Reading the text via ``itertext()`` keeps the value equal to what was signed.
"""
return "".join(cast(Iterator[str], element.itertext()))
The fix replaces reads of Element.text with itertext(), ensuring authentik uses the same string that was cryptographically signed. See the GitHub Security Advisory GHSA-35v6-hv2g-6992 for full details.
Detection Methods for CVE-2026-57580
Indicators of Compromise
- SAML assertions containing XML comment sequences (<!--...-->) inside NameID, Subject, or attribute value elements
- New SourceUserMatched or account-link events in authentik audit logs where the linked external identity was created shortly before the link
- Successful logins for privileged users originating from SAML sources configured with USERNAME_LINK or EMAIL_LINK matching mode
Detection Strategies
- Inspect stored SAML assertions and authentik event logs for NameID values containing <!-- or --> substrings
- Enumerate all configured inbound SAML sources and flag those using non-default user-matching modes (USERNAME_LINK, EMAIL_LINK)
- Correlate new external-source user bindings with prior account activity to identify recently linked identities for existing high-value accounts
Monitoring Recommendations
- Forward authentik audit and event logs to a centralized SIEM or data lake and alert on source_linked and login events for administrative users
- Add detection content matching XML comment patterns inside SAML NameID, SubjectConfirmationData, and AttributeValue elements
- Monitor the authentik release feed and dependency inventory for hosts still running versions below 2026.2.6 or 2026.5.5
How to Mitigate CVE-2026-57580
Immediate Actions Required
- Upgrade authentik to version 2026.2.6 or 2026.5.5 as published in the authentik 2026.2.6 release and authentik 2026.5.5 release
- Audit all inbound SAML source configurations for USERNAME_LINK and EMAIL_LINK matching modes and review any user-source links created while the vulnerable code was in production
- Reset sessions and rotate credentials for accounts that may have been linked through an affected SAML source
Patch Information
The fix is delivered in commits 6bd00f0 and 8704a1b, tracked by pull request #24057 and pull request #24062. The patch introduces a get_element_text() helper in authentik/common/saml/utils.py that uses itertext() to read the complete element text, matching the value that was signed.
Workarounds
- Switch affected inbound SAML sources to the default unique-identifier user-matching mode until the patched release can be deployed
- Restrict which upstream identity providers can be configured as sources, and disable inbound SAML sources for identity providers that permit users to set arbitrary NameID values
- Manually review and remove suspicious UserSourceConnection entries created before the upgrade
# Upgrade authentik via Docker Compose
docker compose pull
docker compose up -d
# Verify version after upgrade
docker compose exec worker ak version
# Expected: 2026.2.6 or 2026.5.5
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

