The WatchAnalytics extension does not properly escape user-provided strings before inserting them into raw SQL, allowing for SQL injection. The clearreviews permission is required to exploit this, which is granted to the sysop group by default.
SQLI through page title field
Reproduction steps
- Go to /wiki/Special:ClearPendingReviews
- Enter any dates (e.g. 20251003184000) into the "Start Time" and "End Time" fields
- Enter '/**/OR/**/SLEEP(5)/**/OR/**/''/**/=/**/' into the "Page title like:" field
- Click "Preview"
- Observe that the page takes some time to load because the SLEEP(5) statement in the SQL query is executed
Cause
SQLI through page category field
Reproduction steps
(Note that I slightly modified the SQL query locally to reproduce this since categorylinks.cl_to was removed in MW 1.44 and I'm using 1.45)
- Go to /wiki/Category:'/**/OR/**/SLEEP(5)/**/OR/**/''/**/%3D/**/' and create the page
- Go to /wiki/Special:ClearPendingReviews
- Enter any dates (e.g. 20251003184000) into the "Start Time" and "End Time" fields
- Enter '/**/OR/**/SLEEP(5)/**/OR/**/''/**/=/**/' into the "Select page category:" field
- Click "Preview"
- Observe that the page takes some time to load because the SLEEP(5) statement in the SQL query is executed
Cause
Additional information
- MediaWiki: 1.45.0-alpha
- WatchAnalytics: b9de8e1
- PHP: 8.3.14 (fpm-fcgi)
- MySQL: 9.4.0