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

High 8.1 Published Updated

Attackers can execute arbitrary code on Windows machines via Azure CLI if external input contains specific symbols, requiring an upgrade to mitigate.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-39327?

CVE-2022-39327 is a high-severity code injection vulnerability in azure-cli, published on 25 Oct 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official 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.

Weakness: CWE-78, CWE-94

Which versions are affected by CVE-2022-39327?

4 open source packages ship an affected version, including azure-cli. It affects 1 product.

PackageAffectedFixed in
azure-cli BitnamiAll versions2.40.0
azure-cli PyPIAll versions2.40.0
azure-cli PyPIAll versions2.40.0
azure-cli PyPIAll versions2.40.0

Products include Microsoft Azure Command-Line Interface.

How do I fix CVE-2022-39327?

Upgrade azure-cli to 2.40.0 or later.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2022-39327 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-39327 exists.

Sources

Also known as BIT-azure-cli-2022-39327, GHSA-47xc-9rr2-q7p4, PYSEC-2022-43177, UBUNTU-CVE-2022-39327.

Is CVE-2022-39327 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free