Skip to content
RCE Write-up Advanced

CVE-2019-1306: Are you my Index?

An insecure deserialization flaw in Azure DevOps Server's TFSJobAgent allowed an attacker with minimal privileges to upload a crafted file to a Git repository, which was then indexed and deserialized, leading to remote code execution. The attacker could execute arbitrary code on the server by combining a BinaryFormatter payload with invalid Markdown to bypass parsing.

zerodayinitiative.com

Published on zerodayinitiative.com

The BinaryFormatter is known as a popular binary serializer in the .NET platform. It’s also known as the deserializer with an insecure configuration by default.

The author, on zerodayinitiative.com

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 application used BinaryFormatter to deserialize data that could be influenced by an attacker (via a Git repository), without restricting the types that could be deserialized.

Impact

An attacker with minimal privileges could execute arbitrary code on the Azure DevOps Server, potentially compromising the entire system.

What the attacker needed

Access to a Git repository in Azure DevOps; Ability to push commits to that repository; Azure DevOps account with minimal privileges

How it was found

  1. Set up the Azure DevOps account to store Wiki pages in Git by clicking 'Publish code as wiki'.
  2. Find invalid Markdown text that causes the Markdig parser to throw an exception.
  3. Generate a BinaryFormatter payload using the TypeConfuseDelegate gadget.
  4. Combine the payload with the invalid Markdown string and adjust the BinaryFormatter header to bypass encoding detection.
  5. Store the result in a file, commit it to the Git repository, and push it to the Azure DevOps Server.
  6. The TFSJobAgent indexes the file and deserializes the payload, resulting in code execution.

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.

This is a bug in how a server processes files. The server takes a file from a Git repository and tries to read it as a wiki page. If the file is not valid Markdown, the server saves the raw bytes and later tries to turn them back into an object. Because the server uses an unsafe method to do that, an attacker can craft a file that, when processed, runs their code on the server. The attacker only needs to be able to push to a Git repository.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.