# CVE-2024-45230 - Potential denial-of-service in django.utils.html.urlize() (Another pattern)

django.utils.html.urlize() had quadratic time complexity on inputs of '&' followed by repeated ';:' pairs, enabling CPU-exhaustion DoS on large user strings.

- Payout: $2,162
- Severity: medium
- Program: Internet Bug Bounty
- Found by: mprogrammer
- Disclosed: 2025-02-05
- CVE: CVE-2024-45230
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/2881639
- Library page: https://bugbountylibrary.com/r/h1%3A2881639
- Tags: area:web domain:web impact:dos kind:bounty platform:hackerone sev:medium tech:python technique:fuzzing technique:regression vuln:dos

**Target:** django.utils.html.urlize() / urlizetrunc()
**Root cause:** urlize's URL-detection regex/scanning exhibits super-linear (quadratic) behavior on a specific character sequence ('&' followed by repeated ';:'), so runtime grows with input length squared.
**Steps:**
1. Call `django.utils.html.urlize('&' + ';:' * n)` for increasing n
2. Observe runtime scaling quadratically (e.g. ~187s at n=1040002)
3. Feed a large attacker-controlled string containing this pattern into any endpoint that urlizes user content
**How found:** Followed up on a prior urlize DoS report (HackerOne 2795558) and hypothesized other character sequences trigger pathological regex behavior; tried an ampersand beside repeated ';:' and benchmarked runtime vs input length.
**Exploitation:** Attacker submits a large string of '&' + ';:'*n to an application that passes user content through urlize/urlizetrunc without length limits, consuming CPU and degrading or denying service.
**Insight:** When a prior ReDoS/complexity bug is fixed in a regex-based sanitizer, fuzz adjacent delimiter/separator characters (';', ':', '&') against the same function to find sibling pathological patterns the fix missed.

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

**Python PoC timing urlize with ampersand and repeated ;:**

```
import django.utils.html
from time import time

print("=== django.utils.html.urlize('&' + ';:' * n) ===")
for i in range(0,600000, 40000):
    start = time()
    pattern = ';:'
    PAYLOAD = '&' + pattern * i
    django.utils.html.urlize(PAYLOAD)
    print(len(PAYLOAD), "\t", time() - start)
input("")
```

