SAML Response Signature Not Validated
The service provider accepts SAML responses or assertions without properly validating their signature, so an attacker can forge or alter an assertion and sign in as any user.
| Severity | Critical |
| CVSS 3.1 | 9.1 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N Open in the calculator |
| CVSS 4.0 | 9.3 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-347: Improper Verification of Cryptographic Signature |
| OWASP Top 10 | A04:2025 Cryptographic Failures |
| MITRE ATT&CK | T1606.002 SAML Tokens, T1190 Exploit Public-Facing Application |
| Category | Cryptographic Failures |
Description
In SAML single sign-on, the identity provider signs the response, or the assertion inside it, and the service provider (the application) must verify that signature against the identity provider's known certificate before trusting the identity and attributes in the assertion. The application's validation is missing or incomplete, so an assertion that has been altered or created by an attacker is accepted. By presenting one, an attacker can sign in to the application as any user, including administrators, and set any attribute the application trusts, such as group membership or role. Because the application trusts single sign-on for every user, the weakness typically gives control of all accounts and data in the application, and the forged sign-ins do not appear in the identity provider's logs. The forms a tester meets include:
- No signature required: an assertion modified, for example, to change the
NameIDis accepted once itsSignatureelement is removed. - Wrong key: the signature is verified with the certificate carried in the message's
KeyInforather than the identity provider's configured certificate, so an assertion signed with the attacker's own certificate is accepted. - Signature wrapping: the signature is valid but covers a different element from the one the application reads, so a forged assertion placed alongside the signed one is used.
- Comment injection: a comment inserted into the
NameIDleaves the signature valid but truncates the value the application reads, changing the identity.
The forms that need no valid assertion can be exploited without any account, while signature wrapping and comment injection need one valid response, which any user of the identity provider can obtain. The weakness is identified by capturing a SAML response for a test account and replaying it with altered attributes, with the signature removed, re-signed with a self-generated certificate, and restructured with the wrapping variants, for example with the SAML Raider extension for Burp Suite, and checking which versions grant access.
Remediation
Validate every SAML response strictly, using a maintained library rather than custom XML handling:
- Require a valid signature on the assertion, or on the response that contains it where the library supports that, and reject any response or assertion that is unsigned.
- Verify the signature only with the identity provider's certificate taken from trusted, preconfigured metadata, never with a key or certificate supplied in the message.
- Use only the assertion that the library returns as verified, rather than querying the original XML document again, and reject responses that contain more than one assertion.
- Check the
Issuer,Audience,RecipientandDestinationvalues, theNotBeforeandNotOnOrAftertimes, andInResponseTofor sign-ins started by the service provider, and reject assertion identifiers that have already been used. - Keep the SAML and XML security libraries up to date, as signature wrapping and comment handling flaws have been fixed in several of them, and disable DTD processing in the XML parser.
If the fix cannot be deployed at once, consider disabling SAML sign-in for the application, or restricting access to it, until it is. Confirm the fix by repeating the unsigned, self-signed, wrapped and comment-injected tests and checking that each response is rejected.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.