Bypass of EXIF tag stripping via API uploads
GitLab's API upload endpoint did not strip EXIF tags from images, unlike the web interface. An attacker could upload images containing sensitive metadata such as geolocation information.
GitLab
Originally disclosed on GitLab
- Fixed in 2.6 years
- Disclosed after 2.6 years
HackerOne report #568414 by xanbanx on 2019-05-06, assigned to jritchey:
In GitLab 11.9.4, GitLab fixed a security vulnerability to strip EXIF tags from images (CVE-2019-10109). GitLab strips these tags when images get uploaded to the GitLab instance, e.g., when uploading an image when creating an issue.
However, this mitigation can be bypassed. GitLab provides a dedicated API endpoint, to upload new images to the uploads folder, which can included in the markdown description of an issue for example. When uploading an image via the API, GitLab does not strip the EXIF tags allowing images with geo information to be upload to a GitLab instance.
Steps to reproduce
Tested on GitLab.com, 11.10.4-ee
- Create a new project
- Upload an image via the projects API by using the following curl request:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "file=@<image-with-geo-info>.jpg" https://gitlab.example.com/api/v4/projects/<project-id>/uploads
Note, that the image being upload contains EXIF information like the geo information. The request here will return a JSON response similar like this one:
{
"alt": "image",
"url": "/uploads/8c6f78ac23b4a7b8c0182d7a89e9b1/image.jpg",
"markdown": "{{media:0}}"
}
- Download the image again. The image is accessible via the URL
https://gitlab.example.com/<namespace>/<project-name>/uploads/8c6f78ac23b4a7b8c0182d7a89e9b1/image.jpg. Note, that I used the relative URL I got from the JSON response.
When inspecting the downloaded image, the image still contains the EXIF geo information.
What is the current bug behavior?
GitLab strips the geo information when uploading an image via the web interface of the issue but misses this when uploading an image via the API.
What is the expected correct behavior?
Strip the EXIF information when uploading an image via the API.
Best,
Xanbanx
Impact
This issue can lead to images being uploaded to a GitLab instance revealing sensitive information like where an image was taken (geo information).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The API upload endpoint did not apply the same EXIF stripping logic as the web interface.
Impact
Images uploaded via the API could reveal sensitive information such as the location where the image was taken.
What the attacker needed
Access to a GitLab instance; a project; an API access token; an image with EXIF geo data
The fix
The API upload endpoint should strip EXIF information from uploaded images, just as the web interface does.
How it was found
- Create a new project.
- Upload an image containing EXIF geo information via the project's API using a curl request with a private token.
- Download the uploaded image using the URL returned in the JSON response.
- Inspect the downloaded image and observe that the EXIF geo information is still present.
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 report has not been written yet. The Original tab links to the source.
When you upload a photo, it can contain hidden data called EXIF, which may include where the photo was taken. GitLab tried to remove this data for images uploaded through its website, but forgot to do the same for images uploaded through its API (a way for programs to interact with GitLab). So someone could upload a photo with location data still attached.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.