Bypass EXIF tag filtering by using Fullpath of project in wikis api
The EXIF tag filtering for wiki attachments was not applied when the API was called using the project's full path with an encoded slash, because the upload bypassed the Workhorse component. An attacker could upload images with EXIF metadata intact, potentially exposing sensitive information.
GitLab
Originally disclosed on GitLab
- Fixed in 17 months
- Disclosed after 17 months
HackerOne report #911585 by ledz1996 on 2020-06-30, assigned to @ankelly:
Summary
Since EXIF tag filtering is not moved into Workhorse, we will bypass this by simple skiping gitlab-workhorse for the /wikis/attachments/ APIs. This will make all the EXIF tags in the image uploading by this API wiill not be stripped
Steps to reproduce
- Use a JPEG image with EXIF tag
- Get your project full path and url encode the "/", For example: Namespace:
rrr, Project:eeeee-> full path:rrr%2feeeee - Upload using the following syntax of API
curl -X POST --form "file=[@]valley-of-fire.jpg" --header "Private-Token: MnXs_w7GzqQQLFtscBai" http://gitlab.example.vm/api/v4/projects/rrr%2feeeee/wikis/attachments
- Get the URL in the response and add it to
http://gitlab.example.vm/rrr/eeeee/-/wikis/
For example:
http://gitlab.example.vm/rrr/eeeee/-/wikis/uploads/a1f8aba5a1109b6f87a8368454084eb2/valley-of-fire.jpg
5. View the properties of the file all the EXIF tags are all there
ROOT CAUSE: using the full path syntax for the API make the file upload go thru Rails Uploaded File instead of Workhorse -> GitlabUploadedFile
Prepared a video for this: bandicam_2020-06-30_10-34-51-085.mp4
Results of GitLab environment info
System information
System: Ubuntu 16.04
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.6.6p146
Gem Version: 2.7.10
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version: 5.0.9
Git Version: 2.27.0
Sidekiq Version:5.2.7
Go Version: unknown
GitLab information
Version: 13.1.0-ee
Revision: 1fa237df2f4
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 11.7
URL: http://gitlab.example.vm
HTTP Clone URL: http://gitlab.example.vm/some-group/some-project.git
SSH Clone URL: [email protected]:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: saml
GitLab Shell
Version: 13.3.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Git: /opt/gitlab/embedded/bin/git
Impact
Bypass EXIF tag filtering
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
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
Likely the EXIF filtering was only implemented in the Workhorse component, and the API endpoint using the full project path bypassed Workhorse, processing the upload directly in Rails without filtering.
Impact
The EXIF tag filtering could be bypassed, allowing images with metadata to be uploaded and potentially revealing sensitive information.
What the attacker needed
Access to the wiki attachments API; a JPEG image with EXIF tags
How it was found
- Prepare a JPEG image that contains EXIF tags.
- Obtain the project's full path and URL-encode the slash character.
- Send a POST request to the wiki attachments API using the encoded full path and include the image file.
- Retrieve the uploaded file's URL from the API response and append it to the wiki page URL.
- Inspect the file's properties to confirm that the EXIF tags are 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 tags, like the location where it was taken. GitLab normally removes these tags for privacy, but the researcher found a way to upload images through a different path that skipped this removal. This meant private information could remain in the uploaded image.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.