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.
- 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_comment" />
<input type="hidden" name="submit" value="Post Comment" />
<input type="hidden" name="comment_post_ID" value="29" />
<input type="hidden" name="comment_parent" value="0" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
Video poc:
Impact
Attacker make victim comments on a post.
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
- The attacker prepares a page containing a form that posts to the site's comment endpoint with a chosen comment body and post ID.
- The attacker sends the link to a logged-in victim.
- The victim opens the link and submits the form, which posts to the comment endpoint.
- 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.