SAML
SAML
Single Sign-on (SSO) is an authentication service that allows users to utilize a single set of credentials to access multiple applications. Security Assertion Markup Language (SAML) is one of the ways one can implement SSO.
Security Assertion Markup Language (SAML) is a markup language implemented in XML.
SAML messages are base64 encoded but that is easily decoded to view the message contents.
SAML and OAuth are different protocols and are used for different purposes, OAuth is a protocol for authorization while SAML is a protocol for authentication.
How it Works:
SAML enables SSO by managing the interaction between three parties: The user(SAML Assertion), the identity provider, and the service provider
1. SAML Assertion:An XML message that contains information about the user’s identity and potentially other user attributes.
2. Identity Provider (IdP): The service performing the authentication and issuing the Assertion. Authentication can be any number of things from username/password to 2FA.
3. Service Provider (SP): The web application that the user wants to access.
Attacks:
XML SIGNATURE WRAPPING (XSW):
The basic premise behind XSW is that XML documents containing XML Signatures may be processed in two separate steps: once for the validation of the digital signature, and once for the real application that uses the XML data. Consider the following two steps and the methods used to arrive at a single XML element:
XML Signature Validation
The application locates the
<ds:Signature>’s<ds:Reference>elementThe application uses the
<ds:Reference>’sURIattribute to determine which XML element is signedThe application (in)validates the signed XML element
After validation, the same application attempts to use the signed data as part of its normal operation.
The application’s XML parser locates its desired XML element using top-down tree-based navigation
XML SIGNATURE EXCLUSION:
Signature Exclusion is used to test how the SAML implementation behaves when there is no Signature element.
When a Signature element is absent the signature validation step may get skipped entirely.
CERTIFICATE FAKING:
Certificate faking is the process of testing whether or not the Service Provider verifies that a trusted Identity Provider signed the SAML Message.
TOKEN RECIPIENT CONFUSION:
Token Recipient Confusion tests whether or not the Service Provider validates the Recipient.
The Recipient field is an attribute of the SubjectConfirmationData element, which is a child of the Subject element in a SAML Response.
The Recipient attribute found on the SubjectConfirmationData element is a URL that specifies the location to which the Assertion must be delivered. If the Recipient is a different Service Provider than the one who receives it, the Assertion should not be accepted.
MISCELLANEOUS ATTACKS:
XXE in SAML:
XSLT in SAML:
Tools:
SAML Encoder - Online SAML Request-Response Encode Tool - Base64 - Deflate
https://github.com/CompassSecurity/SAMLRaider
Labs:
GitHub - yogisec/VulnerableSAMLApp: Vulnerable SAML infrastructure training applicaiton
Reference:
How to Hunt Bugs in SAML; a Methodology - Part I -
How to Hunt Bugs in SAML; a Methodology - Part II -
How to Hunt Bugs in SAML; a Methodology - Part III -
https://sso-attacks.org/Main_Page
https://research.aurainfosec.io/bypassing-saml20-SSO/
SAML From A Hackers Perspective - Part 1 Intro
Verification of SAML Tokens - Traps and Pitfalls
Mind-Maps:

Tips:
Author:
Last updated