Repository navigation
Conversation
Adds an ES|QL detection for the initial addition of a federated identity credential (FIC) to an Entra ID application that previously had none. A FIC establishes trust with an external OpenID Connect identity provider, letting a client authenticate as the application's service principal by presenting an externally issued token instead of a managed secret or certificate. An adversary with Application Administrator, application-owner, or Application.ReadWrite.All access can add a FIC pointing to an attacker-controlled IdP to gain persistent access without managing a secret and without tripping secret/certificate credential monitoring (T1098.001). This complements the existing rule "Entra ID Federated Identity Credential Issuer Modified" (rule_id 498e4094-...), which fires only when an existing FIC's issuer changes (old and new issuer both present). This rule covers the inverse, non-overlapping case: a new issuer appears in the FederatedIdentityCredentials modified property while no prior issuer was present (old_issuer is null) - i.e., the credential was added, not modified. Validation: `python -m detection_rules validate-rule` passes and the full tests/test_all_rules.py suite passes (54 passed, 1 skipped). Signed-off-by: earbona23 <[email protected]>
|
@earbona23 - thanks for the callout! Taking a closer look and doing additional emulation, there are 3 instances total.
Our original rule only detected the issuer change. However, we do not need to separate into new rules to match these behaviors. --> #6936 This should match all of these behaviors and still keep the rule rather straight forward. If you agree, please feel free to close this one and we will merge in the other when reviews are complete. |
|
Agreed, consolidating into one rule beats splitting it into three. Go ahead and close this one in favour of #6936. The initial-add case is what sent me here in the first place; good to see the emulation turned up the add-alongside-others variant as well. |
|
@terrancedejesus a small bookkeeping question on this one, long after the fact and genuinely not a complaint about the technical call — consolidating into #6936 was the right shape and I said so. When the two PRs I opened were superseded, the attribution came out differently between them, and I suspect it was not deliberate:
In #6936 that file is The behaviour that sent me here was the initial-add case, which the previous rule did not cover and which your emulation then widened to three instances. If adding the name is appropriate it would be one line; if Elastic's convention is that a tuned-and-rewritten rule is Elastic-authored, that is a perfectly good answer and I will stop wondering about the difference between the two. Nothing else outstanding from my side on either PR. |
Summary
Adds an ES|QL detection rule, Entra ID Federated Identity Credential Added, for the initial addition of a federated identity credential (FIC) to an Entra ID application that previously had none.
A FIC establishes trust with an external OpenID Connect identity provider, letting a client authenticate as the application's service principal by presenting an externally issued token instead of a managed secret or certificate. An adversary with Application Administrator, application-owner, or
Application.ReadWrite.Allaccess can add a FIC pointing to an attacker-controlled IdP to gain persistent access without managing any secret and without tripping secret/certificate credential monitoring or MFA controls.Reference: dirkjanm — Persisting with Federated Credentials in Entra ID.
Why this is not a duplicate
The existing rule Entra ID Federated Identity Credential Issuer Modified (
rule_id 498e4094-60e7-11f0-8847-f661ea17fbcd) fires only when an existing FIC's issuer changes — its guard isexternal_idp_old_issuer is not null and external_idp_new_issuer is not null and old != new.This rule covers the inverse, non-overlapping case: a new issuer appears in the
FederatedIdentityCredentialsmodified property while no prior issuer was present (external_idp_new_issuer is not null and external_idp_old_issuer is null) — i.e. the credential was added, not modified. The two guards are mutually exclusive, so there is no double-alerting. Together they cover both establishing and redirecting federated trust.Neither of the adjacent credential rules covers this either:
persistence_entra_id_service_principal_credentials_added→ operationAdd service principal credentials(client secrets / certificates on a service principal, not FICs).persistence_entra_id_application_credential_modification→ operationUpdate application - Certificates and secrets management(secrets / certs, not FICs).Detection
ES|QL over
logs-azure.auditlogs-*, keyed onevent.action == "Update application"withtarget_resources.0.modified_properties.0.display_name == "FederatedIdentityCredentials", mirroring the field handling of the companion issuer-modified rule.Complements Prowler hardening
This detection pairs with a preventive/hardening check for the same technique in Prowler (prowler-cloud/prowler#12748): Prowler surfaces existing risky FIC configurations, this rule alerts in near-real-time when a new one is established.
MITRE ATT&CK
Scope / known limitation
Scoped to the initial addition where no FIC existed before (highest-signal, lowest-FP persistence establishment). Documented in the investigation guide, which points to the companion issuer-modified rule for the modification case.
Validation
python -m detection_rules validate-rule <rule>→ Rule validation successfulpytest tests/test_all_rules.py→ 54 passed, 1 skipped (skip is the remote/live-stack test requiring credentials)DCO sign-off included.