Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions detection_rules/etc/non-ecs-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@
"aws.cloudtrail.flattened.request_parameters.withDecryption": "boolean",
"aws.cloudtrail.flattened.request_parameters.x-amz-acl": "keyword",
"aws.cloudtrail.flattened.request_parameters.x-amz-server-side-encryption-customer-algorithm": "keyword",
"aws.cloudtrail.flattened.response_elements.documentDescription.documentType": "keyword",
"aws.cloudtrail.flattened.request_parameters.key": "keyword"
"aws.cloudtrail.flattened.response_elements.documentDescription.documentType": "keyword"
},
"logs-aws.eks_audit-*": {
"aws.eks.audit.requestObject.spec.volumes.hostPath.path": "keyword"
Expand Down Expand Up @@ -185,7 +184,14 @@
"azure.platformlogs.properties.log.verb": "keyword",
"azure.platformlogs.properties.userAgentHeader": "keyword",
"azure.platformlogs.statusCode": "keyword",
"azure.resource.id": "keyword"
"azure.resource.id": "keyword",
"azure.platformlogs.properties.isTraceRequested": "keyword",
"azure.platformlogs.properties.isTraceAllowed": "keyword",
"azure.platformlogs.properties.apimSubscriptionId": "keyword",
"azure.platformlogs.properties.apiId": "keyword",
"azure.platformlogs.properties.productId": "keyword",
"azure.platformlogs.properties.userAgent": "keyword",
"azure.platformlogs.properties.operationId": "keyword"
},
"logs-azure.signinlogs-*": {
"azure.auditlogs.properties.target_resources.0.display_name": "keyword",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
[metadata]
creation_date = "2026/11/26"
integration = ["azure"]
maturity = "production"
updated_date = "2026/11/27"

[rule]
author = ["Elastic"]
description = """
Identifies Azure Resource Manager (ARM) control-plane actions against an API Management (APIM) instance that reveal
secret material: reading a named value's resolved value, listing the tenant access (legacy Management API) key, or
listing a subscription's or identity provider's secrets. These are low-volume, high-value operations most often used by
CI/CD pipelines rotating credentials, so any unexpected occurrence is a strong lead.
"""
false_positives = [
"""
CI/CD and infrastructure-as-code pipelines that rotate APIM named values, subscription keys, or the legacy tenant
access key will trigger this rule on every run. Exception known automation by `azure.resource.name` and a scheduled
time window, or by the pipeline's resource group, once validated with the owning team.
""",
]
from = "now-9m"
index = ["logs-azure.activitylogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Azure API Management Control-Plane Secret Listing"
note = """## Triage and analysis

### Investigating Azure API Management Control-Plane Secret Listing

This fires on any ARM action that returns live secret material from an APIM instance's control plane: a named
value's resolved value, the tenant access (legacy Management API) key, a subscription's keys, or an identity
provider's secrets.

### Possible investigation steps

- Review the resource and operation that fired (`azure.resource.name`, `azure.resource.group`,
`azure.activitylogs.operation_name`); `TENANT/LISTSECRETS/ACTION` is the most sensitive since it hands out the key
that signs requests to the retired Direct Management API, which bypasses ARM/Entra logging entirely for any
follow-on call.
- Identify the caller (`azure.activitylogs.caller`, `azure.activitylogs.identity_name`,
`azure.activitylogs.identity.claims.appid`); these were found to be null for service-principal callers on these
exact operations in this environment, so a blank caller doesn't mean the field wasn't checked -- cross-reference
`AADServicePrincipalSignInLogs` for ARM-scoped token requests in the same window as a substitute attribution
signal.
- Check whether the tenant access key was then used by looking for subsequent unexplained activity against Key Vault
secrets, backend services, or Microsoft Graph resources that the retrieved credential could reach. The legacy
Management API itself leaves no ARM trace, so look for its effects (Key Vault `SecretGet`, new service-principal
sign-ins, Graph calls) rather than the call itself.
- Determine whether this is expected automation by checking time-of-day regularity, resource group naming
(pipeline/ops conventions), and whether the same operation recurs on a fixed schedule.

### False positive analysis

- Secret-rotation pipelines are the dominant false-positive source. Confirm with the owning team before excepting.

### Response and remediation

- Rotate the exposed named value, subscription key, or tenant access key immediately -- the control plane cannot
tell you whether the retrieved value has already been used elsewhere.
- Disable the legacy Direct Management API (`tenant/access.enabled = false`) unless a documented, approved
dependency requires it.
- Review APIM RBAC for the resource: who holds `listValue`/`listSecrets` actions, and whether that's least privilege.
"""
references = [
"https://anderskristiansen.com/post/2026/apim-legacy-access/",
"https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-direct-management-api",
"https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-properties",
]
risk_score = 47
rule_id = "47798a78-5532-4659-b69a-d204ad1da275"
setup = """#### Required Azure Activity Logs
This rule requires the Azure integration with Activity Logs enabled and collected via a subscription-level
diagnostic setting.
"""
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Identity",
"Data Source: Azure",
"Data Source: Azure Activity Logs",
"Use Case: Threat Detection",
"Use Case: Configuration Audit",
"Tactic: Credential Access",
"Resources: Investigation Guide",
"Profile: Beta",
"Rule Type: Custom Query (KQL)",
"Platform: Azure",
"Service: Azure Resource Manager",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset:"azure.activitylogs" and azure.activitylogs.result_type:"Succeeded" and
azure.activitylogs.operation_name:(
"MICROSOFT.APIMANAGEMENT/SERVICE/NAMEDVALUES/LISTVALUE/ACTION" or
"MICROSOFT.APIMANAGEMENT/SERVICE/TENANT/LISTSECRETS/ACTION" or
"MICROSOFT.APIMANAGEMENT/SERVICE/SUBSCRIPTIONS/LISTSECRETS/ACTION" or
"MICROSOFT.APIMANAGEMENT/SERVICE/IDENTITYPROVIDERS/LISTSECRETS/ACTION"
)
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"


[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

[rule.investigation_fields]
field_names = [
"azure.resource.name",
"azure.resource.group",
"azure.activitylogs.operation_name",
"azure.activitylogs.caller",
"azure.activitylogs.identity_name",
"azure.activitylogs.identity.claims.appid",
"azure.subscription_id",
]

Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
[metadata]
creation_date = "2026/11/27"
integration = ["azure"]
maturity = "production"
updated_date = "2026/11/27"

[rule]
author = ["Elastic"]
description = """
Identifies an Azure API Management gateway request that explicitly requests diagnostic tracing. Request tracing is a
developer/debug feature that can reveal Key Vault-backed named-value secrets in the trace output; production API traffic
essentially never requests it. A caller who holds a valid subscription key, whether through theft or any other means,
can use tracing to pull policy-embedded secrets straight out of the gateway response without touching Key Vault or the
control plane.
"""
false_positives = [
"""
Developers and API publishers legitimately use request tracing while building or debugging policies, almost always
from the portal's built-in test console or a known development subscription. Except known developer/test
subscription IDs (`azure.platformlogs.properties.apimSubscriptionId`) and source IPs.
""",
"""
A request can set the trace header even when tracing is not allowed on the subscription (`allowTracing: false`) --
the gateway still logs `isTraceRequested: true` even though no trace output is returned. This still indicates
someone probed for tracing access and is worth triage, but is lower severity than a request where tracing was both
requested and permitted.
""",
]
from = "now-9m"
index = ["logs-azure.platformlogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Azure API Management Gateway Request Tracing Requested"
note = """## Triage and analysis

### Investigating Azure API Management Gateway Request Tracing Requested

### Possible investigation steps

- Identify the subscription and API this was against (`azure.platformlogs.properties.apimSubscriptionId`,
`azure.platformlogs.properties.apiId`, `azure.platformlogs.properties.productId`, `azure.resource.name`); a
subscription ID you don't recognize as a known developer/test identity is a strong lead, and rotating a
subscription's key does not change its ID, so cross-reference against your subscription inventory, not just
recently-rotated keys.
- Determine whether the trace was actually allowed or just requested by comparing against the subscription's
`allowTracing` setting; the gateway logs `isTraceRequested: true` regardless of whether tracing was permitted, and
if it was allowed, the caller may have received policy variables/secrets in the response trace headers.
- Identify who called it and from where (`source.ip`, `azure.platformlogs.properties.userAgent`), and compare
against known legitimate developer tooling (Azure Portal test console, documented CI policy-validation jobs).
- Check whether this correlates with an APIM control-plane secret listing or a new service-principal sign-in nearby,
via the companion rules "Azure API Management Control-Plane Secret Listing" and "Entra ID Sign-in with Unusual
Application and Source Address" in the surrounding window.

### False positive analysis

- See `false_positives` above. Maintain an allowlist of known developer/test subscription IDs and source IPs.

### Response and remediation

- If tracing was allowed: treat every named value or policy variable referenced by the traced API/operation as
exposed, and rotate it.
- Set `allowTracing: false` on all production subscriptions; restrict `allowTracing: true` to a small,
explicitly-reviewed set of development subscriptions.
- Review policy editor access -- Microsoft documents that policy editors can read named values directly, making
tracing one of several paths to the same exposure.
"""
references = [
"https://anderskristiansen.com/post/2026/apim-legacy-access/",
"https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-api-inspector",
"https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-properties",
]
risk_score = 47
rule_id = "2d6d20ac-41f7-4cf2-9d4e-78a3c7cf3f61"
setup = """#### Required Azure API Management Gateway Logs
This rule requires the Azure integration with the APIM Gateway Logs diagnostic category enabled and collected.
"""
severity = "medium"
tags = [
"Domain: Cloud",
"Data Source: Azure",
"Data Source: Azure Platform Logs",
"Use Case: Threat Detection",
"Use Case: Policy Violation",
"Tactic: Credential Access",
"Resources: Investigation Guide",
"Profile: Beta",
"Rule Type: Custom Query (KQL)",
"Platform: Azure",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset:"azure.platformlogs" and azure.resource.provider:"MICROSOFT.APIMANAGEMENT/SERVICE" and
azure.platformlogs.properties.isTraceRequested:"true"
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"


[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

[rule.investigation_fields]
field_names = [
"azure.platformlogs.properties.apimSubscriptionId",
"azure.platformlogs.properties.apiId",
"azure.platformlogs.properties.productId",
"azure.platformlogs.properties.userAgent",
"azure.resource.name",
"source.ip",
]

Loading
Loading