Microsoft on Tuesday released patches and guidance for addressing a high-severity vulnerability in Azure Command-Line Interface (CLI) that could result in the exposure of sensitive information, such as credentials, through GitHub Actions logs.
Tracked as CVE-2023-36052 (CVSS score of 8.6) and addressed with the release of Azure CLI 2.54 as part of the November 2023 Patch Tuesday, the bug existed because certain Azure CLI functions would inadvertently expose secrets through CI/CD logs.
While there are many functions that echo environment variables to the log, including credentials, and the action is performed as intended, this led to the sensitive information being exposed to everyone, for public repositories, and allowed attackers with ‘Read’ permissions on private repositories to retrieve it.
“An attacker that successfully exploited this vulnerability could recover plaintext passwords and usernames from log files created by the affected CLI commands and published by Azure DevOps and/or GitHub Actions,” Microsoft notes in its advisory.
Palo Alto Networks security researcher Aviad Hahami, who reported the bug to Microsoft, analyzed various usage patterns related to Azure CLI in GitHub Actions and identified three main variations in the wild.
Some developers, Hahami notes, did not know about the issue and put no mitigation in place, exposing themselves to attackers, others assumed Azure CLI would leak sensitive information and masked it themselves, while others attempted to mask the secrets but ended up leaking them by setting up separate pipelines for ‘create’ and ‘delete’ (or equivalent) actions.
In guidance on addressing CVE-2023-36052, Microsoft explains that changes were made to several Azure CLI commands and that additional changes will be made to harden Azure CLI against secrets exposure.
The tech giant changed multiple products, including Azure Pipelines, GitHub Actions, and Azure CLI, to improve secret redaction, including by adding a new default setting that prevents secrets leaking in the output of update commands for services in the App Service family.
“Note that this change might adversely impact some automation workflows since certain users might expect secret values in the Azure CLI response to then be used in subsequent parts of the workflow. However, there are safer authoring patterns for automation that we encourage customers to consider,” Microsoft notes.
The company also expanded credential redaction capabilities in GitHub Actions and Azure Pipelines to identify more key patterns in logs and mask them.
“This redaction is designed to target a specific set of keys for accuracy and performance reasons and is intended to catch any Microsoft-issued keys that may have inadvertently found their way into public-facing logs,” the tech giant says.
Microsoft recommends that all customers follow security best practices for cloud workload development and protection, including by keeping Azure CLI updated, not exposing Azure CLI output in logs and publicly accessible locations, rotating keys and secrets regularly, keeping repositories private, and reviewing available guidance on secrets management and the security of GitHub Actions and Azure Pipelines.