# CVE-2024-41990: Potential denial-of-service in django.utils.html.urlize()

Django's urlize() template filter runs in superlinear time on repeated '.;' sequences, letting large user input cause denial-of-service.

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

**Target:** django.utils.html.urlize() / urlizetrunc() template filters
**Root cause:** urlize() processes repeated '.;' character sequences with superlinear (exponential) complexity, so runtime grows disproportionately with input length.
**Steps:**
1. Call `django.utils.html.urlize('.;' * n)` for increasing n
2. Observe runtime scaling from ~0.5s at 80k chars to ~106s at 1.04M chars
3. Feed a large user-controlled string (POST body or stored DB value) into urlize/urlizetrunc without length limits
**How found:** Researcher noticed a slow pattern in urlize with repeated '.;' characters and benchmarked scaling across input sizes to confirm exponential/superlinear growth.
**Exploitation:** Attacker submits a large string of repeated '.;' via a POST parameter or stores it in the database; when the application renders it through urlize()/urlizetrunc(), the worker spends excessive CPU time, degrading availability.
**Insight:** Regex/URL-detection helpers with backtracking or repeated scanning can blow up on adversarial punctuation sequences like '.;' — benchmark template filters with pathological inputs, not just typical URLs.

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

**Python PoC timing urlize on repeated '.;' payload**

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

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

