Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. azure-cli
  4. ›
  5. CVE-2022-39327

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

October 25, 2022 (updated April 9, 2025)

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.

For example: Application X is a web application with a feature that allows users to create Secrets in an Azure KeyVault. Instead of constructing API calls based on user input, Application X uses Azure CLI commands to create the secrets. Application X has input fields presented to the user and the Azure CLI command parameter values are filled based on the user input fields. This input, when formed correctly, could potentially be run as system commands. Below is an example of the resulting Azure CLI command run on the web app’s hosting machine.

az keyvault secret set --vault-name SomeVault --name foobar --value "abc123|whoami"

The above command could potentially run the whoami command on the hosting machine.

Interactive, in-terminal use and automation/pipeline scenarios have not been identified as critical risk scenarios.

References

  • github.com/Azure/azure-cli
  • github.com/Azure/azure-cli/pull/23514
  • github.com/Azure/azure-cli/pull/24015
  • github.com/Azure/azure-cli/security/advisories/GHSA-47xc-9rr2-q7p4
  • github.com/advisories/GHSA-47xc-9rr2-q7p4
  • github.com/pypa/advisory-database/tree/main/vulns/azure-cli/PYSEC-2022-43177.yaml
  • nvd.nist.gov/vuln/detail/CVE-2022-39327

Code Behaviors & Features

Detect and mitigate CVE-2022-39327 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.40.0

Fixed versions

  • 2.40.0

Solution

Upgrade to version 2.40.0 or above.

Impact 9.8 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
  • CWE-94: Improper Control of Generation of Code ('Code Injection')

Source file

pypi/azure-cli/CVE-2022-39327.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:12 +0000.