Severe bug in conversation module and possible bug in slashargument pages

Severe bug in conversation module and possible bug in slashargument pages

by Osku Kannusmäki -
Number of replies: 7
Hi,
I'm not sure if I should have reported these things by bugtracker but now I'm writing this here.

A student of mine pointed out two cases when he could access other students' information.

The first (and more severe in my oppinion) is an issue with dialogue module. Anyone can read every all posts in moodle! This happens simply by changing cid-value in dialogues.php:s URLs: http://moodlesite.do/moodle/mod/dialogue/dialogues.php?id=138&action=printdialogue&cid=75

I came up with a fix which prevents this. These lines shoud be added in the beginning of dialogues.php:
<code>
  if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
error("Confirm close: cannot get conversation record");
}

// Do the user have right to see this conversation?

if (!($conversation->recipientid == $USER->id) && !($conversation->userid == $USER->id)) {
error("Dialogue id incorrect.");
}

</code>

Another issue is that if shlasharguments is set on, user can see other student's assignment submissions (and actually all files in moodle data directory). I'm not sure if this is caused by our system configuration or is this a moodle bug.

If user hacks with URL of assignement files, for example,
http://moodle.do//moodle/file.php/17/moddata/assignment/63/54/Viikko3.txt
and just enters http://moodle.do//moodle/file.php/17/moddata/assignment/63/54 without the trailing backslash he can download binary file which shows a listing of all the directorys files if it is opened for example in notepad.

I tried also to fix this, but I don't quite get how this slashargument thing works. When I commented all lines in file.php problem still existed, so altering it doesn't seem to help.

Does enyone have ideas how to prevent this?

- Osku
Average of ratings: -
In reply to Osku Kannusmäki

Re: Severe bug in conversation module and possible bug in slashargument pages

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Hmm, I think I can fix the problem with downloading files and the directory. I also wanted to fix the dialogue module, but do not have enought time these days.

Next time please do not post possible exploits. You can report all security problems directly to me wink

skodak
In reply to Petr Skoda

Re: Severe bug in conversation module and possible bug in slashargument pages

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Petr, I officially dub you the Moodle Security Officer!  smile
In reply to Martin Dougiamas

Re: Severe bug in conversation module and possible bug in slashargument pages

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
Congratulations with your new title (and job! ) Petr cool

May be a good idea to provide petr an email adres like security@moodle.org for reporting security issues (and keep them out of the forums/official bugtracker unless they 're fixed)
In reply to Petr Skoda

Re: Severe bug in conversation module and possible bug in slashargument pages

by Osku Kannusmäki -
I admit that posting this was poor thinking on my behalf.  I'm sorry. It would be great if there was a way of reporting security bugs or at least an email address in bugtracker.

Anyway this really is a security issue, and if you wan't you can delete this thread I don't have any objections.

Btw, I'm still interested how slasharguments works and where it is actually implemented. Could someone drop me few lines about it?

- Osku
In reply to Osku Kannusmäki

Re: Severe bug in conversation module and possible bug in slashargument pages

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
I am going to rewrite the file.php and submit it to Martin and Eloy for review. It will take me several days...

I could look at the Dialogue module after 1.4.2 release. Anyway it is not in official distro, so people should not expect it to be perfect.

skodak
In reply to Petr Skoda

Re: Severe bug in conversation module and possible bug in slashargument pages

by Ray Kingdon -
Petr, I now applied a fix, hopefully, to this bug in the Dialogue module. It's in CVS (development version). Can I leave it to someone else to backport it into 1.4.2? (I've also fixed up the backup/restore routines in that module as well I hope, again in 1.5 unstable.) Trying to work on more than one branch in CVS is best left to the experts cool.
Ray


In reply to Ray Kingdon

Re: Severe bug in conversation module and possible bug in slashargument pages

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Hi!

I think we can test it a bit and then commit back to MOODLE_14_STABLE. This module is not part of official distro, so IMHO it should be OK to have the same files in both branches (of course only until they are compatible).

I am going to review the source code today and eventually test it in 1.4 branch smile

The problem with students downloading will be fixed in 1.4.3.

skodak