Summary
A certificate-validation and identity-binding flaw in the SimpleSAMLphp SAML2 library can cause an unsigned embedded SAML Response to be accepted for the wrong identity provider. In a multi-IdP federation, a lower-trust or malicious IdP may authenticate users as a higher-trust victim IdP with attacker-controlled identity and session attributes.
Affected context
The issue occurs in deployments using the HTTPArtifact::receive() flow and SOAP-based artifact resolution across multiple identity providers. Risk is higher when embedded SAML responses are unsigned or insufficiently bound to the artifact issuer, and when TLS validation results are applied using metadata selected from the embedded response rather than being strictly associated with the originating IdP.
Exploit preconditions
- Attack surface: SAML HTTP Artifact processing and SOAP artifact resolution
- Required access: Ability to operate or influence an identity provider participating in the federation
- Trigger point: Validation of an embedded SAML Response within an ArtifactResponse
- Why exploitation is possible: The response may be checked against the wrong identity-provider metadata, while a validator that does not raise an exception is treated as successful
Why this happens
The underlying flaw is improper certificate validation combined with incorrect binding between the outer artifact message and the embedded SAML response. The TLS validator is attached to the outer SOAP message, but validation of the embedded response can be evaluated using metadata selected from its claimed issuer. Additionally, a validation routine that returns normally when a key does not match is interpreted as successful by the message-validation logic. This maps to CWE-295: Improper Certificate Validation, where certificate or key checks do not reliably establish the identity and trust relationship being asserted.
Potential impact
- An attacker could authenticate as users belonging to a higher-trust identity provider
- Federated applications may accept attacker-selected assertion attributes or NameID values
- Unauthorized sessions could be created with manipulated session data
- Trust relationships between identity providers could be bypassed
- Downstream applications could make authorization decisions using forged identity information
General mitigation guidance
Mitigation generally focuses on enforcing explicit identity binding and fail-closed certificate validation throughout the artifact-processing flow.
Common defensive patterns include:
- Bind the embedded SAML Response to the identity provider that issued the artifact
- Validate signatures and certificates against the expected issuer and its trusted metadata
- Treat certificate or key mismatches as validation failures rather than successful returns
- Require signed responses or assertions according to federation policy
- Avoid selecting trust metadata solely from untrusted issuer claims
- Apply least privilege to federated identities and downstream session permissions
- Use narrowly scoped trust relationships and separate high-trust providers from lower-trust participants
How teams detect issues like this
Organizations can identify similar weaknesses through:
- Static analysis of certificate-validation routines for inverted, ignored, or non-failing mismatch conditions
- Code review of relationships between outer protocol messages, embedded assertions, and issuer metadata
- Tests covering mismatched artifact issuers, embedded response issuers, certificates, and signing keys
- Federation policies requiring explicit issuer-to-artifact binding and signed SAML content
- Runtime monitoring for authentication events where the artifact source and assertion issuer differ
- Automated security review tools that flag fail-open validation logic and trust decisions based solely on attacker-controlled claims

