Summary
authentik's SAML Source Assertion Consumer Service (ACS) endpoint is vulnerable to an XML Signature Wrapping issue that stems from improper input validation of upstream SAML responses.
An attacker with any valid account at the upstream Identity Provider (IdP) can replay a signed assertion in a manipulated SAML response to authenticate as a different federated user under certain conditions.
Affected context
The vulnerability affects authentik deployments configured to use SAML Sources for federation with an upstream IdP.
It is relevant when:
- authentik consumes SAML assertions from an external IdP via the ACS endpoint, and
- assertion validation relies heavily on XML signatures without robust structural checks or binding between the signature and the data being trusted.
In such configurations, crafted SAML responses from an otherwise legitimate IdP account may be accepted in ways that do not fully respect the intended subject or audience of the signed assertion.
Exploit preconditions
- Attack surface: authentik SAML Source Assertion Consumer Service (ACS) endpoint on the service provider (SP) side.
- Required access: An attacker must have any valid account at the upstream IdP that issues SAML assertions consumed by authentik.
- Trigger point: Delivery of a specially structured SAML Response to the ACS endpoint, typically via the standard browser-based SAML login flow.
- Why exploitation is possible: The ACS logic accepts a signed assertion embedded in an XML document without sufficiently binding the signature to the exact assertion and subject being trusted, allowing the attacker to wrap or replay a valid signed assertion in a modified envelope that leads authentik to establish a session as another federated user.
Why this happens
This issue arises from insufficient validation of SAML responses at the XML and protocol level, categorized as CWE-20: Improper Input Validation.
In an XML Signature Wrapping pattern, the application correctly verifies that a signature is cryptographically valid but fails to ensure that:
- the signed element is the one actually used to derive the authenticated identity, and
- the surrounding XML structure and references have not been manipulated.
As a result, an attacker can construct a response where a genuine, signed assertion is preserved but wrapped, duplicated, or repositioned alongside attacker-controlled elements.
The ACS logic then trusts the wrong assertion or context, leading to misbinding between the authenticated subject and the account to which authentik grants access.
Potential impact
- An attacker may authenticate to authentik as another federated user.
- An attacker could gain unauthorized access to applications relying on authentik for SSO.
- Privilege escalation can occur if the impersonated account has higher permissions or administrative capabilities.
- Downstream services integrated via authentik may be indirectly compromised through inherited sessions and tokens.
General mitigation guidance
Mitigation focuses on strengthening SAML response handling and enforcing strict XML and protocol invariants:
- Ensure that the SAML validation logic binds the verified signature to the exact assertion and subject used for authentication (e.g., enforce reference URI checks and unique ID handling).
- Validate the overall XML structure and reject responses with unexpected or duplicate assertion elements.
- Enforce strict checks on audience, recipient, and subject confirmation data, including conditions, NotBefore/NotOnOrAfter times, and NameID mappings.
- Reduce trust in upstream assertions by applying additional local policy checks (e.g., attribute mappings, account linking rules) before establishing a session.
- Run authenticating components with least privilege and separate duties so that compromise of one trust boundary has limited blast radius.
These patterns help ensure that even if a signed assertion is replayed or wrapped, it will not be accepted as a valid basis for establishing an authenticated session.
How teams detect issues like this
Effective detection approaches typically combine code-level inspection with runtime monitoring:
- Static analysis and code review:
- Look for SAML parsing paths where the code selects assertions by tag name or position rather than by the signature reference and unique IDs.
- Flag logic that validates signatures but then reads identity data from different or unsafely located XML nodes.
- Review handling of multiple assertions or duplicated IDs within a single SAML response.
- Configuration and policy checks:
- Enforce policies requiring strict SAML validation modes and reject non-conformant or structurally ambiguous responses.
- Periodically test SAML integrations with standardized XML Signature Wrapping test cases or security scanners.
- Runtime monitoring:
- Monitor authentication logs for anomalies, such as one IdP account seemingly "switching" between different local accounts in short succession.
Automated SAML security testing tools and general-purpose application security scanners that understand XML signatures can help surface such issues earlier in the development and integration lifecycle.

