identity-providers
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIdentity Providers — cross-vendor authentication mechanics
身份提供商——跨厂商身份验证机制
This skill encodes how modern authentication protocols actually work at the level needed to detect abuse. It is vendor-neutral — specific platform telemetry lives in , , and .
entra-idokta-identityactive-directory本 skill 记录了现代身份验证协议在检测滥用所需粒度上的实际运作方式。它不限定特定厂商——特定平台的 telemetry 位于 、 和 。
entra-idokta-identityactive-directory1. OAuth 2.0 / OIDC token flows
1. OAuth 2.0 / OIDC token 流程
Authorization code flow (most common for web apps)
Authorization code flow(Web 应用中最常见)
User → App → Redirect to IdP /authorize
→ User authenticates + consents
→ IdP redirects back with authorization code
→ App exchanges code for tokens (POST /token)
→ IdP returns: access_token + id_token + refresh_tokenDetection-relevant: The code-to-token exchange happens server-side. A replayed authorization code ( in Entra ID) indicates code interception.
AADSTS54005User → App → Redirect to IdP /authorize
→ User authenticates + consents
→ IdP redirects back with authorization code
→ App exchanges code for tokens (POST /token)
→ IdP returns: access_token + id_token + refresh_token检测相关性:code-to-token 交换发生在服务端。重放 authorization code(Entra ID 中的 )表示该 code 遭到拦截。
AADSTS54005Client credentials flow (service-to-service)
Client credentials flow(服务到服务)
Service → POST /token with client_id + client_secret (or certificate)
→ IdP returns: access_token (no refresh token, no user context)Detection-relevant: No user interaction. Compromised client secrets enable persistent access. Monitor for: new credential additions to app registrations, token requests from unexpected IPs, expired secret usage.
Service → POST /token with client_id + client_secret (or certificate)
→ IdP returns: access_token (no refresh token, no user context)检测相关性:没有用户交互。泄露的 client secret 可用于维持持久访问。应监控:app registration 中新增凭据、来自异常 IP 的 token 请求,以及使用已过期 secret 的情况。
Device code flow
Device code flow
Device → POST /devicecode → receives user_code + device_code
→ User visits verification URL, enters user_code, authenticates
→ Device polls /token with device_code until user completes auth
→ IdP returns tokensDetection-relevant: Device code phishing — attacker sends the user_code to the victim, who authenticates on the attacker's behalf. The attacker's device receives the tokens. Detection: grant type from unexpected device/IP, or user authenticating device codes they didn't initiate.
device_codeDevice → POST /devicecode → receives user_code + device_code
→ User visits verification URL, enters user_code, authenticates
→ Device polls /token with device_code until user completes auth
→ IdP returns tokens检测相关性:Device code 钓鱼攻击——攻击者将 user_code 发送给受害者,受害者随后代表攻击者完成身份验证。攻击者的设备会收到 tokens。检测:来自异常 device/IP 的 grant type,或用户对自己未发起的 device code 完成身份验证。
device_codeResource Owner Password Credentials (ROPC)
Resource Owner Password Credentials(ROPC)
App → POST /token with username + password directly
→ IdP returns tokensDetection-relevant: ROPC bypasses MFA and conditional access in many configurations. Its use in modern environments is almost always suspicious. Detection: in token requests.
grant_type=passwordApp → POST /token with username + password directly
→ IdP returns tokens检测相关性:在许多配置中,ROPC 会绕过 MFA 和 conditional access。在现代环境中使用它几乎总是可疑的。检测:token 请求中出现 。
grant_type=password2. SAML assertion structure
2. SAML assertion 结构
xml
<saml:Assertion>
<saml:Issuer>https://adfs.contoso.com/</saml:Issuer>
<ds:Signature>...</ds:Signature>
<saml:Subject>
<saml:NameID>user@contoso.com</saml:NameID>
</saml:Subject>
<saml:Conditions NotBefore="..." NotOnOrAfter="...">
<saml:AudienceRestriction>
<saml:Audience>urn:federation:MicrosoftOnline</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AttributeStatement>
<saml:Attribute Name="http://schemas.microsoft.com/identity/claims/objectidentifier">
<saml:AttributeValue>user-guid</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>xml
<saml:Assertion>
<saml:Issuer>https://adfs.contoso.com/</saml:Issuer>
<ds:Signature>...</ds:Signature>
<saml:Subject>
<saml:NameID>user@contoso.com</saml:NameID>
</saml:Subject>
<saml:Conditions NotBefore="..." NotOnOrAfter="...">
<saml:AudienceRestriction>
<saml:Audience>urn:federation:MicrosoftOnline</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AttributeStatement>
<saml:Attribute Name="http://schemas.microsoft.com/identity/claims/objectidentifier">
<saml:AttributeValue>user-guid</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>Golden SAML attack
Golden SAML 攻击
Preconditions: Attacker has the ADFS token-signing certificate private key.
Mechanism: Forge SAML assertions for any user, any role, any audience — the relying party (e.g. Entra ID) trusts the signature.
Detection signals:
- SAML assertion without corresponding ADFS authentication event
- Token-signing certificate exported (EID 1007 on ADFS server)
- Assertion /
NotBeforewindow anomaliesNotOnOrAfter - Assertion claims that don't match the user's actual attributes in AD
- =
TokenIssuerTypein Entra IDExternalwhen it should beSigninLogsAzureAD
前提条件:攻击者拥有 ADFS token-signing certificate 的 private key。
机制:为任意用户、任意角色和任意 audience 伪造 SAML assertions——依赖方(例如 Entra ID)会信任该签名。
检测信号:
- 没有对应 ADFS authentication event 的 SAML assertion
- Token-signing certificate 被导出(ADFS server 上的 EID 1007)
- Assertion 的 /
NotBefore时间窗口异常NotOnOrAfter - Assertion 中的 claims 与用户在 AD 中的实际 attributes 不匹配
- 当结果应为 时,Entra ID
AzureAD中的SigninLogs=TokenIssuerTypeExternal
3. Primary Refresh Token (PRT)
3. Primary Refresh Token(PRT)
The PRT is a long-lived token issued to Windows devices joined to Entra ID. It enables SSO across all Entra ID-integrated applications.
| Concept | Detail | Detection relevance |
|---|---|---|
| Issuance | Issued during Windows logon to Entra ID-joined/hybrid-joined devices | PRT is bound to the device's TPM-protected key |
| Usage | Transparently presented to Entra ID during browser SSO | |
| Theft | Extracting PRT from device memory (e.g. | Stolen PRT used from a different device — detectable via device ID mismatch |
| Pass-the-PRT | Using stolen PRT to authenticate as the user from attacker's device | |
Detection: Correlate in sign-in events with the user's registered devices. PRT usage from an unregistered device is high-signal.
DeviceDetail.deviceIdPRT 是一种长效 token,签发给已加入 Entra ID 的 Windows 设备。它支持在所有集成 Entra ID 的应用中使用 SSO。
| 概念 | 详细信息 | 检测相关性 |
|---|---|---|
| 签发(Issuance) | 在 Windows 登录已加入或混合加入 Entra ID 的设备时签发 | PRT 与设备由 TPM 保护的密钥绑定 |
| 使用(Usage) | 在浏览器 SSO 期间自动提供给 Entra ID | Authentication 请求中的 |
| 窃取(Theft) | 从设备内存中提取 PRT(例如通过 | 从其他设备使用窃取的 PRT——可通过 device ID 不匹配进行检测 |
| Pass-the-PRT | 在攻击者的设备上使用窃取的 PRT,以用户身份完成身份验证 | |
检测:将登录事件中的 与用户已注册的设备进行关联。未经注册设备使用 PRT 是高信号。
DeviceDetail.deviceId4. Refresh token mechanics
4. Refresh token 机制
| Property | Detail | Detection relevance |
|---|---|---|
| Lifetime | Typically 90 days (Entra ID), configurable per IdP | Expired token reuse = |
| Binding | Can be bound to device, IP, or session | Token used from different device/IP = potential theft |
| Rotation | New refresh token issued on each use (sliding window) | Old refresh token reuse after rotation = replay attack |
| Revocation | Password change, admin revocation, session policy | Revoked token use = |
| Family | Refresh tokens form a family; revoking one revokes all | Limits blast radius of token theft |
| 属性 | 详细信息 | 检测相关性 |
|---|---|---|
| 生命周期(Lifetime) | 通常为 90 天(Entra ID),可按 IdP 配置 | 重用过期 token = |
| 绑定(Binding) | 可绑定到 device、IP 或 session | 从不同 device/IP 使用 token = 潜在失窃 |
| 轮换(Rotation) | 每次使用时签发新的 refresh token(滑动窗口) | 轮换后重用旧 refresh token = replay attack |
| 撤销(Revocation) | 修改密码、管理员撤销、session policy | 使用已撤销 token = |
| Family | Refresh tokens 组成一个 family;撤销其中一个会撤销全部 | 限制 token 失窃的影响范围 |
Token theft detection patterns
Token theft 检测模式
- IP change: Refresh token used from a different IP than the original authentication
- Device change: Token used from a different device fingerprint
- Concurrent use: Same refresh token used from two locations simultaneously
- Post-revocation use: Token used after password change or admin revocation
- IP 变化:Refresh token 的使用 IP 与最初身份验证时的 IP 不同
- Device 变化:Token 的使用设备指纹与原设备不同
- 并发使用:同一个 refresh token 同时从两个位置使用
- 撤销后使用:修改密码或管理员撤销后仍继续使用 token
5. Federation trust chains
5. Federation 信任链
ADFS → Entra ID
ADFS → Entra ID
User → ADFS (on-prem) → authenticates via AD
→ ADFS issues SAML assertion
→ Entra ID validates assertion signature against trusted certificate
→ Entra ID issues OAuth tokensDetection: in . = cloud-native auth. = federated. Monitor for unexpected federation sources.
TokenIssuerTypeSigninLogsAzureADExternalUser → ADFS (on-prem) → authenticates via AD
→ ADFS issues SAML assertion
→ Entra ID validates assertion signature against trusted certificate
→ Entra ID issues OAuth tokens检测:查看 中的 。 = 云原生身份验证。 = 联合身份验证。监控异常的 federation 来源。
SigninLogsTokenIssuerTypeAzureADExternalOkta → Entra ID (inbound federation)
Okta → Entra ID(inbound federation)
User → Okta (source IdP) → authenticates
→ Okta issues SAML assertion
→ Entra ID (target) validates and issues tokensDetection: in Okta System Log. for auth via external IdP. In Entra ID: = .
system.idp.lifecycle.createuser.authentication.auth_via_IDPTokenIssuerTypeExternalUser → Okta (source IdP) → authenticates
→ Okta issues SAML assertion
→ Entra ID (target) validates and issues tokens检测:Okta System Log 中的 。通过外部 IdP 进行身份验证时对应 。在 Entra ID 中: = 。
system.idp.lifecycle.createuser.authentication.auth_via_IDPTokenIssuerTypeExternalTrust chain abuse patterns
信任链滥用模式
| Attack | Mechanism | Detection |
|---|---|---|
| Golden SAML | Forge assertions with stolen signing key | Assertion without IdP auth event |
| Federation hijacking | Add attacker-controlled IdP as trusted source | IdP creation/modification events |
| Shadow federation | Create secondary federation relationship | New federation trust in directory audit logs |
| Token signing cert rotation | Replace legitimate cert with attacker-controlled | Certificate change events on ADFS/IdP |
| 攻击 | 机制 | 检测 |
|---|---|---|
| Golden SAML | 使用窃取的 signing key 伪造 assertions | 没有对应 IdP auth event 的 assertion |
| Federation hijacking | 将攻击者控制的 IdP 添加为 trusted source | IdP 创建或修改事件 |
| Shadow federation | 创建次级 federation relationship | Directory audit logs 中出现新的 federation trust |
| Token-signing certificate 轮换 | 用攻击者控制的 certificate 替换合法 certificate | ADFS/IdP 上的 certificate change events |
6. MFA ceremony flows
6. MFA ceremony 流程
Push notification (Okta Verify, Microsoft Authenticator)
Push notification(Okta Verify、Microsoft Authenticator)
User authenticates with password → IdP sends push to registered device
→ User approves/denies on device → IdP validates responseVulnerability: MFA fatigue — repeated pushes until user approves. Detection: Multiple push denials followed by approval. Okta: on followed by . Entra ID: (denied) followed by (success).
outcome.result eq "FAILURE"user.authentication.auth_via_mfaSUCCESSResultType 5001210User authenticates with password → IdP sends push to registered device
→ User approves/denies on device → IdP validates response漏洞:MFA fatigue——反复推送,直至用户批准。检测:多次 push 拒绝后紧接批准。Okta:在 中出现 ,随后出现 。Entra ID:先出现 (拒绝),随后出现 (成功)。
user.authentication.auth_via_mfaoutcome.result eq "FAILURE"SUCCESSResultType 5001210FIDO2 / WebAuthn
FIDO2 / WebAuthn
User authenticates → IdP sends challenge → Authenticator signs challenge
with device-bound private key → IdP validates signaturePhishing-resistant: The authenticator validates the origin (domain) — AiTM proxies cannot relay the challenge because the origin doesn't match. Detection: in Okta. FIDO2 authentication events in Entra ID.
FastPass declined phishing attemptUser authenticates → IdP sends challenge → Authenticator signs challenge
with device-bound private key → IdP validates signature抗钓鱼:Authenticator 会校验 origin(domain)——由于 origin 不匹配,AiTM proxy 无法中继 challenge。检测:Okta 中的 。Entra ID 中的 FIDO2 authentication events。
FastPass declined phishing attemptTOTP (Time-based One-Time Password)
TOTP(Time-based One-Time Password)
User authenticates → enters 6-digit code from authenticator app
→ IdP validates code against shared secret + current timeVulnerability: Phishable — AiTM proxy can capture and replay the TOTP in real-time. Detection: TOTP authentication from known AiTM infrastructure (IP reputation), or TOTP followed by immediate session from different IP.
User authenticates → enters 6-digit code from authenticator app
→ IdP validates code against shared secret + current time可被钓鱼——AiTM proxy 可以实时捕获并重放 TOTP。检测:来自已知 AiTM infrastructure 的 TOTP authentication(结合 IP reputation),或 TOTP 后立即从不同 IP 发起 session。
7. Policy-based access evaluation
7. 基于策略的访问评估
Modern IdPs enforce access decisions through policy engines that evaluate context at sign-in time. The concept is the same across vendors — only the implementation differs:
| IdP | Policy engine | Evaluation factors |
|---|---|---|
| Entra ID | Conditional Access | User/group, app, device state, location, risk level, grant controls (MFA, compliance) |
| Okta | Authentication Policies + Global Session Policy | User/group, app, device trust, network zone, behaviour |
| Google Workspace | Context-Aware Access | User/group, device, IP range, geo, device security posture |
Detection-relevant: Policy bypass attempts and policy weakening are high-signal across all IdPs. Monitor for:
- Access attempts blocked by policy (indicates probing or misconfiguration)
- Policy modifications that remove MFA requirements or exclude privileged roles
- Changes to trusted network/location definitions
For Entra ID-specific Conditional Access evaluation order, codes, and operations, see the skill.
ResultTypeAuditLogsentra-id现代 IdP 通过 policy engine 在登录时执行访问决策。各厂商的概念相同——差异仅在实现:
| IdP | Policy engine | 评估因素 |
|---|---|---|
| Entra ID | Conditional Access | 用户/组、应用、设备状态、位置、风险等级、授权条件(MFA、合规性) |
| Okta | Authentication Policies + Global Session Policy | 用户/组、应用、设备信任、网络区域、行为 |
| Google Workspace | Context-Aware Access | 用户/组、设备、IP 范围、地理位置、设备安全状态 |
检测相关性:在所有 IdP 中,policy bypass attempts 和 policy weakening 都是高信号。应监控:
- 被 policy 阻止的访问尝试(表明存在探测或配置错误)
- 移除 MFA 要求或排除 privileged roles 的 policy 修改
- 对 trusted network/location definitions 的更改
有关 Entra ID 特有的 Conditional Access evaluation order、 codes 和 operations,请参阅 skill。
ResultTypeAuditLogsentra-id8. Quality checklist
8. 质量检查清单
- Detection targets the protocol-level behaviour, not a specific IdP's UI.
- OAuth grant type identified (auth code, client credentials, device code, ROPC).
- Token lifetime and binding assumptions documented.
- Federation trust chain understood (which IdP issues, which validates).
- MFA ceremony type considered (phishing-resistant vs phishable).
- Token theft detection covers IP change, device change, and concurrent use.
- SAML assertion forgery conditions understood (signing key compromise).
- PRT theft detection correlates device ID with registered devices.
- Policy-based access bypass attempts monitored (Conditional Access, Okta policies, etc.).
- Cross-IdP correlation uses email/UPN as the join key.
- 检测目标是 protocol-level 行为,而不是特定 IdP 的 UI。
- 已识别 OAuth grant type(auth code、client credentials、device code、ROPC)。
- 已记录 token lifetime 和 binding 假设。
- 已理解 federation trust chain(哪个 IdP 签发、哪个验证)。
- 已考虑 MFA ceremony type(抗钓鱼还是可被钓鱼)。
- Token theft detection 覆盖 IP 变化、设备变化和并发使用。
- 已理解 SAML assertion 伪造条件(signing key 失陷)。
- PRT theft detection 将 device ID 与已注册设备进行关联。
- 已监控 policy-based access bypass attempts(Conditional Access、Okta policies 等)。
- 跨 IdP correlation 使用 email/UPN 作为 join key。