An adversary may forge SAML tokens with any permissions claims and lifetimes if they possess a valid SAML token-signing certificate. The default lifetime of a SAML token is one hour, but the validity period can be specified in the
NotOnOrAfter value of the
conditions ... element in a token. This value can be changed using the
AccessTokenLifetime in a
LifetimeTokenPolicy. Forged SAML tokens enable adversaries to authenticate across services that use SAML 2.0 as an SSO (single sign-on) mechanism.
An adversary may utilize Private Keys to compromise an organization's token-signing certificate to create forged SAML tokens. If the adversary has sufficient permissions to establish a new federation trust with their own Active Directory Federation Services (AD FS) server, they may instead generate their own trusted token-signing certificate. This differs from Steal Application Access Token and other similar behaviors in that the tokens are new and forged by the adversary, rather than stolen or intercepted from legitimate users.
An adversary may gain administrative Azure AD privileges if a SAML token is forged which claims to represent a highly privileged account. This may lead to Use Alternate Authentication Material, which may bypass multi-factor and other authentication protection mechanisms.
|M1015||Active Directory Configuration||
For containing the impact of a previously forged SAML token, rotate the token-signing AD FS certificate in rapid succession twice, which will invalidate any tokens generated using the previous certificate.
Enable advanced auditing on AD FS. Check the success and failure audit options in the AD FS Management snap-in. Enable Audit Application Generated events on the AD FS farm via Group Policy Object.
|M1026||Privileged Account Management||
Restrict permissions and access to the AD FS server to only originate from privileged access workstations.
|M1018||User Account Management||
Ensure that user accounts with administrative rights follow best practices, including use of privileged access workstations, Just in Time/Just Enough Administration (JIT/JEA), and strong authentication. Reduce the number of users that are members of highly privileged Directory Roles.
|ID||Data Source||Data Component||Detects|
|DS0028||Logon Session||Logon Session Creation||
Monitor for logins using SAML tokens which do not have corresponding 4769 and 1200 events in the domain. These logins may occur on any on-premises resources as well as from any cloud environment that trusts the certificate.
|Logon Session Metadata||
Consider modifying SAML responses to include custom elements for each service provider. Monitor these custom elements in service provider access logs to detect any anomalous requests.
|DS0002||User Account||User Account Authentication||
Monitor for user authentication attempts, when requesting access tokens to services, that failed because of Conditional Access Policies (CAP). Some SAML tokens features, such as the location of a user, may not be as easy to claim.
|DS0006||Web Credential||Web Credential Creation||
Monitor for creation of access tokens using SAML tokens which do not have corresponding 4769 and 1200 events in the domain.
|Web Credential Usage||
Monitor for the use of access tokens to access services such as email that were created using SAML tokens which do not have corresponding 1202 events (i.e. "The Federation Service validated a new credential") in the domain.