Page MenuHomePhabricator

FileImporter allows imports to cascade protected files when the importer does not have administrator permissions (CVE-2022-28206)
Closed, ResolvedPublic3 Estimated Story PointsSecurity

Description

Steps to reproduce

  • Protect a page with cascading turned on
  • Transclude a non-existent file onto it
  • Import a file to the title which is now cascade protected, using an account without administrator permissions

The import completes successfully, bypassing the cascade protection and creating the page. Similar to T262628.

Details

Risk Rating
Low
Author Affiliation
Wikimedia Communities

Event Timeline

Dylsss renamed this task from FileImporter allows imports to cascade protected files when the importer does not have administartor permissions to FileImporter allows imports to cascade protected files when the importer does not have administrator permissions.Oct 25 2021, 3:00 PM
Dylsss added a project: Move-Files-To-Commons.

The issue appears to be that FileImporter only does checks for create and upload, but not edit. This results in no errors being returned because the PermissionManager::checkCascadingSourcesRestrictions check directly compares the given action to the cascading action restriction (which is only ever edit), this means any checks for actions other than edit will never return errors for cascading restrictions. It looks like the abandoned patch https://gerrit.wikimedia.org/r/c/mediawiki/core/+/233207 would have addressed this bug.

The issue appears to be that FileImporter only does checks for create and upload, but not edit. This results in no errors being returned because the PermissionManager::checkCascadingSourcesRestrictions check directly compares the given action to the cascading action restriction (which is only ever edit), this means any checks for actions other than edit will never return errors for cascading restrictions. It looks like the abandoned patch https://gerrit.wikimedia.org/r/c/mediawiki/core/+/233207 would have addressed this bug.

I tried to solve the issue by adding a check for edit permissions. But from my local smoke tests it did not seem to work. Maybe I misunderstood the comment, and this would only work anyways with the other patch mentioned. 🤔
See https://gerrit.wikimedia.org/r/c/mediawiki/extensions/FileImporter/+/757022

What I did to test:

  • Transcluded a non existing file page ( {{File:Test.jpg}} ) into a page ( Main Page ) on my wiki.
  • Used and admin account to cascade protect Main Page and only allow changes for admins.
  • Used a normal user account with the FileImporter to import a random .jpg file and use the name Test for the import.
  • There should be an error on the import preview page but there's nothing.

I also tried to just upload a file with that name as a normal user and that also worked although the file page should be cascade protected.

@WMDE-Fisch Your patch works locally for me?

Screenshot 2022-01-25 205553.jpg (934×1 px, 112 KB)

Thanks for testing, still have not figured out, why I can not test it locally. We might just merge the patch and test it on the beta cluster before train rollout.

@WMDE-Fisch I looked over your comment again, and I think it's not working because you are transcluding it like {{File:Test.jpg}} instead of [[File:Test.jpg]]. The former doesn't get any cascading protection.

@WMDE-Fisch I looked over your comment again, and I think it's not working because you are transcluding it like {{File:Test.jpg}} instead of [[File:Test.jpg]]. The former doesn't get any cascading protection.

🤦 thanks for looking at it again and the clarification. Now I could confirm it working as well. Nice!

WMDE-Fisch set the point value for this task to 3.Jan 31 2022, 1:29 PM
thiemowmde moved this task from Demo to Done on the WMDE-TechWish-Sprint-2022-01-19 board.

Eh, well, I guess this went through gerrit: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/FileImporter/+/757022. I'lll track it for the next supplemental release (T297839) and we can make the bug public once wmf.20 is done rolling out this week.

sbassett renamed this task from FileImporter allows imports to cascade protected files when the importer does not have administrator permissions to FileImporter allows imports to cascade protected files when the importer does not have administrator permissions (CVE-2022-28206).Mar 30 2022, 7:20 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 Low.