DoS vulnerability with the task description field of issue
The task description preview function in GitLab is vulnerable to a server-side denial of service because certain inputs cause excessive CPU and memory consumption in the markdown rendering library. An attacker could repeatedly submit such inputs to exhaust server resources.
GitLab
Originally disclosed on GitLab
- Fixed in 48 days
- Disclosed after 48 days
HackerOne report #1798711 by onmouseover_ on 2022-12-09, assigned to GitLab Team:
Report | Attachments | How To Reproduce
Report
The preview function on tasks ( issues ) has a vulnerability to server - side DOS attacks . Using certain inputs causes CPU burn and consumes server resources ( 6000ms according to logs in /var/log/gitlab/gitlab-rails/production.log )
Rack::Timeout::RequestTimeoutException: this is raised when a request has run for longer than the specified timeout. This descends fromException, not fromRack::Timeout::Error(it has to be rescued from Explicitly). It's raised by the rack-timeout timer thread in the application thread, at the point in the stack the app happens to be in when the timeout is triggered. This exception could be caught explicitly within the application, but in doing so you're working past the timeout.
When using the autolink extension, certain inputs will cause cmark-gfm to consume excessive memory and CPU.
Rack::Timeout::RequestTimeoutException (Request ran for longer than 60000ms ):
lib/banzai/filter/inline_diff_filter.rb:25:in gsub' lib/banzai/filter/inline_diff_filter.rb:25:in inline_diff_filter'
lib/banzai/filter/inline_diff_filter.rb:14:in block in call' lib/banzai/filter/inline_diff_filter.rb:10:in call'
lib/banzai/pipeline/base_pipeline.rb:23:in block (2 levels) in singleton class' lib/banzai/renderer.rb:130:in render_result'
lib/banzai/renderer.rb:166:in cacheless_render' lib/banzai/renderer.rb:30:in render'
lib/banzai/renderer.rb:120:in block in cache_collection_render' lib/banzai/renderer.rb:119:in each'
lib/banzai/renderer.rb:119:in cache_collection_render' lib/banzai/reference_extractor.rb:33:in html_documents'
lib/banzai/reference_extractor.rb:18:in references' lib/gitlab/reference_extractor.rb:23:in references'
lib/gitlab/reference_extractor.rb:42:in block (2 levels) in <class:ReferenceExtractor>' app/services/preview_markdown_service.rb:33:in find_user_references'
app/services/preview_markdown_service.rb:6:in execute' app/controllers/concerns/preview_markdown. rb:8:in preview_markdown'
app/controllers/application_controller.rb:530:in set_current_admin' lib/gitlab/session.rb:11:in with_session'
app/controllers/application_controller.rb:521:in set_session_storage' lib/gitlab/i18n.rb:107:in with_locale'
lib/gitlab/i18n.rb:113:in with_user_locale' app/controllers/application_controller.rb:515:in set_locale'
app/controllers/application_controller.rb:509:in set_current_context' lib/gitlab/metrics/elasticsearch_rack_middleware.rb:16:in call'
lib/gitlab/middleware/memory_report.rb:13:in call' lib/gitlab/middleware/speedscope.rb:13:in call'
lib/gitlab/database/load_balancing/rack_middleware.rb:23:in call' lib/gitlab/middleware/rails_queue_duration.rb:33:in call'
lib/gitlab/metrics/rack_middleware.rb:16:in block in call' lib/gitlab/metrics/web_transaction.rb:46:in run'
lib/gitlab/metrics/rack_middleware.rb:16:in call' lib/gitlab/jira/middleware.rb:19:in call'
lib/gitlab/middleware/go.rb:20:in call' lib/gitlab/etag_caching/middleware.rb:21:in call'
lib/gitlab/middleware/query_analyzer.rb:11:in block in call' lib/gitlab/database/query_analyzer.rb:37:in within'
lib/gitlab/middleware/query_analyzer.rb:11:in call' lib/gitlab/middleware/multipart.rb:173:in call'
lib/gitlab/middleware/read_only/controller.rb:50:in call' lib/gitlab/middleware/read_only.rb:18:in call'
lib/gitlab/middleware/same_site_cookies.rb:27:in call' lib/gitlab/middleware/handle_malformed_strings.rb:21:in call'
lib/gitlab/middleware/basic_health_check.rb:25:in call' lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in call'
lib/gitlab/middleware/request_context.rb:21:in call' lib/gitlab/middleware/webhook_recursion_detection.rb:15:in call'
config/initializers/fix_local_cache_middleware.rb:11:in call' lib/gitlab/middleware/compressed_json.rb:26:in call'
lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in call' lib/gitlab/middleware/sidekiq_web_static.rb:20:in call'
lib/gitlab/metrics/requests_rack_middleware.rb:77:in call' lib/gitlab/middleware/release_env.rb:13:in call'
#### Impact
In server-side DOS, unauthenticated callers can consume server resources continuously causing memory to be over-consumed by 100%.
## Attachments
**Warning:** Attachments received through HackerOne, please exercise caution!
* [pyld.txt](https://h1.sec.gitlab.net/a/64f548b2-bd5e-4e55-a8fe-dd6d03001ba4/pyld.txt)
* [dos_task.mp4](https://h1.sec.gitlab.net/a/34b767df-468d-444b-806c-80ca68910851/dos_task.mp4)
## How To Reproduce
Please add [reproducibility information] to this section:
1.
1.
1.
[reproducibility information]: https://about.gitlab.com/handbook/engineering/security/#reproducibility-on-security-issues
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 markdown rendering library (cmark-gfm) with the autolink extension has a performance issue when processing certain patterns, leading to excessive resource consumption.
Impact
An attacker could cause a denial of service by consuming server resources, potentially making the application unavailable.
What the attacker needed
Ability to create an issue; ability to preview task description
How it was found
- Create an issue.
- Click add on the task and give it a free title.
- Click the task, then paste the payload in the description.
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.
A denial-of-service (DoS) attack aims to make a service unavailable by overwhelming it with resource-intensive requests. Here, a specially crafted input to a task description preview causes the server to use a lot of CPU and memory, potentially slowing down or crashing the application for other users.
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.