SAML is primarily used for single sign-on (SSO) and authentication within enterprise environments
- User tries to access a protected page.
- SP generates a
SAMLRequestand redirects to IdP.
- HTTP Method: GET (Redirect Binding)
- Parameters:
SAMLRequest: Base64+DEFLATE encoded XML AuthnRequestRelayState: Optional state (e.g. return URL)
- Inside AuthnRequest XML:
Issuer: SP Entity IDID: Unique identifierIssueInstant: TimestampDestination: IdP SSO URLAssertionConsumerServiceURL: Where IdP should send responseNameIDPolicy: Format of user identityForceAuthn: Force reauthentication
- Google Workspace prompts login or uses existing session.
- HTTP Method: POST (Browser auto-submits form)
- Form Fields:
SAMLResponse: Base64-encoded, signed XML responseRelayState: (if present in request)
- Inside SAML Response:
<saml:Assertion>:Issuer: IdP Entity IDSubject: IncludesNameIDConditions:NotBefore,NotOnOrAfterAudienceRestrictionβ SP Entity ID
AttributeStatement: Contains user attributes likeemail,groupsSignature: Ensures authenticity
- Checks signature, timestamps, audience, and user attributes.
| Parameter | Location | Purpose |
|---|---|---|
SAMLRequest |
Redirect URL | Encoded AuthnRequest from SP |
RelayState |
Redirect URL & POST | SP-specific state value |
SAMLResponse |
POST Form | Encoded signed XML Assertion from IdP |
NameID |
Inside <Subject> |
User identity (email, etc.) |
Audience |
Inside <Conditions> |
Valid SP audience (must match SP) |
NotBefore, NotOnOrAfter |
Inside <Conditions> |
Validity time window |
AttributeStatement |
Inside <Assertion> |
Custom user data (e.g. groups, roles) |
- Is the
SAMLResponsesignature verified? - Does SP enforce
Audiencematching? - Are
NotBeforeandNotOnOrAftervalidated correctly? - Is the
Issuerchecked against trusted IdPs?
- Can RelayState be used for open redirect?
- Does SP validate trusted redirect URLs?
- Can you alter
groupsoremailin Assertion and replay? - Does SP verify the signature of the assertion itself?
- Can a valid
SAMLResponsebe reused? - Is a unique
InResponseToID validated?
- Can you register or inject a malicious IdP?
- Does the SP consume only known, static IdP metadata?
- Does SP support both POST and Redirect bindings?
- Can you abuse inconsistent handling between bindings?
Burp Suite+ SAML plugins (e.g., SAML Raider)samltool.io/SAMLTracerbrowser extensionxmlsec1β CLI for validating XML signaturesjwt.ioβ Though not for SAML, for JWT-based OIDC checks
- Always verify signatures and audience
- Use strict time validation (
NotBefore,NotOnOrAfter) - Never trust user attributes unless assertion is verified
- Use signed assertions and responses (
WantAssertionsSigned=true) - Log and alert on replayed or malformed assertions