GitLab CE CVE-2021-22205 in the wild
Attackers registered two unverified accounts on an internet-exposed GitLab CE server and then uploaded a crafted image that abused ExifTool to run OS commands, escalating those accounts to admin. The write-up shows the whole chain can be reduced to two unauthenticated requests on default installs up to version 13.10.2.
security.humanativaspa.it
Published on security.humanativaspa.it
A few months ago one of our customers found two suspicious user accounts with admin rights on its Internet-exposed GitLab CE server, and asked us to investigate what it looked like a security incident. Here’s what we found:
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 bundled ExifTool failed to safely parse certain metadata in uploaded images, so a crafted file led to command execution inside the upload pipeline.
Impact
An unauthenticated attacker could run OS commands on a default GitLab CE install up to 13.10.2, here used to grant admin rights to self-registered accounts; the text notes the public exploit's payload failed to save the image, so the exact payload could not be recovered.
What the attacker needed
Internet-exposed GitLab CE up to 13.10.2; default open registration and no email verification; ability to upload an attachment
The fix
The text says the issues are absent from the latest GitLab CE version (14.4.0 at the time), so upgrading fixes it.
How it was found
- Register two accounts with random-looking usernames; email is not verified and the user is logged in automatically.
- Log in as the new users and list all projects, including private ones, through the API.
- Open an issue on the first project and upload an attachment to it.
- The upload is handled by gitlab-workhorse, which calls ExifTool on the file.
- The crafted image makes ExifTool run commands that promote the two accounts to admin.
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.
GitLab is a code-hosting server. Its image upload feature passed files to a helper program called ExifTool, which reads hidden data inside images. A specially crafted image made that helper run commands on the server, letting the attacker give their own new accounts administrator rights.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.