Summary
SuperTokens Core can accept a valid SAML signature without ensuring that it covers the Response or Assertion whose identity data is used for authentication. A user of a configured identity provider could exploit this mismatch to authenticate as another IdP user when a crafted SAML response is processed.
Affected context
The issue occurs in SuperTokens Core's SAML response-signature verification paths, including both response-level and assertion-level signing. Risk arises when signature validation does not verify that the signed XML element is the same element from which authentication identity and attributes are read; SP-initiated login can also reach the affected flow.
Exploit preconditions
- Attack surface: SAML sign-in through a SuperTokens Core deployment configured with an identity provider
- Required access: The attacker must be an ordinary user of that configured identity provider
- Trigger point: Processing a SAML response during login, including an SP-initiated login
- Why exploitation is possible: Signature validity is accepted without adequately binding the signature reference to the Response or Assertion used for authentication
Why this happens
The verification logic validates a cryptographic signature without first applying the SAML signature profile checks needed to ensure that the signature refers to the relevant XML element. This permits a mismatch between the element covered by a valid signature and the identity-bearing element consumed by the application, a form of XML Signature Wrapping. It relates primarily to CWE-347: Improper Verification of Cryptographic Signature and can result in an authentication decision that does not reflect the signed identity data.
Potential impact
- An attacker may be authenticated as another user of the configured identity provider
- The affected application account could be accessed or impersonated
- Actions performed through the application could be attributed to the impersonated user
General mitigation guidance
Defensive approaches focus on validating both the signature and its relationship to the exact XML element used for authentication.
- Apply SAML signature profile validation before accepting a signature
- Bind verified signatures to the specific Response or Assertion from which identity data is extracted
- Use well-maintained SAML libraries and avoid custom XML signature handling
- Parse identity and attributes only from the verified element, with strict structural and schema checks
- Apply least privilege to application accounts and sensitive operations, and avoid trusting identity data that has not passed the complete verification process
How teams detect issues like this
- Review SAML verification code for signature validation that is not paired with profile and reference checks
- Trace whether the Response or Assertion whose identity fields are consumed is the same element covered by the verified signature
- Use static analysis or security review rules to flag XML signature verification paths that omit signature-profile validation
- Enforce SAML configuration and implementation policies that require verified-element binding and strict document structure

