PIVTR-D
RAzure playbook · Pipelines and supply chain

Container image tampering in ACR

An attacker with push rights, the registry admin password or a repository token pushes a modified image over a trusted tag, or deletes the clean digest so the next deployment pulls theirs. Clusters and apps that pull by tag then run the attacker's code with the workload's identity and network access. Lock the repository and copy the bad image as evidence first, then cut off the credentials that pushed it.

Look here

LogSearch for
ContainerRegistryRepositoryEventsPushes, untags and deletes, by identity and address. Needs a diagnostic setting on the registry: ContainerRegistryRepositoryEvents | where OperationName contains "Push" or OperationName contains "Untag" or OperationName contains "Delete" | project TimeGenerated, OperationName, Repository, Tag, Digest, Identity, CallerIpAddress
ContainerRegistryLoginEventsWho authenticated to the registry and from where: ContainerRegistryLoginEvents | summarize count() by Identity, CallerIpAddress, UserAgent, ResultDescription
Pulls of the bad digestEvery identity that pulled the bad digest. Map each identity to a cluster or app: ContainerRegistryRepositoryEvents | where Digest == "<digest>" and OperationName contains "Pull" | summarize first=min(TimeGenerated), last=max(TimeGenerated) by Identity, CallerIpAddress, UserAgent
AKS workloadsPods running the digest: kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{" "}{.status.containerStatuses[*].imageID}{"\n"}{end}' | grep <digest>
AzureActivityCredential, token and import changes on the registry, under Microsoft.ContainerRegistry/registries: write, listCredentials/action, regenerateCredential/action, tokens/write, scopeMaps/write, generateCredentials/action and importImage/action. Role assignments at registry scope log as: Microsoft.Authorization/roleAssignments/write
Admin userWhether the registry admin user is on: az acr show --name <registry> --query adminUserEnabled
TokensRepository tokens you did not create: az acr token list --registry <registry> -o table
Content trustWhether Docker Content Trust is still on: az acr config content-trust show --registry <registry>
Defender for ContainersVulnerability findings for the digest. New pushes are scanned within a few hours, and images pushed or pulled in the last 30 days are rescanned daily

Contain

#Item
1Lock the repository so its images cannot be updated or deleted: az acr repository update --name <registry> --repository <repo> --write-enabled false
2Copy the bad image to an evidence registry by digest: az acr import --name <evidence-registry> --source <registry>.azurecr.io/<repo>@<digest> --image case-<id>/<repo>:evidence
3Save the repository's manifest metadata with the evidence: az acr manifest list-metadata --registry <registry> --name <repo>
4Block new pulls of the bad digest: az acr repository update --name <registry> --image <repo>@<digest> --read-enabled false
5Regenerate the first admin password: az acr credential renew --name <registry> --password-name password
6Regenerate the second admin password: az acr credential renew --name <registry> --password-name password2
7Turn the admin user off: az acr update --name <registry> --admin-enabled false
8Disable tokens the attacker used or created, and read each token's scope map with az acr scope-map show: az acr token update --name <token> --registry <registry> --status disabled
9List role assignments on the registry: az role assignment list --scope <registry-id>
10Remove push rights you did not grant: az role assignment delete --ids <assignment-id>
11Delete attacker tokens destructive, permanently invalidates their passwords: az acr token delete --name <token> --registry <registry> --yes

Eradicate and recover

#Item
1Rebuild the image from reviewed source, push it, and deploy by digest. Check the pipeline first with the DevOps pipeline playbook
2Replace every pod and app that ran the bad digest, and treat their identities as compromised with the AKS and managed identity playbooks
3Delete the bad manifest after evidence is saved destructive: az acr repository delete --name <registry> --image <repo>@<digest> --yes
4Sign images with Notation and keys in Key Vault, and verify signatures on AKS with Ratify and Azure Policy
5Disable Docker Content Trust before you move to Notation signing: az acr config content-trust update --registry <registry> --status disabled
6Enable soft delete, which is in preview. A registry cannot have both soft delete and a retention policy: az acr config soft-delete update --registry <registry> --days 30 --status enabled
7Send both registry log categories to the workspace on every registry, and enable Defender for Containers
Watch out
  • The Activity Log records no push, pull or delete, and the registry keeps no resource logs until you create a diagnostic setting. Purge events appear only when a retention policy is set.
  • A resource lock from az lock protects the registry resource and leaves repository content open to change. Tag and manifest attributes are separate, so deleteEnabled=false on a tag leaves its manifest deletable.
  • Docker Content Trust retires on March 31, 2028, and the current CLI accepts only --status disabled. Where it is on, it blocks nothing for clients without it, and tokens with repository-scoped permissions cannot push or pull signed images.
  • Defender for Cloud pulls images to scan them under an alphanumeric ID, so exclude that ID when you list who pulled a digest. Regenerated passwords take about 60 seconds to replicate.

Microsoft Learn: lock a container image, monitor Container Registry and its data reference, registry log tables, registry authentication, tokens and scope maps, Docker Content Trust and the move to Notary Project, soft delete policy, import images, Microsoft.ContainerRegistry operations, Azure CLI reference for az acr. Checked October 2026. Scan images with Defender for Cloud and vulnerability assessment for Azure: checked September 2026.

Adapts material from Dynamic Incident Response: A Framework for Security Teams by Joshua Wright, © 2026 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute, licensed under CC BY 4.0. Figures reproduced under that license. Changes were made. Not published by, endorsed by, or affiliated with the SANS Institute.