Skip to content
CSRF Disclosed report Beginner

CSRF (protection bypassed) to force a below 18 user into viewing an nsfw subreddit !

A state-changing POST request to the over-18 preference endpoint lacked a proper modhash validator, so it was vulnerable to cross-site request forgery. An attacker could trick a logged-in user into toggling the adult-content preference and viewing NSFW subreddits.

marvelmaniac Follow

Originally disclosed on HackerOne

Medium 5.0 View original
  • Triaged in under an hour
  • Fixed in 4 months
  • Paid in 5 hours
  • Disclosed after 4 months

Summary by the program

Summary of the Issue

A state-changing POST request to https://old.reddit.com/over18? lacked proper modhash validator leaving the sensitive action vulnerable to CSRF attacks. An attacker can trick users into executing the action, enabling/disabling "I am over eighteen years old" and willing to view adult content preference in the victim account.

#Steps to reproduce

  1. Create a reddit account and go to https://old.reddit.com/prefs/
  2. Scroll down and you'll see an option saying I am over eighteen years old and willing to view adult content. Turn that off.
  3. Visit nsfw subreddit https://www.reddit.com/r/<nsfw_subreddit_here> and you'll see a window asking if you want to see nsfw content.
  4. Open html file of html content shown below
  5. Settings will get updated and you'll be able to view nsfw content. In other words you'll be able to view https://www.reddit.com/r/<nsfw_subreddit_here>
<html>
  <body>
    <form action="https://old.reddit.com/over18?dest=https%3A%2F%2Fold.reddit.com%2Fr%2F<nsfw_subreddit_here>%2F" method="POST">
      <input type="hidden" name="over18" value="yes" />
      <input type="submit" value="Submit request" />
    </form>
    <script>
      document.forms[0].submit();
    </script>
  </body>
</html>

The original report as published on HackerOne, by marvelmaniac. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the over-18 preference endpoint accepted POST requests without validating the modhash (Reddit's per-session CSRF token), so any origin could submit the state change.

Impact

An attacker could force a logged-in victim's account to toggle the adult-content preference, enabling viewing of NSFW content; no further compromise is claimed.

What the attacker needed

Victim has a Reddit account; victim is logged in; victim opens attacker's page or link

How it was found

  1. Create a Reddit account and open the preferences page.
  2. Turn off the over-18 adult content option.
  3. Visit an NSFW subreddit to confirm the age prompt appears.
  4. Open a local HTML file containing an auto-submitting form to the over-18 endpoint.
  5. Observe that the preference is updated and the NSFW subreddit becomes viewable.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you are logged in to a site, your browser automatically sends your session cookie with every request to that site. If a site accepts a change (like a preference toggle) without also checking a secret token that only its own pages know, another website can make your browser send that change for you. This is called cross-site request forgery, or CSRF.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

More by marvelmaniac

View all

5 more disclosed reports, best first.

More from Reddit

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.