CVE-2022-39327: Code Injection Vulnerability in Azure CLI

azure-cli Updated 02 Oct 2025

Summary

06/03/2024
Yes i
Critical
Not published

CVE-2022-39327: Improper Control of Generation of Code ('Code Injection') in Azure CLI. Affects azure-cli versions < 2.40.0. Fixed in 2.40.0. How to fix ↓

Also tracked for

The same CVE-2022-39327 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Azure CLI is the command-line interface for Microsoft Azure, providing users with a convenient way to interact with Azure services. It allows users to manage resources, deploy applications, and automate tasks. The vulnerability in Azure CLI versions prior to 2.40.0 exposes a potential code injection issue. This vulnerability specifically affects Windows machines running Azure CLI commands with parameter values provided by an external source. It is important to note that this vulnerability is only applicable when PowerShell is used and the parameter value contains the & or | symbols. Upgrading to version 2.40.0 or later is recommended to mitigate this vulnerability.

Vulnerability Detail

The code injection vulnerability in Azure CLI arises when a hosting machine runs an Azure CLI command with parameter values from an external source. This vulnerability is only applicable on Windows machines using any version of PowerShell, and when the parameter value contains the & or | symbols. In such scenarios, an attacker can potentially inject malicious code into the command, leading to unauthorized access, data breaches, or other malicious activities. It is crucial to upgrade to Azure CLI version 2.40.0 or higher to address this vulnerability.

How To Fix

Minimum fixed version

2.40.0

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no specific workaround available for this vulnerability. It is recommended to upgrade to Azure CLI version 2.40.0 or later as soon as possible to address the code injection vulnerability.

Conclusion

The code injection vulnerability in Azure CLI versions prior to 2.40.0 poses a significant security risk for Windows machines running Azure CLI commands with parameter values from external sources. Upgrading to version 2.40.0 or later is crucial to mitigate this vulnerability and ensure the security of Azure CLI commands. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for azure-cli →

Share this vulnerability

FAQ

Azure CLI is the command-line interface for Microsoft Azure, allowing users to manage Azure resources, deploy applications, and automate tasks.

Versions of Azure CLI prior to 2.40.0 are affected by this code injection vulnerability.

This vulnerability is only applicable on Windows machines running Azure CLI commands with parameter values provided by an external source. It requires the use of PowerShell and the parameter value must contain the & or | symbols.

The code injection vulnerability in Azure CLI can lead to unauthorized access, data breaches, or other malicious activities, depending on the injected code.

You can use Vulert's playground at Vulert Scanner to check if your Azure CLI installation is affected by this vulnerability. Simply upload your package-lock.json file and Vulert will provide real-time monitoring and alerts for open-source vulnerabilities.

Related vulnerabilities

Recent vulnerabilities recorded for azure-cli.

How To Fix

Minimum fixed version

2.40.0

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback