Repository navigation
Conversation
swachchhanda000
left a comment
There was a problem hiding this comment.
Please do share the relevant logs. thank you
6ae277a to
74f9ec8
Compare
74f9ec8 to
40292fc
Compare
|
Thanks for the review. Below is the audit event this rule is written against, plus the field by field mapping. About the sample: it is a redacted, representative Microsoft Entra ID audit record in the Log Analytics 1. FIC added to an app registration (
|
Rule selection |
Location in the event | Sample 1 | Sample 2 |
|---|---|---|---|
OperationName |
OperationName |
Update application |
Update service principal |
TargetResources.modifiedProperties|contains: 'FederatedIdentityCredentials' |
TargetResources[].modifiedProperties[].displayName |
FederatedIdentityCredentials |
FederatedIdentityCredentials |
Both conditions are ANDed, so the operation name alone is never enough. The rule does not parse the serialized newValue, so the internal key casing of that blob is not load bearing for matching. It is included above because it is what an analyst reads during triage: Issuer and Subject are the two values that decide whether the FIC is legitimate.
Why the second condition is what keeps this specific
A benign Update service principal, for example a display name change, carries no FederatedIdentityCredentials entry, so selection does not fire:
"modifiedProperties": [
{
"displayName": "DisplayName",
"oldValue": "\"example-uami-build\"",
"newValue": "\"example-uami-build-prod\""
}
]Cross checks on the two operation names
- Microsoft's audit activity reference lists both
Update applicationandUpdate service principalunder theApplicationManagementcategory: https://learn.microsoft.com/en-us/entra/identity/monitoring-health/reference-audit-activities Azure/Azure-Sentinel,Hunting Queries/AuditLogs/ServicePrincipalFederatedIdentityCredentialAdded.yamlkeys offwhere OperationName in~ ("Update service principal")followed bymv-expand ModProp = TargetResources[0].modifiedProperties | where tostring(ModProp.displayName) =~ "FederatedIdentityCredentials".- Elastic's
persistence_entra_id_service_principal_federated_issuer_modifiedkeys offwhere event.action == "Update application"followed bywhere azure.auditlogs.properties.target_resources.0.modified_properties.0.display_name == "FederatedIdentityCredentials", and dissects"Issuer":"..."out ofnew_value. That is where the serialized shape shown above comes from.
Note for completeness: a FIC created on a user assigned managed identity through ARM (Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/write) is recorded in the Azure activity log, which is a different logsource. The Update service principal branch here covers the directory side of the same technique.
What changed in this push
- Rebased onto current
master, the branch was behind. - Added
logsource.definitiondeclaring the TargetResources mapping requirement, mirroringazure_user_account_mfa_disable.yml, since this rule depends on that array being mapped.
Gates on the updated rule: sigma check --fail-on-error --fail-on-issues --validation-config tests/sigma_cli_conf.yml reports 0 errors and 0 issues (pySigma-validators-sigmahq 0.21.0), tests/test_rules.py 11 OK, tests/test_logsource.py 3 OK, yamllint clean.
Happy to tighten TargetResources.modifiedProperties|contains into the stricter TargetResources.modifiedProperties.displayName form if you prefer it. I kept the |contains shape to stay consistent with azure_ad_certificate_based_authencation_enabled.yml in the same folder.
Match verification
Compiled the rule and ran it against these samples with json_matcher v0.0.2, the checker regression-tests.yml uses:
$ sigma convert -t golang_expr --without-pipeline \
rules/cloud/azure/audit_logs/azure_app_federated_identity_credential_added.yml
(lower(OperationName) == lower("Update application") or lower(OperationName) == lower("Update service principal"))
and lower(TargetResources?.modifiedProperties) contains lower("FederatedIdentityCredentials")
$ ./json_checker -event fic_added.json -expr "$EXPR" -test-type json
MATCH
$ ./json_checker -event display_name_changed.json -expr "$EXPR" -test-type json
NO-MATCH
The events fed to the checker are the ones shown above with TargetResources mapped, which is exactly what the new logsource.definition line asks the backend for. Without that mapping the array does not resolve, which is why declaring it matters here as it does in azure_user_account_mfa_disable.yml.
|
@swachchhanda000 gentle nudge on this one: the logs you asked for were posted in the comment above on 2026-09-09, the same day as the review. That comment contains two redacted but structurally complete Entra ID audit records in the Log Analytics The review is still recorded as The branch is also behind master now - happy to rebase on request. |
|
@swachchhanda000 thanks again for the review. Following up on the logs request with something better than the representative records I posted on 2026-09-09. My own tenant has no federated identity credential activity inside its 30-day 1. Real
|
Rule selection |
Log Analytics AuditLogs |
Graph / diagnostic-settings source | Stratus (real) | Splunk event 1 | Splunk event 2 (benign) |
|---|---|---|---|---|---|
OperationName |
OperationName |
activityDisplayName / operationName |
Update application |
Update service principal |
Update service principal |
TargetResources.modifiedProperties|contains: 'FederatedIdentityCredentials' |
TargetResources[].modifiedProperties[].displayName |
targetResources[].modifiedProperties[].displayName (properties.targetResources in diagnostic settings) |
FederatedIdentityCredentials |
FederatedIdentityCredentials |
DisplayName (no match) |
| Result | MATCH | MATCH | NO-MATCH |
The real event also confirms two things from my earlier comment. The operation name is Update application. The modified property is literally FederatedIdentityCredentials, and it shows up again in Included Updated Properties. The serialized newValue uses PascalCase keys (Issuer, Subject) in the real capture and lowercase in the Splunk dataset. The rule doesn't parse newValue, so that difference has no effect on matching.
Match verification
Rule at the PR head (85e3599), sigma-cli 3.1.0, pySigma-backend-golangexpr 1.0.0, json_matcher v0.0.2 (the versions pinned in regression-tests.yml / tests/regression_requirements.txt):
$ sigma convert -t golang_expr --without-pipeline \
rules/cloud/azure/audit_logs/azure_app_federated_identity_credential_added.yml
(lower(OperationName) == lower("Update application") or lower(OperationName) == lower("Update service principal"))
and lower(TargetResources?.modifiedProperties) contains lower("FederatedIdentityCredentials")
$ ./json_checker -event stratus_fic_added.json -expr "$EXPR" -test-type json # MATCH
$ ./json_checker -event splunk_fic_added.json -expr "$EXPR" -test-type json # MATCH
$ ./json_checker -event splunk_displayname.json -expr "$EXPR" -test-type json # NO-MATCH
To be transparent about the input, these are the steps I took before feeding the events to the checker. I renamed the source keys to the AuditLogs column names shown in the table. Then I took the single TargetResources entry and serialized its modifiedProperties to a string, the way the logsource.definition requirement expects a backend to present it. json_matcher has no array traversal: with the raw nested arrays it returns an evaluation error instead of a match, which is the same for the existing TargetResources.modifiedProperties|contains rules in this folder. All values are untouched.
One scope note: Stratus's sibling technique azure.persistence.backdoor-managed-identity-fic creates the FIC through ARM, and that is recorded in the Azure Activity log (Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/write), which is a different logsource. This rule covers the Entra audit side.
Could you take another look when you have a moment? If you'd like any of these committed as regression data, or want the TargetResources.modifiedProperties.displayName form instead of |contains, let me know and I'll push it. The branch is behind master, and I can rebase it whenever you want.
The reviewer asked for the audit log this rule is written against. The tenant had no federated identity credential activity inside the 30 day AuditLogs retention, so the event was generated deliberately: a throwaway app registration, one federated identity credential with a reserved-example issuer and subject, then the app was deleted and purged. The record is the real Entra audit event with identifiers redacted (actor id, UPN, IP, correlation id, target object id, record id, client app id and user agent). Nothing the rule evaluates was altered: OperationName is 'Update application' and the modified property is named exactly 'FederatedIdentityCredentials'. TargetResources is delivered mapped, as the rule's definition already requires. Measured with sigma convert -t golang_expr and SigmaHQ/json_matcher v0.0.2, the versions the regression workflow pins: the rule matches that shape, does not match the array of objects, and against the raw dynamic array the compiled expression errors rather than returning false. tests/regression_tests_runner.py over rules/cloud: 1 test, 1 passed.
|
@swachchhanda000 following up with the thing that was actually missing: a capture from a real production tenant, not representative data and not a public dataset. This is new, it does not repeat the two earlier comments. My tenant had no federated identity credential activity inside the 30 day The recordMicrosoft Graph {
"initiatedBy": {
"user": {
"displayName": null,
"homeTenantName": null,
"id": "11111111-1111-4111-8111-111111111111",
"ipAddress": "192.0.2.10",
"userType": null,
"userPrincipalName": "[email protected]",
"agentType": "notAgentic",
"homeTenantId": null
},
"app": null
},
"id": "Directory_22222222-2222-4222-8222-222222222222_ABCDE_0000000",
"targetResources": [
{
"id": "33333333-3333-4333-8333-333333333333",
"userPrincipalName": null,
"type": "Application",
"modifiedProperties": [
{
"newValue": "[{\"Name\": \"sigma-6278-fic\", \"Issuer\": \"https://token.actions.githubusercontent.com\", \"Subject\": \"repo:example/example:ref:refs/heads/main\", \"Id\": \"44444444-4444-4444-8444-444444444444\", \"Description\": null, \"Audiences\": [\"api://AzureADTokenExchange\"], \"ClaimsMatchingExpressionValue\": null, \"ClaimsMatchingExpressionLanguageVersion\": 0, \"EncodingVersion\": 2, \"TrustedIssuer\": null}]",
"displayName": "FederatedIdentityCredentials",
"oldValue": "[]"
},
{
"newValue": "\"FederatedIdentityCredentials\"",
"displayName": "Included Updated Properties",
"oldValue": null
}
],
"displayName": "fic-capture-app",
"groupType": null
}
],
"result": "success",
"correlationId": "22222222-2222-4222-8222-222222222222",
"activityDateTime": "2026-10-21T01:46:39.5324406Z",
"category": "ApplicationManagement",
"resultReason": "",
"additionalDetails": [
{
"value": "redacted",
"key": "User-Agent"
},
{
"value": "55555555-5555-4555-8555-555555555555",
"key": "AppId"
}
],
"activityDisplayName": "Update application",
"operationType": "Update",
"loggedByService": "Core Directory"
}What the real data settlesThe property name is exactly Verified with the project's own matcher, not by eyeI compiled the rule with
So the rule fires on the real event once I also tested the two alternative idioms the corpus already uses, and kept the current oneSame record, same matcher, only the detection line changed:
The current line is the one that works, and it is the same idiom already merged in It is in the PR as regression test data, not just pasted herePushed in
Nothing is outstanding from my side. |
|
@swachchhanda000 @frack113 — this now has an approval from @frack113 as of 25 Oct, and the only thing still holding it is the Those were delivered three times in this thread: the representative @swachchhanda000, could you re-review or dismiss the stale request? The |
Summary
New detection rule: Federated Identity Credential Added To Entra Application Or Managed Identity.
Adding a federated identity credential (FIC) establishes workload identity federation — a trust with an external OIDC issuer that can then obtain tokens and authenticate as the target application or service principal without a secret or certificate. An adversary who can modify an application or service principal can add a FIC pointing at an issuer/subject they control (e.g. an attacker-owned GitHub Actions repo) to gain persistence that survives secret and certificate rotation. This is a distinct persistence primitive from adding a password/certificate credential (already covered by
azure_app_credential_added.yml) and from domain federation changes (azure_federation_modified.yml).Detection logic
Fires on the Entra ID audit event for a FIC being added to either object type:
OperationNameisUpdate application(app registration) orUpdate service principal(service principal / managed identity), andTargetResources.modifiedPropertiescontainsFederatedIdentityCredentials.The
modifiedPropertiesdiscriminator is what keeps the rule specific — a benignUpdate service principalevent (e.g. aDisplayNamechange) does not match. Field taxonomy and themodifiedProperties|containspattern mirror the existingazure_ad_certificate_based_authencation_enabled.yml.Verified the exact operation name (
Update service principal) and the modified-property display name (FederatedIdentityCredentials) against a real Entra audit-log sample, plus Microsoft's workload identity federation documentation and dirkjanm's research.MITRE ATT&CK
Notes
Complements a hardening check for the same technique — flagging FICs on privileged applications/service principals — so the preventive and detective sides line up.
Validation
sigma check --validation-config tests/sigma_cli_conf.yml <rule>→ 0 errors, 0 issues (pySigma validators-sigmahq 0.21.0).python3 tests/test_rules.py→ 11 tests OK.python3 tests/test_logsource.py→ 3 tests OK.