Skip to content
DoS Disclosed report Intermediate

DOS scenario leveraging the Ceylon block in markdown preview

A regular expression denial of service (ReDoS) vulnerability exists in the Ceylon syntax highlighter of the Rouge Ruby gem, which is used in GitLab's markdown preview. An attacker could cause high CPU load and denial of service by submitting crafted markdown containing a Ceylon code block with a long string of backticks.

GitLab

Originally disclosed on GitLab

  • Fixed in 36 days
  • Disclosed after 36 days

HackerOne report #1403892 by slaydesays on 2021-11-18, assigned to @dcouture:

Report | How To Reproduce

Report

Summary

In https://hackerone.com/reports/1283484, a ReDoS was reported in the ruby gem "rouge". The Factor and class and GHC Core class have been addressed in rogue version 3.26.1 but the ceylon class remains unfixed.

https://github.com/rouge-ruby/rouge/blob/v3.26.1/lib/rouge/lexers/ceylon.rb#L54

Steps to reproduce

A high CPU load can be caused using the following code in a wiki page:

```ceylon  
"````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````  
```  

See more details on how to reproduce in thread below: https://gitlab.com/gitlab-org/gitlab/-/issues/347277#note_754132724

Use htop to monitor CPU.

Results of GitLab environment info

System information
System: Ubuntu 18.04
Current User: git
Using RVM: no
Ruby Version: 2.7.4p191
Gem Version: 3.1.4
Bundler Version:2.1.4
Rake Version: 13.0.6
Redis Version: 6.0.16
Git Version: 2.33.0.
Sidekiq Version:6.2.2
Go Version: unknown

GitLab information
Version: 14.4.1
Revision: 1a23d731c9f
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 12.7

Impact

Continuous requests to e.g. create and preview specially crafted markdown/wiki pages can result in a high CPU load and cause a denial of service.

How To Reproduce

Please add reproducibility information to this section:

Backport Task

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 regular expression in the Ceylon lexer of the Rouge gem is vulnerable to catastrophic backtracking when processing a long sequence of backticks, leading to excessive CPU consumption.

Impact

Continuous requests to create and preview specially crafted markdown/wiki pages can result in a high CPU load and cause a denial of service.

What the attacker needed

Ability to create or edit wiki pages; ability to preview markdown

How it was found

  1. Create or edit a wiki page in GitLab.
  2. Insert a code block marked as Ceylon containing a long string of backticks.
  3. Preview the page, causing the markdown to be rendered.
  4. Observe high CPU usage using a monitoring tool like htop.

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.

This report describes a way to make a website slow down or stop working by sending it specially crafted text. The text triggers a bug in a piece of software that highlights code, causing it to use too much processing power. This is called a denial of service, because legitimate users can no longer use 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.