Repository navigation
[Rule Tuning] Entra ID Federated Identity Credential Modified - #6936
terrancedejesus merged 11 commits into
Conversation
Cover first credential created, additional credential added, and issuer changed on an existing credential in one ES|QL query. Replace the first-Issuer dissect with JSON_EXTRACT over MV_EXPAND'ed credential objects matched by Id. Rename rule and file to match.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Threat metadata and fleet-derived tags need correction before approval.
Review effort: Balanced
Findings: 3
Open (3)
What changed in this PR
Broadens the Entra ID FIC rule to detect credential creation, addition, and issuer changes.
Changes:
- Renames the rule and file.
- Replaces
DISSECTlogic with per-credential JSON parsing. - Updates alert fields and investigation guidance.
| File | Description |
|---|---|
persistence_entra_id_service_principal_federated_issuer_modified.toml |
Removes the former rule path. |
persistence_entra_id_federated_identity_credential_modified.toml |
Adds the renamed, expanded rule. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ential-modified-310
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
bryans3c
left a comment
There was a problem hiding this comment.
Suggest adding a fic_subject_changed branch. For GitHub Actions FICs the issuer is the same for every repo on GitHub, the subject is the only thing scoping the trust. An attacker with app-management rights can just rewrite Subject on the existing credential (repo:acme/deploy:ref:refs/heads/main -> repo:attacker/x:*): no new credential, same issuer, same Id, and the rule returns none (our lab subject-edit event at 18:33:42 confirms). It's two extra json_extract calls on Subject plus one case line, and the subject is useful on fic_added alerts anyway.
| concat("{", mv_last(split(substring(Esql.fic_old_value, 1, Esql.fic_old_id_pos - 1), "{")), mv_first(split(substring(Esql.fic_old_value, Esql.fic_old_id_pos), "}")), "}"), | ||
| null | ||
| ) | ||
| | eval Esql.fic_old_issuer = json_extract(Esql.fic_old_object, "Issuer") |
There was a problem hiding this comment.
| | eval Esql.fic_old_issuer = json_extract(Esql.fic_old_object, "Issuer") | |
| | eval Esql.fic_old_issuer = json_extract(Esql.fic_old_object, "Issuer"), | |
| Esql.fic_old_subject = json_extract(Esql.fic_old_object, "Subject") |
There was a problem hiding this comment.
@bryans3c - Issuer is the correct field being extracted here. It is whom will issue/mint tokens for the application as the third-party IdP.
Example:
{"Name":"fic-9c335d-extra","Issuer":"https://oidc.invalid/entra-fic-add-vs-modify-9c335d/extra","Subject":"lab-subject-extra","Id":"4f8b483d-f787-4b7f-a748-8cb0dd72c82b","Description":"emulation-run entra-fic-add-vs-modify-9c335d second credential","Audiences":["api://AzureADTokenExchange"],"ClaimsMatchingExpressionValue":null,"ClaimsMatchingExpressionLanguageVersion":0,"EncodingVersion":2,"TrustedIssuer":null}|
|
||
| query = ''' | ||
| from logs-azure.auditlogs-* metadata _id, _version, _index | ||
| | where event.action == "Update application" |
There was a problem hiding this comment.
can be this a multi-value array?
| "Data Source: Microsoft Entra ID", | ||
| "Data Source: Microsoft Entra ID Audit Logs", |
There was a problem hiding this comment.
do we need to list both Data Source ?
There was a problem hiding this comment.
No, not based on Platform inclusion. Will update, good catch.
…ntial A subject-only edit on an existing credential (same Id, same issuer, same count) previously classified as none and did not alert. On shared public issuers such as GitHub Actions the subject is the only value scoping the trust, so an actor with app-management rights could re-point an existing credential at their own repository without tripping the rule. Extract Subject from the old and new credential objects and add a fic_subject_changed case after fic_issuer_changed. Subject is coalesced to an empty string before comparing because json_extract returns null for the JSON null that flexible credentials carry, and a raw != against null would never be true. Verified against a year of trade-lab audit logs: the 2026-09-29 18:33:42 subject-edit event now alerts, the unchanged sibling credential in the same event stays none, and all existing classifications are unchanged.
…ential-modified-310

Summary
Entra ID Federated Identity Credential Issuer ModifiedtoEntra ID Federated Identity Credential Modified; file renamed to match.Issuerdissect never saw an add, and a first add ([]-> one credential) was invisible. This covers the behavior community PR [New] Entra ID Federated Identity Credential Added #6741 targets without a second rule on the same event.DISSECTwithJSON_EXTRACToverMV_EXPAND'ed credential objects matched byId.min_stack_version9.3.0 -> 9.4.0.Esql.fic_change(fic_created,fic_added,fic_issuer_changed),Esql.fic_id,Esql.fic_old_issuer,Esql.fic_new_issuer,Esql.fic_old_count,Esql.fic_new_count.Profile: Beta: the shipped rule has no alert telemetry, so noise cannot be measured until the new logic has run in the field.Logic breakdown
Update applicationaudit events whose modified property isFederatedIdentityCredentials.{(one JSON object per credential).},{, andMV_EXPANDto one row per credential.JSON_EXTRACTtheIdandIssuerfrom each new credential object.LOCATEthe sameIdin the old array; if present, cut that object out andJSON_EXTRACTitsIssuer.CASE: old count 0 ->fic_created;Idnot in old and count grew ->fic_added; sameId, different issuer ->fic_issuer_changed; otherwisenone.nonerows and the working fields, keep the alert fields.