# Deleting all DMs on RedditGifts.com

Missing ownership check on DELETE /api/v1/messages/<id>/ let any authenticated user delete any private message by ID, exposing all 4.4M DMs to mass deletion.

- Payout: $5,000
- Severity: high
- Program: Reddit
- Found by: hakercic
- Disclosed: 2021-10-21
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1213237
- Library page: https://bugbountylibrary.com/r/h1%3A1213237
- Tags: area:web domain:api domain:web impact:data-leak impact:integrity kind:bounty platform:hackerone sev:high tech:rest technique:recon vuln:access-control vuln:idor

**Target:** RedditGifts.com REST API endpoint DELETE /api/v1/messages/{id}/
**Root cause:** The message-delete endpoint authorized the request via CSRF token and session but never verified the requesting user owned the message, so any valid session could delete arbitrary message IDs.
**Steps:**
1. Create three accounts: FriendA, FriendB, Attacker.
2. FriendA sends a message to FriendB, note its message ID.
3. As Attacker, send `DELETE /api/v1/messages/4423007/ HTTP/1.1` to www.redditgifts.com with Attacker's `csrftoken`/`sessionid` cookies and matching `X-CSRFTOKEN` header.
4. Observe the message is deleted despite Attacker not being sender or recipient.
5. Iterate the numeric ID to delete other users' messages.
**How found:** Tester set up multiple accounts to test cross-user access on the message API and noticed the DELETE endpoint accepted a message ID not belonging to the attacker.
**Exploitation:** Authenticated attacker replays the DELETE request with their own session and CSRF token, substituting sequential message IDs to delete messages belonging to other users; no ownership check blocks it, enabling deletion of all 4.4M messages.
**Escalation:** Sequential numeric IDs allow mass deletion across the entire message store rather than a single target.
**Insight:** On REST APIs with numeric resource IDs, test state-changing verbs (DELETE/PUT/PATCH) across accounts, not just GET; CSRF tokens prove session validity but not object ownership.

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

**DELETE request deleting another user's message by ID**

```
DELETE /api/v1/messages/4423007/ HTTP/1.1
Host: www.redditgifts.com
X-CSRFTOKEN: rYxQcijrs6viZxyLZt2os9gNvLgmEeXfSrH5wOe10GcOg3ABOvL3ebDbAXmeXojj
Referer: https://www.redditgifts.com/api/
Cookie: csrftoken=rYxQcijrs6viZxyLZt2os9gNvLgmEeXfSrH5wOe10GcOg3ABOvL3ebDbAXmeXojj; sessionid=osymp6sp6bb83gyt8of7qbeurtuo2450
```

