Skip to main content

SAML - Security Assertion Markup Language

About 2 min read

SAML (Security Assertion Markup Language) is an open standard for securely exchanging XML-based authentication and authorization information across different domains. SAML 2.0 was established by OASIS in 2005 and is one of the protocols used for single sign-on (SSO) in enterprise environments. OpenID Connect (OIDC) is also in use, but SAML is still used in some settings because of its compatibility with existing enterprise systems.

The SAML 2.0 Authentication Flow

The SAML authentication flow has two patterns: SP-initiated (originating from the SP) and IdP-initiated (originating from the IdP).

SP-initiated Flow
① User accesses the SP
② SP generates an AuthnRequest
③ Redirect to the IdP
④ IdP authenticates the user
⑤ POST the SAML Response to the SP
IdP-initiated flow: A pattern in which the user selects and accesses the SP directly from the IdP portal. Since no AuthnRequest is sent, the SP receives a response it did not request, and that response carries no InResponseTo attribute linking it to a request.

The Structure of a SAML Assertion

A SAML assertion is an XML document through which the IdP conveys the result of user authentication to the SP. It is composed mainly of three elements.

Authentication Statement

Describes when and by what method the user was authenticated. Includes the authentication time and the authentication method (password, MFA, etc.).

Attribute Statement

Stores the user's attribute information (email address, department, role, etc.). The SP uses this information to perform access control.

Authorization Decision Statement

Describes whether access to a specific resource is permitted. The SAML 2.0 specification states that this feature has been frozen as of SAML V2.0, with no future enhancements planned.

Comparison with OIDC

Both SAML and OIDC are protocols that enable federated authentication, but they differ in design philosophy and technical foundation.

AspectSAML 2.0OIDC
Data formatXMLJSON / JWT
Year established20052014
Main use caseEnterprise SSOWeb and mobile apps
Implementation complexityHigh (XML signatures, certificate management)Low (JSON-based)
Mobile supportDifficult (assumes browser redirects)Native support
Token sizeLarge (several KB)Small (a few hundred bytes)

Why SAML Persists in Legacy Systems

Even though OIDC is more modern and easier to implement, there are several reasons why SAML remains in use in enterprise environments. First, major SaaS products such as Salesforce, Workday, and ServiceNow have supported SAML for years, and migrating existing integration settings to OIDC carries a high cost. Second, where SAML integrations have accumulated in an in-house Active Directory Federation Services (AD FS) deployment, rebuilding those integration settings takes effort. Third, audit and compliance requirements sometimes call for a "proven protocol." The article on corporate password policy also touches on choosing an SSO protocol.

A SAML Vulnerability - XML Signature Wrapping Attacks

Because SAML uses XML Signature, it is exposed to an attack called XML Signature Wrapping (XSW). In this attack, a legitimate signed assertion is moved within the XML document, and a forged assertion created by the attacker is inserted at a position outside the scope of signature verification. If the SP's XML parser looks at different nodes for signature verification and for value reference, the attacker may be able to log in as any user. The countermeasure is to make the part checked when verifying digital signatures match the part from which later processing reads values.

Defenses Against XSW Attacks
  • Pass only the elements covered by signature verification on to assertion processing
  • Keep the SAML library at the latest version and apply patches for known XSW vulnerabilities
  • Strictly validate the schema of the assertions received on the SP side
  • Use encrypted assertions (EncryptedAssertion) whenever possible

Common Misconceptions

There is a misconception that "SAML is old, so it is not secure," but the age of a standard does not in itself make it weak. Problems arise from implementation flaws (lax signature verification, missed certificate rotation, etc.), and as XML Signature Wrapping shows, the freedom XML Signature allows in placing the signature and the signed content can also lead to implementation mistakes. Check the implementation checkpoints for introducing SSO in the startup security checklist.

The Operational Load While Both Protocols Coexist

A configuration in which newly adopted services use OIDC while existing services remain integrated over SAML arises as a transitional state until migration is complete. What increases during this period is less technical difficulty than verification work: the IdP holds two sets of integration settings for the same users, so adding an account, changing permissions, or disabling access when someone leaves has to be confirmed against both. Troubleshooting procedures diverge as well - on the SAML side, signature verification and certificate expiry are the places to suspect; on the OIDC side, token validation and where the keys are fetched from. Expiry management cannot be unified either, since certificates and client credentials are tracked on separate schedules. The OIDC side is contiguous with OAuth permission management, so the design of the scopes granted needs to be reviewed alongside it. Coexistence itself is hard to avoid, but if the inventory of which service uses which method is not current, permission changes will be missed on one side; setting a deadline for the migration so that the transitional state does not become permanent is therefore the operational key.

Was this article helpful?

Related Terms