Page MenuHomePhabricator

CVE-2024-47846: Special:DeleteCargoTable and Special:SwitchCargoTable have no CSRF protection
Closed, ResolvedPublicSecurity

Assigned To
Authored By
BlankEclair
Aug 11 2024, 1:32 AM
Referenced Files
F57573802: 2024-10-01_08-59.png
Sep 30 2024, 11:00 PM
F57573803: 2024-10-01_08-59_1.png
Sep 30 2024, 11:00 PM
F57269667: cargo-no-csrf-poc.mp4
Aug 12 2024, 4:14 PM
F57269665: T372209-poc.html
Aug 12 2024, 4:14 PM
F57267189: T372209.patch
Aug 11 2024, 11:01 AM
F57261316: cargo-delete-csrf.mp4
Aug 11 2024, 1:32 AM

Description

Steps to replicate the issue (include links if applicable):

  • Install MediaWiki and Cargo
  • Login as an account with (recreatecargodata) and (deletecargodata)
  • Save the following into Template:Cargo/deletetest: <noinclude>{{#cargo_declare: _table = cargodeletetest}}</noinclude>
  • Go to Template:Cargo/deletetest?action=recreatedata and create the table
  • CSRF for Special:DeleteCargoTable:
    • Lure the victim to go to Special:DeleteCargoTable/cargodeletetest?delete
  • CSRF for Special:SwitchCargoTable:
    • Go to Template:Cargo/deletetest?action=recreatedata again and create the replacement table
    • Lure the victim to go to Special:SwitchCargoTable/cargodeletetest?switch

What happens?
The deletion or switch is prevented

What should have happened instead?
The deletion or switch happens

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

  • MediaWiki: 1.42.1 (523b312) 15:03, 1 August 2024
  • PHP: 8.1.20 (fpm-fcgi)
  • MariaDB: 11.4.2-MariaDB
  • Cargo: 3.6.1 (903c36c) 19:36, 6 August 2024

Other information (browser name/version, screenshots, etc.):
See also: https://www.mediawiki.org/wiki/Special:MyLanguage/Cross-site_request_forgery

Screen recording for Special:DeleteCargoTable:

Details

Risk Rating
Medium
Author Affiliation
Wikimedia Communities

Event Timeline

BlankEclair renamed this task from Special:DeleteCargoTable has no CSRF protection to Special:DeleteCargoTable and Special:SwitchCargoTable have no CSRF protection.Aug 11 2024, 1:44 AM
BlankEclair updated the task description. (Show Details)

@BlankEclair - thank you for this patch. Any security leak is bad, so I plan to check this fix in, but I just want to make sure I understand this problem, because it seems surprisingly minor. A malicious user can convince an administrator that the admin deleted or switched a Cargo table, where in actuality nothing was done?

No, the issue is that a malicious user can cause an administrator to delete or switch a table by simply letting them visit a link. (I've tried to use <iframe>s and <img>s to covertly trigger this bug as a PoC, but they refused to load or didn't send cookies for some reason).

I've made an example POC here:

Screen recording:

(I also accidentally said "We have not deleted your replacement table" when I meant just "table", oops)

@BlankEclair - thank you for the patch, the explanation, and that very illustrative example! I just checked in your fix, here:

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Cargo/+/1062723

Can this task be public now?

Can an ext:Cargo maintainer or user confirm that the CSRF issues have been fully-resolved via https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Cargo/+/1062723?

sbassett triaged this task as Medium priority.Oct 1 2024, 3:29 PM
sbassett changed Author Affiliation from N/A to Wikimedia Communities.
sbassett changed the visibility from "Custom Policy" to "Public (No Login Required)".
sbassett changed the edit policy from "Custom Policy" to "All Users".
sbassett changed Risk Rating from N/A to Medium.
Mstyles renamed this task from Special:DeleteCargoTable and Special:SwitchCargoTable have no CSRF protection to CVE-2024-47846: Special:DeleteCargoTable and Special:SwitchCargoTable have no CSRF protection.Oct 5 2024, 12:40 AM