Page MenuHomePhabricator

WikiForum is Vulnerable to CSRF and XSS Attacks
Closed, ResolvedPublicSecurity

Description

WikiForum lacks anti-CSRF mechanism and is thus vulnerable to CSRF attacks. Creating categories, forums, threads, and replies are the specific functions affected. Category names, forum names, and descriptions are also not escaped and can therefore be exploited to inject maliciously crafted inputs due to the CSRF vulnerability.

Details

Risk Rating
Medium
Author Affiliation
Wikimedia Communities
Related Changes in Gerrit:

Event Timeline

sbassett changed Risk Rating from N/A to Medium.

cc @Universal_Omega for input

I took a quick look at tackling this with pretty much the most basic way possible. Some quick notes based on today's experiments:

  • forumadmin-only "sort forum up/down" feature needs to be implemented differently, it's now just a GET request so it needs to have a <form> that POSTs for no-JS users and for JS users, an API module + appropriate amount of AJAX is in order
  • ditto for the "make thread sticky"/"remove thread stickiness" feature
  • somehow I seem to have broken the "submit a new topic" -> "immediately after submitting submit a reply using the form" feature while trying to tackle this bug
  • gosh, it's 2022, almost 2023, and WF still lacks a preview button?! Darn. Even MediaWiki-extensions-Comments has one these days...

Attached is my WIP patch.

Redmin renamed this task from WikiForum is Vulnerable to CSRF Attacks to WikiForum is Vulnerable to CSRF and XSS Attacks.Apr 26 2023, 12:20 PM
Redmin added a project: Vuln-XSS.

@ashley, if it helps then maybe XSS and CSRF for the functionalities using PHP could be patched first? Please let me know if I can help in any way.

RhinosF1 added subscribers: SFedia, sbassett.

+Alex - Miraheze Software Engineer wanting to consider caring about WikiForum

Here's a patch I did back in late May to work towards fixing any and all issues reported here, in case if someone wants to give it a go.

(NB: It took me all too long to realize a bunch of XSS issues were also merged into this ticket, which I started as a CSRF ticket. IMO that should've been kept as a separate thing, since, well, they are separate issues, even if both are a type of security vulnerability.)

Anyway, the patch sacrifices some administrative functionality for no-JS users in favor of fixing the CSRF issues by using AJAX and the new API modules. I don't love it but it's an acceptable trade-off, because relatively few people have JS turned off in general and most of the functionality is still there even for no-JS users, it's just some very specific, advanced administrative tasks which defiintely aren't daily things which no longer can be done with JS off.

I haven't really played too much with this since late May or early June probably, and while I think I did manage to squish all the bugs, another set of eyes sure wouldn't hurt for the patch is literally over 1600 lines long...

Change #1108384 had a related patch set uploaded (by Jack Phoenix; author: Jack Phoenix):

[mediawiki/extensions/WikiForum@master] [SECURITY] Version 2.7.0 -- fix a whole bunch of CSRF and stored XSS issues

https://gerrit.wikimedia.org/r/1108384

Change #1108384 merged by jenkins-bot:

[mediawiki/extensions/WikiForum@master] [SECURITY] Version 2.7.0 -- fix a whole bunch of CSRF and stored XSS issues

https://gerrit.wikimedia.org/r/1108384

ashley claimed this task.
ashley removed a project: Patch-For-Review.
Bawolff changed the visibility from "Custom Policy" to "Public (No Login Required)".Jan 6 2025, 7:50 AM
Bawolff changed the edit policy from "Custom Policy" to "All Users".