# DOS via issue preview

Crafted issue description with repeated image-markdown tokens causes quadratic CPU burn in GitLab's markdown preview renderer, exhausting CPUs and DoSing the instance.

- Payout: $7,640
- Severity: high
- Program: GitLab
- Found by: legit-security
- Disclosed: 2022-11-04
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/1543718
- Library page: https://bugbountylibrary.com/r/h1%3A1543718
- Tags: area:web domain:web impact:dos kind:bounty platform:hackerone sev:high tech:ruby technique:fuzzing technique:source-review vuln:dos

**Target:** GitLab markdown preview (preview_markdown API / issue description renderer, Banzai ReferenceExtractor)
**Root cause:** cache_collection_render in Banzai's reference extractor scales super-linearly with many repeated reference-like tokens (e.g. `![l`), so a maximal-size description triggers ~60s of CPU per request.
**Steps:**
1. Authenticate as any user able to create issues/preview markdown.
2. Generate payload: `python -c "print('![l' * int(1048576 / 3 - 1) + '\n')"`.
3. Submit as issue description and hit Preview, or POST to the preview_markdown API endpoint.
4. Observe request times out at 60s while a CPU core is saturated; parallelize requests to burn multiple cores.
**How found:** Researcher inspected the markdown preview code path, noticed `analyze` accumulates `texts_and_contexts` and `cache_collection_render` is invoked in ReferenceExtractor, then hypothesized repeated reference-like tokens would blow up render cost and confirmed via crafted maximal-size input.
**Exploitation:** Send many parallel preview_markdown requests each carrying the maximal repeated-token payload; each pins a CPU for the timeout window, and enough concurrent requests exhaust all cores, making the instance unavailable.
**Escalation:** Parallelizing requests scales single-core burn to full-server DoS; on GitLab.com this opens DDoS potential.
**Insight:** Markdown/reference renderers often have super-linear cost per repeated reference token; fuzz preview endpoints with maximal-length inputs of repeated link/image/reference syntax to find quadratic CPU paths.

## Proof of concept (copied exactly from the original report)

**Python one-liner generating malicious issue description**

```
python -c "print('![l' * int(1048576 / 3 - 1) + '\n')"
```

