Page MenuHomePhabricator

Editing raw HTML messages does not require reauthentication
Closed, ResolvedPublicSecurity

Description

Filing this as a security task for now out of precaution, but I'm also fine if it is made public, as reauthentication is a preventive measure and does not directly fix/prevent any vulnerabilities.

Based on the code at https://github.com/wikimedia/mediawiki-extensions-WikimediaCustomizations/blob/fff55eff4102a868f66bc2265d09b9e2ab082add/src/ForceReauth/ForceReauthHookHandler.php, it is currently not required to reauthenticate when editing a raw HTML message (e.g. MediaWiki:Mobile-frontend-editor-editing-page). However, JS can also be executed through raw HTML messages, so it doesn't make a lot of sense that editing JS requires reauthentication but editing raw HTML doesn't.

(I don't have editinterface on any WMF wiki, so I can't verify whether that's actually the case or if there is some other code somewhere that fixes this)

Details

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

Event Timeline

Restricted Application added subscribers: jhsoby, Aklapper. · View Herald Transcript

(I don't have editinterface on any WMF wiki, so I can't verify whether that's actually the case or if there is some other code somewhere that fixes this)

@LucasWerkmeister is an interface admin on Commons and can confirm that editing MediaWiki:Mobile-frontend-editor-editing-page, unlike editing MediaWiki:Gadget-ACDC.js, does not prompt for reconfirmation. (That said, they haven’t tried actually making an edit, so it’s still possible that there’s a reauthentication in the submit flow – though that seems unlikely.)

(I don't have editinterface on any WMF wiki, so I can't verify whether that's actually the case or if there is some other code somewhere that fixes this)

@LucasWerkmeister is an interface admin on Commons and can confirm that editing MediaWiki:Mobile-frontend-editor-editing-page, unlike editing MediaWiki:Gadget-ACDC.js, does not prompt for reconfirmation. (That said, they haven’t tried actually making an edit, so it’s still possible that there’s a reauthentication in the submit flow – though that seems unlikely.)

Thanks for confirming!

SomeRandomDeveloper renamed this task from Editing raw HTML messages does (presumably) not require reauthentication to Editing raw HTML messages does not require reauthentication.Wed, May 20, 11:08 PM

That's right, reauthentication is currently only required for editing .js pages in the MW namespace. We'll consider whether to expand reauth to the entire MW namespace in the near future. I don't think it would be feasible to require it only for raw HTML messages, because MW doesn't really track those as such.

[...] I don't think it would be feasible to require it only for raw HTML messages, because MW doesn't really track those as such.

Wouldn't it be possible to just check $title->isRawHtmlMessage() (which checks if the title is in the MediaWiki namespace and listed in $wgRawHtmlMessages) in the hook handler, and treat the page as a site JS page if isRawHtmlMessage returns true?

Whoops, you're right, I forgot that that existed. And it looks like editing these does indeed require the editsitejs right. I'll write a patch for this today then.

sbassett changed the task status from Open to In Progress.Tue, May 26, 4:05 PM
sbassett triaged this task as Medium priority.
sbassett moved this task from Back Orders to In Progress on the Security-Team board.

Change #1293764 merged by jenkins-bot:

[mediawiki/extensions/WikimediaCustomizations@master] ForceReauth: Also require reauth for editing raw HTML messages

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

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.