Project Snippets set to `Only Project Members` visibility can be leaked through cache
Snippet raw pages from a private project with 'Only Project Members' visibility were cached by Cloudflare, allowing an attacker to view the content for up to 60 seconds after it was changed. An attacker could repeatedly refresh the cached page to monitor snippet changes.
GitLab
Originally disclosed on GitLab
- Fixed in 23 months
- Disclosed after 23 months
HackerOne report #1121308 by shells3c on 2021-03-09, assigned to @dcouture:
Report | How To Reproduce
Report
Summary
In spite of setting the Snippets permission to Only Project Members, the raw pages of snippets from that project are still getting cached by Cloudflare, lead to a possibility of leakage
Steps to reproduce
- In a private project, go to the Settings page, set Snippets to Only Projects Members
- Create a public snippet in that project
- Now click on Open raw
- After opened the raw, go back to the snippet, and edit it (do anything you want)
- Now from an incognito window, open the raw link, you should able to see the content of the snippet before it got changed. This will only be available for 60 seconds, because that is the cache expiration period.
The attacker can create an auto script to refresh the page after every 59 secs and keep monitoring the snippet and its changes. (The attacker needs to know the snippet ID, they might have it before the Snippets setting changed, or by anyway else)
Output of checks
This bug happens on GitLab.com
Impact
Possible to leak snippets in an Only Project Members project
How To Reproduce
Please add reproducibility information to this section:
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 raw snippet endpoint did not set cache-control headers to prevent caching, so Cloudflare cached the response.
Impact
An attacker who knows the snippet ID could view the cached content of a snippet from a private project for up to 60 seconds after it was changed, and could automate refreshing to monitor changes.
What the attacker needed
Attacker knows the snippet ID; snippet is in a project with 'Only Project Members'…; attacker can access the raw URL
How it was found
- In a private project, set Snippets visibility to 'Only Project Members'.
- Create a public snippet in that project.
- Click 'Open raw' to view the raw snippet.
- Edit the snippet.
- In an incognito window, open the raw link to see the old cached content.
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 a web page is cached, a copy is stored so it loads faster for everyone. Here, a private snippet's raw page was cached by Cloudflare, so even after the snippet was edited, the old version remained visible to anyone who knew the link for up to a minute. This means private information could be seen by unauthorised people.
What is Cache bugs?
A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.