Last modified: 2014-06-30 17:24:32 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T68631, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 66631 - EducationProgram: An admin was able to add an anon to a course
EducationProgram: An admin was able to add an anon to a course
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
EducationProgram (Other open bugs)
unspecified
All All
: Unprioritized minor (vote)
: ---
Assigned To: Andrew Green
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-15 05:48 UTC by Andrew Green
Modified: 2014-06-30 17:24 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
[PATCH] Prevent ApiAddStudents enrolling invalid users (1.47 KB, patch)
2014-06-16 04:59 UTC, Andrew Green
Details

Description Andrew Green 2014-06-15 05:48:51 UTC
As documented in this bug [1] and in these logs [2], a user with an ID of 0 was added to a course. This shouldn't happen. The bug report also shows that this can have unexpected results with security implications.

I haven't yet found the route by which this happened. While permissions checking for student enrollment is not really what it should be, so far it seems that existing checks should have prevented this.

[1] https://bugzilla.wikimedia.org/show_bug.cgi?id=66624
[2] https://en.wikipedia.org/w/index.php?title=Special:Log&page=Education+Program%3ASimmons+College%2FIntellectual+Freedom+-+LIS+493+%28Summer+2014%29
Comment 1 Andrew Green 2014-06-16 04:59:48 UTC
Created attachment 15661 [details]
[PATCH] Prevent ApiAddStudents enrolling invalid users

Found it! ApiAddStudents is not controlling for malformed usernames (though it does control for non-existent usernames). The issue hadn't been noticed until now since the API is only called via a JS module and most of the time other validation prevents the posting of a malformed username enrollment request.

To recreate the problem: log in as an administrator, go to a course page, expand the "Add students to this course" and type in an IP address or something similar. Then click on "Add". In most circumstances the API will be called with the invalid user name, leading to the DB issues described here: https://bugzilla.wikimedia.org/show_bug.cgi?id=66624. (Enable dev tools in the browser to check that the API post was sent.)

This patch should work for the versions of the extension on production and test2.
Comment 2 Andrew Green 2014-06-16 05:10:49 UTC
Later on more improvements can be made in the extension's handling of the ep-enroll right.

Also, I don't think I can do step 5:
https://wikitech.wikimedia.org/wiki/How_to_deploy_code#Security_patches
Comment 3 Chris Steipp 2014-06-16 17:26:38 UTC
Thanks Andrew! The patch looks sane, thanks for putting that together. I'll deploy this asap.
Comment 4 Chris Steipp 2014-06-16 17:37:54 UTC
17:36 logmsgbot: csteipp Synchronized php-1.24wmf8/extensions/EducationProgram/includes/api/ApiAddStudents.php: Bug66631 (duration: 00m 05s)
17:34 logmsgbot: csteipp Synchronized php-1.24wmf9/extensions/EducationProgram/includes/api/ApiAddStudents.php: (no message) (duration: 00m 05s)
Comment 5 Chris Steipp 2014-06-16 17:42:03 UTC
I'm not too worried about this being public, since it would require a hostile ep admin to exploit. So feel free to put this into gerrit whenever you like, preferably before Thursday.
Comment 6 Andrew Green 2014-06-16 20:21:57 UTC
(In reply to Chris Steipp from comment #5)
> I'm not too worried about this being public, since it would require a
> hostile ep admin to exploit. So feel free to put this into gerrit whenever
> you like, preferably before Thursday.

OK, thanks! I'll put it in Gerrit then.

Please note that it was a bit more accessible than that. In addition to users with the 'ep-addstudent' right, instructors and volunteers can use the add students feature for the course(s) they're associated with. Still, I agree, it's probably fine--especially since the fix is deployed. :)
Comment 7 Andrew Green 2014-06-16 20:31:30 UTC
Note also that the log entry mentioned above has been suppressed.
Comment 8 Andrew Green 2014-06-17 15:29:49 UTC
https://gerrit.wikimedia.org/r/#/c/140137/
Comment 9 Alex Monk 2014-06-18 18:28:47 UTC
It doesn't look like that got merged.
Comment 10 Andrew Green 2014-06-18 19:04:01 UTC
(In reply to Alex Monk from comment #9)
> It doesn't look like that got merged.

Ooops, yeah you're right... Can anyone review and (hopefully) merge it before tomorrow's deploy train leaves the station? Thanks!!
Comment 11 Alex Monk 2014-06-18 19:06:00 UTC
This is not yet resolved. Please do not mark it as such until the patch has been merged into master.
Comment 12 Andrew Green 2014-06-18 19:26:32 UTC
(In reply to Alex Monk from comment #11)
> This is not yet resolved. Please do not mark it as such until the patch has
> been merged into master.

Alex: Sorry!!! I don't know what happened, something funny with the Web interface/form values remembered by my Web browser, I guess. 8p It was *not* my intention to close it again, rather just to say thank you for re-opening it. Thank you for re-re-opening it, apologies for this once again!!
Comment 13 James Forrester 2014-06-18 23:14:50 UTC
Gerrit change #140137 is now merged and will go out with the wmf10 train. Marking as such.

(Once wmf9 is no longer on the cluster this bug should be moved out of the Security component to the Education Programme extension.)
Comment 14 Andrew Green 2014-06-19 17:09:52 UTC
Thanks so much, everyone! Apologies again for the premature closing and accidental re-closing 8p

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links