How the attack works
Azure Container Instances and Azure Container Apps run containers without a cluster that the customer manages, and both offer a way in for troubleshooting. Container Instances supports executing a command in a running container, which Microsoft describes as most commonly used to launch an interactive shell (Microsoft.ContainerInstance/containerGroups/containers/exec/action). Container Apps lets a user connect to a container's console from the portal or the CLI. For that the client first asks Resource Manager for an auth token for the developer APIs that provide log stream, exec and port forward (microsoft.app/containerapps/getauthtoken/action). Container Apps also keeps application secrets, and Microsoft documents that the listSecrets operations for container apps, jobs and Dapr components return the secret values in plain text.
For an attacker with a role on the container group or the container app, a shell in the container is a position inside the workload. From there the process can read the environment and mounted files, and can request tokens for the managed identity of the container group or app, which Microsoft documents as available to code that runs in the container. Listing the secrets gives connection strings and registry passwords without entering the container at all. The Azure Activity log records the exec action on a container instance, the token request for a container app and the secret listing, each with its caller. It does not record what was typed in the session. For Container Apps the console connection itself is a data action (microsoft.app/containerApps/exec/action), not an Azure Resource Manager operation, so the log has the token request and not the session. No public incident report was found that describes these operations at the level of the audit event.
What an attacker needs
- On a container instance: a role with the exec action on the container group, such as Contributor or Owner.
- On a container app or job: a role with the action wildcard. Microsoft documents that Container Apps Contributor and Container Apps Operator, and their job counterparts, grant every action through a wildcard, including
listSecrets, even where the role name suggests narrower access. - For more than the container itself: a managed identity on the container group or app with rights on other resources, or secrets that open other systems.
Impact
Command execution inside the workload with whatever it can reach: its environment variables and files, its network position, and tokens for its managed identity. Listed secrets are valid on their own outside Azure, for example a database connection string or a registry password, and stay valid until they are changed at their source.
Detection rules
Command Executed in an Azure Container Instance
Detects a successful exec operation on a container of an Azure Container Instances container group (Microsoft.ContainerInstance/containerGroups/containers/exec/action). Microsoft describes the feature as executing a command in a running container, most commonly to launch an interactive shell. A shell in the container can read its environment and files and can use the managed identity of the container group. The Activity log records the operation and its caller, not the command or what was typed afterwards.
title: Command Executed in an Azure Container Instance
id: 513fc5f9-c10a-44c3-8906-d93f48e30165
status: experimental
description: >-
Detects a successful exec operation on a container of an Azure Container
Instances container group
(Microsoft.ContainerInstance/containerGroups/containers/exec/action).
Microsoft describes the feature as executing a command in a running
container, most commonly to launch an interactive shell. A shell in the
container can read its environment and files and can use the managed
identity of the container group. The Activity log records the operation and
its caller, not the command or what was typed afterwards.
references:
- https://attack.mitre.org/techniques/T1609/
- https://learn.microsoft.com/en-us/azure/container-instances/container-instances-exec
- https://learn.microsoft.com/en-us/azure/container-instances/container-instances-managed-identity
- https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/containers
author: Forestall
date: 2026-11-18
tags:
- attack.execution
- attack.t1609
logsource:
product: azure
service: activitylogs
detection:
selection:
OperationNameValue: MICROSOFT.CONTAINERINSTANCE/CONTAINERGROUPS/CONTAINERS/EXEC/ACTION
ActivityStatusValue:
- Success
- Succeeded
condition: selection
falsepositives:
- Developers and operators who open a shell in a container to troubleshoot it. Exclude their identities in a filter_ selection by Caller for non-production resource groups, and review every session in production.
level: medium
False positives
- Developers and operators who open a shell in a container to troubleshoot it. Exclude their identities in a filter_ selection by Caller for non-production resource groups, and review every session in production.
Container App Console or Log Stream Token Requested
Detects a successful request for the auth token of the Azure Container Apps developer APIs, for a container app, a job or a managed environment (getauthtoken/action and the older authtoken/action, which Microsoft marks for deprecation). Microsoft describes the token as used to get log stream, exec or port forward from a container, so this is the control-plane step before a console session. The console connection itself is a data action and is not in the Activity log. The same token request appears when somebody only views the log stream, so the rule is a starting point for a baseline of expected callers for each app and not an alert on its own.
title: Container App Console or Log Stream Token Requested
id: efd50182-bd55-47cb-9b0c-f243f4960d71
status: experimental
description: >-
Detects a successful request for the auth token of the Azure Container Apps
developer APIs, for a container app, a job or a managed environment
(getauthtoken/action and the older authtoken/action, which Microsoft marks
for deprecation). Microsoft describes the token as used to get log stream,
exec or port forward from a container, so this is the control-plane step
before a console session. The console connection itself is a data action
and is not in the Activity log. The same token request appears when
somebody only views the log stream, so the rule is a starting point for a
baseline of expected callers for each app and not an alert on its own.
references:
- https://attack.mitre.org/techniques/T1609/
- https://learn.microsoft.com/en-us/azure/container-apps/container-console
- https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/compute
author: Forestall
date: 2026-11-18
tags:
- attack.execution
- attack.t1609
logsource:
product: azure
service: activitylogs
detection:
selection:
OperationNameValue:
- MICROSOFT.APP/CONTAINERAPPS/GETAUTHTOKEN/ACTION
- MICROSOFT.APP/CONTAINERAPPS/AUTHTOKEN/ACTION
- MICROSOFT.APP/JOBS/GETAUTHTOKEN/ACTION
- MICROSOFT.APP/JOBS/AUTHTOKEN/ACTION
- MICROSOFT.APP/MANAGEDENVIRONMENTS/GETAUTHTOKEN/ACTION
ActivityStatusValue:
- Success
- Succeeded
condition: selection
falsepositives:
- Developers and operators who view the log stream or open the console of an app in the portal or the CLI. Exclude their identities in a filter_ selection by Caller for non-production apps.
level: low
False positives
- Developers and operators who view the log stream or open the console of an app in the portal or the CLI. Exclude their identities in a filter_ selection by Caller for non-production apps.
Container App, Job or Dapr Component Secrets Listed
Detects a successful listing of the secrets of an Azure Container Apps container app, job or Dapr component through Azure Resource Manager (listSecrets/action). Microsoft documents that these operations return the secret values in plain text and that several built-in Container Apps roles grant them through an action wildcard. The values are typically connection strings, API keys and registry passwords that work outside Azure. Deployment tools and the portal read the secrets as well, so the rule is a starting point for a baseline of expected callers for each app and not an alert on its own.
title: Container App, Job or Dapr Component Secrets Listed
id: 593c499b-cd5b-4f73-a382-bb7e0e0aeb5a
status: experimental
description: >-
Detects a successful listing of the secrets of an Azure Container Apps
container app, job or Dapr component through Azure Resource Manager
(listSecrets/action). Microsoft documents that these operations return the
secret values in plain text and that several built-in Container Apps roles
grant them through an action wildcard. The values are typically connection
strings, API keys and registry passwords that work outside Azure.
Deployment tools and the portal read the secrets as well, so the rule is a
starting point for a baseline of expected callers for each app and not an
alert on its own.
references:
- https://attack.mitre.org/techniques/T1552/
- https://learn.microsoft.com/en-us/azure/container-apps/manage-secrets
- https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/compute
author: Forestall
date: 2026-11-18
tags:
- attack.credential-access
- attack.t1552
logsource:
product: azure
service: activitylogs
detection:
selection:
OperationNameValue:
- MICROSOFT.APP/CONTAINERAPPS/LISTSECRETS/ACTION
- MICROSOFT.APP/JOBS/LISTSECRETS/ACTION
- MICROSOFT.APP/MANAGEDENVIRONMENTS/DAPRCOMPONENTS/LISTSECRETS/ACTION
- MICROSOFT.APP/CONNECTEDENVIRONMENTS/DAPRCOMPONENTS/LISTSECRETS/ACTION
ActivityStatusValue:
- Success
- Succeeded
condition: selection
falsepositives:
- Infrastructure-as-code tools and deployment pipelines that read the secrets of an app when they refresh its state, and administrators who open the secrets of an app in the portal. Exclude their identities in a filter_ selection by Caller once confirmed.
level: low
False positives
- Infrastructure-as-code tools and deployment pipelines that read the secrets of an app when they refresh its state, and administrators who open the secrets of an app in the portal. Exclude their identities in a filter_ selection by Caller once confirmed.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Managed identity attached to a workload shortly before a console session
A shell is worth most when the container has an identity with useful rights. An attacker who can write the container group or app may first attach a user-assigned identity and then open a session to use it. A write to the workload followed by an exec or a console token request by the same caller is that preparation and use in order.
- In the Azure Activity log, find
MICROSOFT.CONTAINERINSTANCE/CONTAINERGROUPS/WRITEorMICROSOFT.APP/CONTAINERAPPS/WRITEwith status Success. Keep theCallerand the resource ID. - Within 60 minutes, find
MICROSOFT.CONTAINERINSTANCE/CONTAINERGROUPS/CONTAINERS/EXEC/ACTIONorMICROSOFT.APP/CONTAINERAPPS/GETAUTHTOKEN/ACTIONby the sameCalleron the same resource. - Read the current identity of the container group or app and compare it with its earlier definition, because the write event does not say which property changed.
EventsMICROSOFT.CONTAINERINSTANCE/CONTAINERGROUPS/WRITEMICROSOFT.CONTAINERINSTANCE/CONTAINERGROUPS/CONTAINERS/EXEC/ACTIONMICROSOFT.APP/CONTAINERAPPS/WRITEMICROSOFT.APP/CONTAINERAPPS/GETAUTHTOKEN/ACTION
LimitsA developer who deploys a new revision and then opens the console to check it does the same, so production workloads and callers outside the owning team matter most. The 60 minutes are a starting point. The comparison of the identity needs an earlier copy of the resource definition, for example from infrastructure as code.
Triage
- Identify the Caller, the caller's IP address and the container group, container app or job. Check whether this identity troubleshoots this workload routinely.
- Check whether the workload is production, which managed identity it has and what that identity can access.
- For a secret listing, find out which secrets the app holds and which systems they open.
- Review the activity of the workload's managed identity after the session for requests the application does not normally make.
- Look for other credential listings and exec operations by the same caller in the same period.
Response
Once the attack is confirmed:
- Contain the caller. Revoke its sessions, rotate its credentials and remove the role that allowed the exec, the token request or the listing.
- Rotate every secret of the container app or job that was listed, at its source, and update the app.
- Restart or redeploy the container from a trusted image, because changes made in a running container do not show in its definition.
- Review what the workload's managed identity did after the session, and remove role assignments it does not need.
- Rotate secrets and keys that were readable from inside the container, such as values in environment variables and mounted files.
Mitigation
- Give operators a custom role without the
listSecretsand auth token actions where they only need to start, stop or view apps. Microsoft recommends this over the built-in roles with action wildcards. - Limit Contributor and Owner on resource groups that hold container groups and container apps, and assign them through Privileged Identity Management.
- Keep secrets in Azure Key Vault and reference them from the container app with a managed identity, so that the secret store is the vault with its own access control and log.
- Give the managed identity of a container group or app only the rights the workload needs.
- Send the Azure Activity log to your SIEM and baseline which identities open console sessions in production workloads.
Frequently asked questions
Does the Activity log show the commands run in the session?
No. For a container instance it records the exec action with its caller, and for a container app it records the request for the auth token that a console session needs. What was typed in the shell is not logged by Azure Resource Manager. Evidence of that has to come from the workload's own logs or from the activity of its managed identity.
Why does the Container Apps rule match a token request and not the console connection?
Microsoft lists the console connection (`microsoft.app/containerApps/exec/action`) as a data action, and data actions are not Azure Resource Manager operations. The control-plane step before it is the request for an auth token for the developer APIs, which Microsoft describes as used for log stream, exec and port forward. The same token request therefore also appears when somebody only views the log stream, which is why the rule is low.
Which roles can list the secrets of a container app?
More than their names suggest. Microsoft documents that Container Apps Contributor, Container Apps Operator and the matching roles for jobs define their permissions with action wildcards, which include the listSecrets operation. Contributor and Owner include it as well. A custom role that leaves out listSecrets is Microsoft's recommendation for operators who do not need the values.
Is there a public incident that used these operations?
No public incident report was found that describes them at the level of the audit event. The page is based on what Microsoft documents, which is that the exec feature launches a shell in a running container, that code in the container can use its managed identity, and that listSecrets returns values in plain text.
References
- MITRE ATT&CK T1609: Container Administration Command
- MITRE ATT&CK T1552: Unsecured Credentials
- Execute a command in a running Azure container instance
- How to use managed identities with Azure Container Instances
- Connect to a container console in Azure Container Apps
- Manage secrets in Azure Container Apps
- Managed identities in Azure Container Apps
- Azure permissions for Containers
- Azure permissions for Compute
- Azure Activity Log event schema