# DOS via move_issue

Crafted issue description with repeated markdown image syntax triggers catastrophic backtracking in GitLab's uploads rewriter regex during issue move, burning CPU for 60s per request.

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

**Target:** GitLab issue move endpoint / GFM UploadsRewriter
**Root cause:** FileUploader::MARKDOWN_PATTERN uses a polynomial-complexity Ruby regex with lazy quantifiers and optional groups; scanning attacker-controlled description causes catastrophic backtracking.
**Steps:**
1. Authenticate as any user able to create issues and move them between projects.
2. Create an issue whose description is generated by `python -c "print('![l' * 100000 + '\n')"`.
3. Move the issue to another project via the UI/API.
4. Observe request hangs until 60s timeout while a CPU core is saturated; parallelize across issues to exhaust CPUs.
**How found:** Researcher inspected the uploads rewriter code path invoked on issue move, spotted the lazy-quantifier regex `\!?\[.*?\]\(/uploads/(?<secret>[0-9a-f]{32})/(?<file>.*?)\)` and recognized polynomial complexity, then crafted input to trigger backtracking.
**Exploitation:** Any self-registered user on GitLab.com creates many issues with the crafted description and triggers move_issue repeatedly/in parallel; each request pins a CPU for the timeout window, and enough parallel requests render the instance unavailable.
**Escalation:** Parallel requests across multiple issues/CPUs escalate single-core burn into full instance DoS; on DockerHub image the whole server becomes unavailable.
**Insight:** Issue-move and other cross-project operations re-scan user text through GFM uploads rewriting; audit any `scan`/`match` on user-controlled markdown with lazy `.*?` and optional groups for ReDoS, and test via state-changing endpoints that reprocess stored content.

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

**Python script generating crafted issue description**

```
python -c "print('![l' * 100000 + '\n')"
```

