CVE-2020-15228 redux: Azure DevOps Pipelines RCE
Azure DevOps Pipelines logging commands allow any step that prints untrusted output to inject commands, such as setting environment variables, which can lead to remote code execution in later steps. An attacker could exploit this by causing a vulnerable step to print crafted output, potentially modifying variables or service connections.
pricey.uk
Published on pricey.uk
Reading hackernews, I came across Issue 2070: Github: Widespread injection vulnerabilities in Actions. While I've yet to use github actions seriously, I recognised the feature described as near idential to Azure DevOps' "Logging Commands" and decided to look at whether they were vulnerable to the same issue.
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
The pipeline agent parses every line of standard output for logging commands, so any untrusted output can inject commands that modify variables or service connections.
Impact
An attacker could modify environment variables or service connections, potentially leading to remote code execution in later steps; the text notes that an opt-in mitigation exists but users remain vulnerable by default.
What the attacker needed
A pipeline with at least two steps; first step prints untrusted output; second step uses modifiable variables
The fix
Microsoft released an opt-in mitigation that restricts logging commands per task, but it is not enabled by default and must be applied to every step.
How it was found
- Create a pipeline with a step that fetches and prints untrusted content to standard output.
- Add a later step that uses an environment variable that can be modified by the injected command.
- Run the pipeline and observe that the environment variable has been changed from its default value.
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 DevOps Pipelines is a service that runs automated build and deployment tasks. It watches the text that each task prints and treats certain lines as special commands. If a task prints text from an untrusted source, an attacker can sneak in those special commands to change settings for later tasks, which can lead to running their own code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.