Remote Code Execution Vulnerability in Azure Pipelines Can Lead To Software Supply Chain Attack
Azure Pipelines allowed logging commands to be injected through user-controlled build variables such as the commit message, letting an attacker overwrite pipeline variables and tasks. This could give access to secrets and enable a software supply chain attack.
The Legit Security research team has found a vulnerability in Azure Pipelines (CVE-2023-21553) that allows an attacker to execute malicious code in a context of a pipeline workflow, which allows attackers to gain sensitive secrets, move laterally in the organization, and initiate supply chain attacks.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the pipeline agent did not escape or reject logging command syntax in user-controlled variables before printing them, so injected commands were interpreted.
Impact
An attacker could read sensitive secrets such as API keys and cloud credentials, or modify build output to carry out a supply chain attack; the text notes that in the pull request context there is no access to secrets or artifacts, so the risk arises after merge.
What the attacker needed
Permission to create a pull request or push a commit; pipeline prints a user-controlled variable; maintainer merges the pull request
The fix
The vulnerability was fixed in Azure DevOps Services and Azure DevOps Server by updating the pipeline agent to prevent logging command execution in vulnerable variables.
How it was found
- Fork the target repository.
- Create a pull request that looks innocent, such as a typo fix.
- Put a malicious logging command in the last commit message of the pull request.
- After a maintainer merges the pull request, the malicious command runs on the main branch with production configuration.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Azure Pipelines is a service that automatically builds and tests software. It reads information like the commit message from a pull request. The bug was that this message was printed without filtering, and a special command hidden in the message could change how the pipeline runs, potentially letting an outsider take control.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.