Getting access of mod logs from any public or restricted subreddit with IDOR vulnerability
The GraphQL endpoint for moderator logs did not verify that the requesting user was a moderator of the target subreddit. An attacker with any account could supply an arbitrary subreddit name and read that subreddit's moderation logs, paging through all entries.
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 3 hours
- Paid in 2 hours
- Disclosed after 26 hours
Summary:
There's no check if the user is moderator of the particular subreddit or not while trying to access the mod logs via gql.reddit.com by using operation id. You can change the parameter subredditName to any target subreddit name which is public or restricted and get access to mod logs of that subreddit.
Steps To Reproduce:
- Log into any account as an attacker and get the authorization token
- Send request given below at gql.reddit.com
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"}}
The response will look something like below

- It only gives one page of logs.Look at the response and see if the value of hasNextPage is true or false. If It's false then there are no more logs other than the ones we got
- If it's true then there are more logs and we can get them by just adding new variable after and assigning value of endCursor, which we can see in the reponse body of our request

endCursorCode.png From the original on HackerOne - Final request body will look something like this
{"id":"6243efcbc61d","variables":{"subredditName":"any-subreddit",
"after":"code-from-endCursor"
}}
- After sending the request we'll get second page of logs. If we still get hasNextPage as true, Keep doing this untill we see hasNextPage set to false in the response. by doing this we can get all the pages of mod logs one by one.
Use this script to make things easier in confirming this vulnerability (F1851561) The output will get stored in mod_log_out.txt in the same directory
- [attachment / reference]
F1851522 F1851533 F1851561
Impact
Confidential information getting exposed.
Context
Reddit's web client talks to a GraphQL endpoint at gql.reddit.com. The client sends operations identified by an id rather than by a query string, so the request body carries an operation id plus a variables object. One of those operations returns the moderation log of a subreddit, and it takes the subreddit name as a variable called subredditName.
Moderation logs are private to a subreddit's moderator team. They record moderator actions, and the report treats their contents as confidential information. The feature under test is the operation that fetches those logs, page by page, through cursor based pagination.
Setup
Only an ordinary account is needed. The researcher logs in as an attacker controlled user and takes the authorisation token that the client uses for gql.reddit.com. No moderator role on the target subreddit is required, and the target can be any public or restricted subreddit. The tooling is a client capable of sending a POST to gql.reddit.com with a custom JSON body, plus the script the researcher referenced for confirming the issue.
Finding it
The operation that returns mod logs accepts subredditName as a client supplied variable. Nothing in the request ties that variable to the identity of the caller, so the researcher could substitute the name of a subreddit they do not moderate and still receive that subreddit's logs. The check for whether the caller is a moderator of the named subreddit is missing on the server side, which makes the parameter a direct object reference into another tenant's data.
Exploitation
Step 1: obtain a token
Log into any account as an attacker and get the authorisation token. The token is sent as a bearer credential in the Authorization header.
Step 2: send the mod log request
The request below is sent to gql.reddit.com. The operation id 6243efcbc61d selects the mod log operation, and subredditName is set to the target subreddit.
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"}}
The body is the whole attack surface: an operation id and a single variable. Replace any-subreddit with the name of the subreddit whose logs you want. The Authorization header carries the attacker's own token, which is enough because the server never checks that this user moderates the named subreddit. The response contains a page of moderation log entries for the target subreddit.

The screenshot shows the response body returned for this request, including the log entries and the pagination fields used in the next step.
Step 3: read the pagination state
The first response only gives one page of logs. Look at the response and see whether the value of hasNextPage is true or false. If it is false, there are no more logs beyond the ones already received.
Step 4: fetch further pages with the cursor
If hasNextPage is true, more logs exist. They are retrieved by adding a new variable called after and assigning it the value of endCursor, which is visible in the response body of the previous request.

