!exploitable Episode Three - Devfile Adventures
GitLab Workspaces validated devfiles with a Ruby YAML parser while the Go devfile binary parsed them differently, letting a crafted devfile smuggle a parent reference past the validator. The devfile binary then decompressed a registry archive without properly containing extracted paths, allowing an attacker to write files outside the intended directory on the GitLab server.
blog.doyensec.com
Published on blog.doyensec.com
I know, we have written it multiple times now, but in case you are just tuning in, Doyensec had found themselves on a cruise ship touring the Mediterranean for our company retreat. To kill time between parties, we had some hacking sessions analyzing real-world vulnerabilities resulting in the !exploitable blogpost…
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 a parser differential between Ruby's YAML library and Go's yaml.v3, combined with a decompression routine that joined archive entry names to a target directory without preventing path traversal.
Impact
An attacker could achieve arbitrary file write on the GitLab server, which may lead to further compromise.
What the attacker needed
GitLab Workspaces enabled; a Kubernetes GitLab Agent; ability to add a devfile to a repository
How it was found
- Create a devfile containing a parent option hidden behind a YAML tag that Ruby decodes but Go drops.
- Submit the devfile so GitLab's pre-flatten validator runs and fails to see the parent option.
- The devfile binary processes the file and fetches resources from a registry.
- The decompress function extracts the archive, joining entry names to the target directory.
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.
A devfile is a small configuration file that tells GitLab how to build a developer workspace. GitLab checked the file with one YAML reader and later processed it with a different one, and the two disagreed about a special tag, so a hidden setting slipped through. The processing step then unpacked an archive and could place files outside the folder it was meant to use.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.