DoS in Markdown preview caused by a bug in RepositoryLinkFilter
The Markdown preview's relative-link filter removes each '../' prefix by shifting the whole string, which is CPU-heavy. A small public Markdown file with many such prefixes lets a few unauthenticated requests exhaust CPU and make the GitLab instance unusable.
GitLab
Originally disclosed on GitLab
- Fixed in 15 days
- Disclosed after 15 days
⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.
HackerOne report #3517644 by maksyche on 2026-01-20, imported by @greg:
Report | Attachments | How To Reproduce
HackerOne Analyst Summary
Summary of the issue
The researcher found DoS when opening Markdown file with the large number of ../ prefixes.
Steps to reproduce
- As the attacker, use SSH port forwarding to connect victim's GDK on attacker's localhost port 3000
Note: By default, GDK is not accessible publicly. This step is used to connect target GDK from the attacker's machine, and it is not required in the real attack.
- As the attacker, sign in attacker's account on GDK, with latest commit
18.9.0-pre 39aebb0dbcd-> Create a public project -> In the project, upload dos.md:

- As the attacker, run following command to start attack -> Replace
ATTACKER_GROUP/ATTACKER_PROJECTwith attacker's group and project name:
while true; do curl -s -o /dev/null -w "%{time_total}s\n" "http://localhost:3000/ATTACKER_GROUP/ATTACKER_PROJECT/-/blob/main/dos.md?format=json&viewer=rich" & sleep 1; done
- (Optional) As the victim, check htop on GDK host machine. CPU or memory is not fully consumed:

- As the victim, try to access GitLab instance. You can see victim is not able to access it:

Impact statement
Malicious user can prevent other user from accessing the target GitLab instance.
If you have any questions or concerns about this report, feel free to assign it to H1 Triage via the action picker with a comment indicating your request.
Original Report
Hi
Summary
Current implementation of build_relative_path in repository_link_filter.rb removes the ../ prefix and shifts the whole string, which is a CPU-heavy operation. An attacker can create a small publicly accessible.md file with a huge number of these prefixes. A very small number of unauthenticated requests to read this file cause CPU overload and the instance becomes completely unusable.
Steps to reproduce
- Create a 1k-users virtual machine (I used AWS
c5.2xlarge). - Install Gitlab CE (I used Ubuntu). During the installation, I used the
http://gitlab.example.comEXTERNAL_URLwithouthttpsand updated local/etc/hoststo link the IP address of the machine and this domain. - Log into Gitlab and create a public
root/dosproject with just a README file. - Upload the file.
- Observe that when you try to preview the file, the request either fails or takes 20+ seconds to load.
- Since the project is public, you can query this file unauthenticated. Run this command from your machine to request the file every second (that's ~5% of the expected traffic for this instance type. I managed to make the instance unusable even with 1-2% of the traffic):
while true; do curl -s -o /dev/null -w "%{time_total}s\n" "http://gitlab.example.com/root/dos/-/blob/main/dos.md?format=json&viewer=rich" & sleep 1; done
- Observe that Gitlab becomes completely unusable within seconds.
Impact
A small number of unauthenticated requests can make a Gitlab instance completely unusable within seconds.
What is the current bug behavior?
The server eats all the CPU resources within seconds even with less than 5% of traffic (I tested and even 1-2% of traffic can be enough).
What is the expected correct behavior?
Prefix calculation must be optimized. Something like this:
pos = 0
while path[pos, 3] == '../'
parts.pop
pos += 3
end
path = path[pos..] || ''
Relevant logs and/or screenshots
Here's the video PoC:
Results of GitLab environment info
sudo gitlab-rake gitlab:env:info
System information
System: Ubuntu 24.04
Current User: git
Using RVM: no
Ruby Version: 3.2.8
Gem Version: 3.7.1
Bundler Version:2.7.1
Rake Version: 13.0.6
Redis Version: 7.2.11
Sidekiq Version:7.3.9
Go Version: unknown
GitLab information
Version: 18.8.1
Revision: d0311b03573
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 16.11
URL: http://gitlab.example.com
HTTP Clone URL: http://gitlab.example.com/some-group/some-project.git
SSH Clone URL: [email protected]:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 14.45.5
Repository storages:
- default: unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Gitaly
- default Address: unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 18.8.1
- default Git Version: 2.52.GIT
Impact
A small number of unauthenticated requests can make a Gitlab instance completely unusable within seconds.
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
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
The build_relative_path function removes each '../' prefix by shifting the whole string, a CPU-heavy operation.
Impact
A small number of unauthenticated requests can make a GitLab instance completely unusable within seconds, preventing other users from accessing it.
What the attacker needed
A public project with a Markdown file; the file contains many '../' prefixes; no authentication needed to request the file
The fix
The prefix calculation should be optimised so it advances through the string instead of shifting it for every prefix.
How it was found
- Set up a GitLab instance (the report used a 1k-user reference architecture on AWS).
- Log in and create a public project containing a README.
- Upload a Markdown file that contains a very large number of '../' prefixes.
- Preview the file and observe the request failing or taking 20+ seconds.
- Send repeated unauthenticated requests to the file's rich viewer JSON endpoint.
- Observe that GitLab becomes completely unusable within seconds.
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 GitLab shows a Markdown file, it rewrites relative links so they work from the file's location. The code that strips '../' from a path does a costly copy for every prefix, so a file with thousands of prefixes makes the server work very hard. Because the file is public, anyone can trigger this repeatedly without logging in and overwhelm the server.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.