The screenshot shows the endCursor value in the response, which is the cursor copied into the next request.
Step 5: send the paged request
The final request body looks like this:
{"id":"6243efcbc61d","variables":{"subredditName":"any-subreddit",
"after":"code-from-endCursor"
}}
Sending it returns the second page of logs. If hasNextPage is still true, repeat the process until the response sets hasNextPage to false. This way every page of the mod log can be collected one by one.
Step 6: automate the collection
The report includes a script for making confirmation easier, referenced as F1851561. Its output is stored in mod_log_out.txt in the same directory. The script itself is only referenced as an attachment in the report, so its contents are not reproduced here.
The report also lists F1851522 and F1851533.
Root cause
The GraphQL operation that returns moderation logs resolves the subreddit from the subredditName variable and returns the log without verifying that the authenticated caller is a moderator of that subreddit. Because the operation is addressed by a fixed id and the only per target input is a name the client controls, any authenticated user can point the same operation at any public or restricted subreddit. The missing authorisation check is on the server side; the client side restriction that normally hides the feature from non moderators does nothing, since the request can be replayed directly.
Impact
Confidential information is exposed. An attacker with any account can read the moderation logs of any public or restricted subreddit, page by page, without being a moderator there. The report does not enumerate which fields of the log become visible or quantify how far back the history goes; it states the exposure of confidential information as the impact.
Fix
The report does not describe the fix that was applied.
Variants to test
- Other operations on the same GraphQL endpoint that take a subreddit or community name as a variable. A positive result is a response containing that community's private data while authenticated as a non member.
- Operations that take an object identifier rather than a name, such as a moderator action id or a report id. A positive result is data belonging to a subreddit you do not moderate.
- Pagination cursors reused across accounts or across subreddits. A positive result is a page of results returned for a subreddit the caller has no role in.
- Restricted and private subreddits as targets, to see whether the missing check extends past public communities. A positive result is any log entry returned for a community the caller cannot access through the UI.
Hunting notes
GraphQL endpoints that address operations by a fixed id are a good place to look, because the client visible query is replaced by an opaque identifier and the variables become the only input a tester needs to manipulate. Watch for operations whose variables include a tenant, community or owner name, and compare what the UI shows a low privileged user with what the endpoint returns when that variable is changed. Pagination fields such as hasNextPage and endCursor are worth following, since a missing check on the first page is often missing on subsequent ones too.
The researcher provided a script that stores the output in mod_log_out.txt, and described walking the pagination until hasNextPage is false.
What happened, in plain words
Reddit is a website where people gather in topic based communities called subreddits. Each subreddit has a small team of moderators who keep it tidy: they remove posts, ban users, approve things and so on. Every action a moderator takes is written down in a private diary called the moderation log, or mod log. Only that subreddit's moderators are supposed to be able to read it.
This report shows that the diary was not actually locked. Any logged in Reddit user, with no moderator role at all, could ask Reddit's servers for the mod log of any public or restricted subreddit and get it back, page by page. The researcher found this by noticing that the request which fetches the log takes the subreddit name as a value the client supplies, and the server never checks whether the person asking is a moderator of that subreddit.
A useful comparison: imagine a hotel where the receptionist hands out room keys. You ask for the key to room 101 and get it, because the receptionist only checks that you are a guest, not that room 101 is yours. Change the room number in your request and you get someone else's key. Here the "room number" is the subreddit name.
This kind of flaw has a name: Insecure Direct Object Reference, or IDOR. It means the application lets you point at a specific object (a record, a file, a room) by an identifier you control, and forgets to check that you are allowed to touch that particular object.
Background you need
What an API is
When you use Reddit in a browser, the pages you see are built from data that your browser fetches from Reddit's servers in the background. Those background conversations happen through an API (Application Programming Interface): a set of addresses on a server that accept requests and return data, usually in a machine friendly format rather than a web page. Think of it as the serving hatch between the dining room (your browser) and the kitchen (Reddit's servers): you do not go into the kitchen, you pass a note through the hatch and food comes back.
What GraphQL is
Reddit's web client talks to an API endpoint at gql.reddit.com. This endpoint speaks GraphQL, a way of asking a server for exactly the data you want. In a classic API you call different addresses for different things. In GraphQL there is usually one address, and the request body says which operation you want and what inputs to use.
Normally a GraphQL request contains the query text itself. Reddit's client does something slightly different: it sends operations identified by an id rather than by a query string. So the request body carries an operation id plus a variables object. The id is like a menu number: "give me dish 6243efcbc61d", and the variables are the choices you make about that dish, such as which subreddit you mean. One of those operations returns the moderation log of a subreddit, and it takes the subreddit name as a variable called subredditName.
What a token is
When you log in, the server gives your browser a credential that proves who you are on every later request, so you do not have to type your password again for each click. That credential is often called a token (or a session cookie). It is sent along with requests, usually in a header called Authorization, and the server uses it to work out which account is asking. In this report the token is a bearer token: whoever holds it is treated as the account it belongs to, like a wristband at an event.
What the mod log feature does
Moderation logs are private to a subreddit's moderator team. They record moderator actions, and the report treats their contents as confidential information. The feature under test is the operation that fetches those logs, page by page, through cursor based pagination. Pagination means the server does not send everything at once; it sends one page of results and a marker telling you how to ask for the next page. That marker is called a cursor.
Setting up
Only an ordinary account is needed. The researcher logs in as an attacker controlled user and takes the authorisation token that the client uses for gql.reddit.com. No moderator role on the target subreddit is required, and the target can be any public or restricted subreddit.
The tooling is a client capable of sending a POST to gql.reddit.com with a custom JSON body, plus the script the researcher referenced for confirming the issue. A proxy here simply means a tool that sits between your browser and the server so you can look at, and change, the requests before they go out. You do not need to write any code to follow the steps below; you need a way to send a hand written request.
Finding it
The operation that returns mod logs accepts subredditName as a client supplied variable. Nothing in the request ties that variable to the identity of the caller, so the researcher could substitute the name of a subreddit they do not moderate and still receive that subreddit's logs. The check for whether the caller is a moderator of the named subreddit is missing on the server side, which makes the parameter a direct object reference into another tenant's data. "Tenant" here just means another group of users whose data should be kept separate from yours.
In other words: the website hides the mod log button from people who are not moderators, but hiding a button is not a lock. The request behind the button can be sent by hand, and the server answered it anyway.
Exploitation
Step 1: obtain a token
Log into any account as an attacker and get the authorisation token. The token is sent as a bearer credential in the Authorization header. This step exists because the server needs to know who is asking; the point of the attack is that it accepts a completely ordinary account.
Step 2: send the mod log request
The request below is sent to gql.reddit.com. The operation id 6243efcbc61d selects the mod log operation, and subredditName is set to the target subreddit.
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"}}
Line by line, in plain words:
POST / HTTP/2is the method and path.POSTmeans "I am sending data to the server", and/is the root path of the host.HTTP/2is the version of the web protocol being used.Host: gql.reddit.comsays which server the request is for. This is the GraphQL endpoint.User-Agent: ...tells the server which browser and operating system the request claims to come from. Here it claims to be Firefox on Linux. Servers often use this for statistics; it is not a security control.Accept: */*means "I will accept any kind of response".Accept-Language: en-US,en;q=0.5says the client prefers US English, with a lower preference for generic English.Accept-Encoding: gzip, deflatesays the client can handle compressed responses.Content-Type: application/jsonsays the body of the request is JSON, a text format for structured data built from names and values.Content-Length: 62is the size of the body in bytes, so the server knows where the body ends.X-Reddit-Compression: 1is a Reddit specific header; the report does not explain what it does.Origin: https://www.reddit.comtells the server which site the request is coming from. Browsers add this automatically for cross site requests.Sec-Fetch-Dest: empty,Sec-Fetch-Mode: corsandSec-Fetch-Site: same-siteare browser supplied hints about the kind of request this is.corsrelates to cross origin resource sharing, the rules for one site asking another site's server for data.Authorization: Bearer ourtokenis the credential from step 1.Bearermeans "the holder of this token is the user". In a real test you would paste your own token here; it is shown asourtokenin the report.Referer: https://www.reddit.com/says which page the request was made from.Te: trailerstells the server the client can accept trailing headers, extra metadata sent after the body.- The blank line separates the headers from the body.
- The body
{"id":"6243efcbc61d","variables":{"subredditName":"any-subreddit"}}is the whole attack surface: an operation id and a single variable.idpicks the mod log operation.variablesholds the inputs, andsubredditNameis the name of the subreddit whose logs you want.
Replace any-subreddit with the name of the subreddit whose logs you want. The Authorization header carries the attacker's own token, which is enough because the server never checks that this user moderates the named subreddit. The response contains a page of moderation log entries for the target subreddit.

The screenshot shows the response body returned for this request, including the log entries and the pagination fields used in the next step.
Step 3: read the pagination state
The first response only gives one page of logs. Look at the response and see whether the value of hasNextPage is true or false. If it is false, there are no more logs beyond the ones already received. hasNextPage is simply a yes or no answer from the server to the question "is there another page after this one?".
Step 4: fetch further pages with the cursor
If hasNextPage is true, more logs exist. They are retrieved by adding a new variable called after and assigning it the value of endCursor, which is visible in the response body of the previous request. The endCursor is the bookmark that tells the server where the page you just received ended, so it can hand you the next slice. Think of reading a book: hasNextPage tells you whether there is more, and endCursor is the page number you left off at.

The screenshot shows the endCursor value in the response, which is the cursor copied into the next request.
Step 5: send the paged request
The final request body looks like this:
{"id":"6243efcbc61d","variables":{"subredditName":"any-subreddit",
"after":"code-from-endCursor"
}}
Line by line:
idis the same operation id as before, so the server runs the same mod log operation.subredditNameis still the target subreddit, unchanged.afteris the new variable. Its value is theendCursorstring copied from the previous response, shown here ascode-from-endCursor.
Sending it returns the second page of logs. If hasNextPage is still true, repeat the process until the response sets hasNextPage to false. This way every page of the mod log can be collected one by one.
Step 6: automate the collection
The report includes a script for making confirmation easier, referenced as F1851561. Its output is stored in mod_log_out.txt in the same directory. The script itself is only referenced as an attachment in the report, so its contents are not reproduced here.
The report also lists F1851522 and F1851533.
Root cause
The GraphQL operation that returns moderation logs resolves the subreddit from the subredditName variable and returns the log without verifying that the authenticated caller is a moderator of that subreddit. Because the operation is addressed by a fixed id and the only per target input is a name the client controls, any authenticated user can point the same operation at any public or restricted subreddit.
The missing authorisation check is on the server side; the client side restriction that normally hides the feature from non moderators does nothing, since the request can be replayed directly. "Resolver" is the part of a GraphQL server that actually fetches the data for a field in the request.
Impact
Confidential information is exposed. An attacker with any account can read the moderation logs of any public or restricted subreddit, page by page, without being a moderator there. The report does not enumerate which fields of the log become visible or quantify how far back the history goes; it states the exposure of confidential information as the impact.
Fix
The report does not describe the fix that was applied.
Variants to test
- Other operations on the same GraphQL endpoint that take a subreddit or community name as a variable. A positive result is a response containing that community's private data while authenticated as a non member.
- Operations that take an object identifier rather than a name, such as a moderator action id or a report id. A positive result is data belonging to a subreddit you do not moderate.
- Pagination cursors reused across accounts or across subreddits. A positive result is a page of results returned for a subreddit the caller has no role in.
- Restricted and private subreddits as targets, to see whether the missing check extends past public communities. A positive result is any log entry returned for a community the caller cannot access through the UI.
Hunting notes
GraphQL endpoints that address operations by a fixed id are a good place to look, because the client visible query is replaced by an opaque identifier and the variables become the only input a tester needs to manipulate. Watch for operations whose variables include a tenant, community or owner name, and compare what the UI shows a low privileged user with what the endpoint returns when that variable is changed. Pagination fields such as hasNextPage and endCursor are worth following, since a missing check on the first page is often missing on subsequent ones too.
The researcher provided a script that stores the output in mod_log_out.txt, and described walking the pagination until hasNextPage is false. The report was rated high severity and paid a 5000 USD bounty.
Glossary
- API: a set of addresses on a server that programs and browsers use to request data, rather than web pages meant for people to read.
- GraphQL: a way of querying a server where one endpoint accepts a description of the data you want, instead of many separate addresses for different things.
- Endpoint: the specific address on a server that accepts requests, here
gql.reddit.com. - Operation id: a short identifier that tells a GraphQL server which predefined operation to run, used here instead of sending the query text.
- Variable: a named input value in a GraphQL request, such as
subredditNameorafter. - JSON: a text format for structured data made of names and values, used for request and response bodies.
- Header: extra information sent alongside a request or response, such as the credential or the content type.
- Token: a credential issued at login that proves which account is making a request, so the password is not sent every time.
- Bearer token: a token where whoever holds it is treated as the account it belongs to, like a wristband at an event.
- Authorization header: the header that carries the token to the server.
- Subreddit: a topic based community on Reddit.
- Moderator: a user with special rights over a subreddit, such as removing posts or banning users.
- Mod log (moderation log): a private record of the actions moderators have taken in a subreddit.
- IDOR (Insecure Direct Object Reference): a flaw where an application lets you name an object you should not have access to, and does not check that you are allowed to access it.
- Authorisation check: a server side test of whether the person asking is allowed to do or see the thing they asked for.
- Server side / client side: server side means the code running on Reddit's machines; client side means the code running in your browser. Only server side checks can be trusted, because the client can be bypassed.
- Pagination: splitting a long list of results into pages instead of sending everything at once.
- Cursor: a marker in a paginated response that tells the client where the current page ended, so it can ask for the next one.
hasNextPage: a response field that says whether another page of results exists.endCursor: a response field holding the cursor for the end of the current page, copied into theaftervariable to get the next page.- Resolver: the part of a GraphQL server that fetches the data for a requested field.
- Proxy: a tool that sits between your browser and a server so you can inspect and modify requests.
- Replay: sending a captured request again, possibly with changes, outside the normal browser flow.
- Tenant: a separate group of users whose data should be kept apart from other groups' data.
- CORS (cross origin resource sharing): the browser rules that govern whether one site may ask another site's server for data.
- Severity: a rating of how serious a vulnerability is, here high.
- Bounty: a payment made by a company to a researcher who reports a valid vulnerability.