Back to skill

Security audit

Azd Deployment for Azure

Security checks for vulnerabilities and agentic risk

Overview

This Azure deployment skill is mostly coherent, but it includes an insecure registry credential pattern that users should review before installing.

Review generated Bicep before use. Prefer managed identity with AcrPull for Container Apps, avoid ACR admin credentials and listCredentials-based secrets, and replace fixed /tmp hook files with a private temporary path. Treat azd up and role-assignment hooks as cloud-changing operations that should run only against the intended subscription and environment.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
references/bicep-patterns.md:132
Finding
Long-Lived ACR Administrator Credentials Exposed to Container App Configuration<![CDATA[ ## Vulnerability Details **File Location**: `references/bicep-patterns.md`, lines 132-140 and 200-216 **Related Location**: `references/troubleshooting.md`, lines 38-45 **Vulnerability Type**: Insecure cloud credential management **Risk Level**: Medium ### Vulnerable Code ```bicep resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-07-01' = { name: replace('acr${name}', '-', '') // ACR names can't have hyphens location: location tags: tags sku: { name: 'Basic' } properties: { adminUserEnabled: true // Required for Container Apps pull } } ``` ```bicep registries: [ { server: containerRegistry.properties.loginServer username: containerRegistry.listCredentials().username passwordSecretRef: 'acr-password' } ] secrets: [ { name: 'acr-password' value: containerRegistry.listCredentials().passwords[0].value } ] ``` The troubleshooting guide reinforces the same pattern: ```bicep properties: { adminUserEnabled: true } ``` ### Technical Analysis The documented infrastructure enables the Azure Container Registry administrator account and retrieves its password through `listCredentials()`. The password is subsequently copied into the Container App's secret configuration. The ACR administrator account is a long-lived, registry-wide credential rather than an identity scoped to the workload. It commonly provides both image pull and image push capabilities. This violates least-privilege principles because the Container App only needs permission to pull images. The pattern also contradicts the project's managed-identity guidance. Although the Container App has a system-assigned identity, the vulnerable module does not use that identity for registry authentication and instead introduces a reusable password. An attacker must first obtain permission to read the Container App secrets, invoke ACR credential-listing operations, or otherwise access deployment outputs containing the credential. The ...[truncated 1575 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Disable the ACR administrator account: ```bicep properties: { adminUserEnabled: false } ``` 2. Configure the Container App to authenticate with its system-assigned managed identity: ```bicep configuration: { registries: [ { server: containerRegistry.properties.loginServer identity: 'system' } ] } ``` 3. Grant only the `AcrPull` role to the Container App identity at the registry scope. Create the role assignment declaratively in Bicep where practical. 4. Remove all calls to `containerRegistry.listCredentials()` and remove the `acr-password` secret from Container App configuration. 5. Rotate both ACR administrator passwords after migrating existing deployments, then keep administrator access disabled. 6. Review Azure activity logs and ACR repository activity for unexpected credential-listing operations, image pushes, tag replacement, or manifest changes. 7. Update `references/troubleshooting.md` so authorization failures are resolved through managed-identity role assignments rather than by enabling administrator credentials. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
SKILL.md:169
Finding
Predictable Shared Temporary File Allows Symlink-Based File Overwrite<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 169-181 **Related Location**: `references/azure-yaml-schema.md`, lines 209-221 **Vulnerability Type**: Unsafe temporary-file handling **Risk Level**: Low ### Vulnerable Code ```yaml hooks: preprovision: shell: sh run: | # Save custom domains before provision if az containerapp show --name "$FRONTEND_NAME" -g "$RG" &>/dev/null; then az containerapp show --name "$FRONTEND_NAME" -g "$RG" \ --query "properties.configuration.ingress.customDomains" \ -o json > /tmp/domains.json fi postprovision: shell: sh run: | # Verify/restore custom domains if [ -f /tmp/domains.json ]; then echo "Saved domains: $(cat /tmp/domains.json)" fi ``` A similar fixed path appears in the complete schema example: ```yaml if az containerapp show -n "$FRONTEND_NAME" -g "$RG_NAME" &>/dev/null; then az containerapp show -n "$FRONTEND_NAME" -g "$RG_NAME" \ --query "properties.configuration.ingress.customDomains" \ -o json > /tmp/domains.json 2>/dev/null || echo "[]" > /tmp/domains.json fi ``` ### Technical Analysis The hook writes deployment state to the fixed path `/tmp/domains.json`. Shared temporary directories are normally writable by every local user. Shell redirection follows symbolic links, and the script neither creates the file atomically nor verifies that it is a regular file owned by the deployment user. A local attacker can therefore create `/tmp/domains.json` as a symbolic link before the deployment runs. When the privileged or higher-value deployment account executes the hook, output redirection follows the link and overwrites the linked destination if that account has permission to write it. The same predictable filename can also cause cross-run interference. Concurrent deployments may read or overwrite each other's saved domain state, and another local process may replace the file between the pre-p ...[truncated 1446 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Create a private temporary directory with `mktemp -d` instead of using a fixed shared filename: ```sh TEMP_DIR="$(mktemp -d)" chmod 700 "$TEMP_DIR" DOMAINS_FILE="$TEMP_DIR/domains.json" trap 'rm -rf -- "$TEMP_DIR"' EXIT ``` 2. Pass the generated path between lifecycle stages through a controlled environment variable or a private project-state directory. Do not reconstruct it from predictable input. 3. Quote every path and use `--` when supported: ```sh printf '%s\n' '[]' > "$DOMAINS_FILE" cat -- "$DOMAINS_FILE" ``` 4. Before consuming the file, verify that it is a regular file, is not a symbolic link, and is owned by the expected account. 5. Apply restrictive permissions such as mode `600` to the state file. 6. Validate the saved JSON before using it for restoration: ```sh jq -e 'type == "array"' "$DOMAINS_FILE" >/dev/null ``` 7. Ensure cleanup occurs on success, failure, and interruption. Update both `SKILL.md` and `references/azure-yaml-schema.md` so users do not copy the unsafe fixed-path pattern. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (34)

Credential Access

High
Category
Privilege Escalation
Content
---
name: azd-deployment
description: Deploy containerized applications to Azure Container Apps using Azure Developer CLI (azd). Use when setting up azd projects, writing azure.yaml configuration, creating Bicep infrastructure for Container Apps, configuring remote builds with ACR, implementing idempotent deployments, managing environment variables across local/.azure/Bicep, or troubleshooting azd up failures. Triggers on requests for azd configuration, Container Apps deployment, multi-service deployments, and infrastructure-as-code with Bicep.
---

# Azure Developer CLI (azd) Container Apps Deployment
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Static analysis

Detected: suspicious.generated_source_template_injection

User-controlled placeholder is embedded directly into generated source code.

Critical
Code
suspicious.generated_source_template_injection
Location
references/acceptance-criteria.md:279

User-controlled placeholder is embedded directly into generated source code.

Critical
Code
suspicious.generated_source_template_injection
Location
references/azure-yaml-schema.md:273

User-controlled placeholder is embedded directly into generated source code.

Critical
Code
suspicious.generated_source_template_injection
Location
SKILL.md:248