Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Module Search to MSFRPC interface #8606

Merged
merged 4 commits into from
Jun 30, 2017
Merged

Conversation

busterb
Copy link
Member

@busterb busterb commented Jun 24, 2017

@Chiggins and @bcoles noticed that we are missing module search from MSFRPC. This refactors the search code so it is available from the framework object, and refactors the command dispatcher to use it, which simplifies that code greatly. It then adds 'module.search' to the MSFRPC interface.

Verification

List the steps needed to make sure this thing works

  • Start msfrpcd and msfrpc
  • From msfrpc, run `rpc.call("module.search", "monkey")
  • Verify that it returns reasonable search results with and without a database connected
  • Start msfconsole
  • Run search monkey
  • Verify that it returns reasonable search results with and without a database connected

Note that this only adds 18 lines of code outside of spec removal :)

@Chiggins
Copy link
Contributor

Neat to see this. Looking forward to this getting landed.

@thelightcosine thelightcosine self-assigned this Jun 30, 2017
@thelightcosine
Copy link

@busterb I'm getting slightly different results between the two searches

From RPC:

[{"type"=>"exploit",
  "name"=>"MongoDB nativeHelper.apply Remote Code Execution",
  "fullname"=>"exploit/linux/misc/mongod_native_helper",
  "rank"=>"normal",
  "disclosuredate"=>"2013-03-24"},
 {"type"=>"exploit",
  "name"=>"Sun Java Calendar Deserialization Privilege Escalation",
  "fullname"=>"exploit/multi/browser/java_calendar_deserialize",
  "rank"=>"excellent",
  "disclosuredate"=>"2008-12-03"},
 {"type"=>"exploit",
  "name"=>"Apache Struts ParametersInterceptor Remote Code Execution",
  "fullname"=>"exploit/multi/http/struts_code_exec_parameters",
  "rank"=>"excellent",
  "disclosuredate"=>"2011-10-01"},
 {"type"=>"exploit",
  "name"=>"Apache Struts includeParams Remote Code Execution",
  "fullname"=>"exploit/multi/http/struts_include_params",
  "rank"=>"great",
  "disclosuredate"=>"2013-05-24"},
 {"type"=>"exploit",
  "name"=>"Dell KACE K1000 File Upload",
  "fullname"=>"exploit/unix/http/dell_kace_k1000_upload",
  "rank"=>"excellent",
  "disclosuredate"=>"2014-03-07"},
 {"type"=>"exploit",
  "name"=>"Ubisoft uplay 2.0.3 ActiveX Control Arbitrary Code Execution",
  "fullname"=>"exploit/windows/browser/ubisoft_uplay_cmd_exec",
  "rank"=>"normal",
  "disclosuredate"=>"2012-07-29"},
 {"type"=>"auxiliary",
  "name"=>"Monkey HTTPD Header Parsing Denial of Service (DoS)",
  "fullname"=>"auxiliary/dos/http/monkey_headers",
  "rank"=>"normal",
  "disclosuredate"=>"2013-05-30"},
 {"type"=>"post",
  "name"=>"Windows Gather Group Policy Preference Saved Passwords",
  "fullname"=>"post/windows/gather/credentials/gpp",
  "rank"=>"normal",
  "disclosuredate"=>""},
 {"type"=>"post",
  "name"=>"Windows Manage Proxy PAC File",
  "fullname"=>"post/windows/manage/ie_proxypac",
  "rank"=>"normal",
  "disclosuredate"=>""}]

From console:

msf exploit(psexec) > search monkey

Matching Modules
================

   Name                                             Disclosure Date  Rank       Description
   ----                                             ---------------  ----       -----------
   auxiliary/dos/http/monkey_headers                2013-05-30       normal     Monkey HTTPD Header Parsing Denial of Service (DoS)
   exploit/linux/misc/mongod_native_helper          2013-03-24       normal     MongoDB nativeHelper.apply Remote Code Execution
   exploit/multi/browser/java_calendar_deserialize  2008-12-03       excellent  Sun Java Calendar Deserialization Privilege Escalation
   exploit/multi/http/struts_code_exec_parameters   2011-10-01       excellent  Apache Struts ParametersInterceptor Remote Code Execution
   exploit/multi/http/struts_include_params         2013-05-24       great      Apache Struts includeParams Remote Code Execution
   exploit/unix/http/dell_kace_k1000_upload         2014-03-07       excellent  Dell KACE K1000 File Upload
   exploit/windows/browser/ubisoft_uplay_cmd_exec   2012-07-29       normal     Ubisoft uplay 2.0.3 ActiveX Control Arbitrary Code Execution
   post/windows/gather/credentials/gpp                               normal     Windows Gather Group Policy Preference Saved Passwords
   post/windows/manage/ie_proxypac                                   normal     Windows Manage Proxy PAC File

@busterb
Copy link
Member Author

busterb commented Jun 30, 2017

The RPC interface isn't pushing everything through Rex::table but is giving the raw hash values on purpose, since that's better programmatically, so sort order and presentation are expected to be different. I'm seeing 9 results in both, and haven't actually identified any different module results after some eyeballing.

While they are using the same search function at the high level, but beware: msfrpcd doesn't appear to actually find your database.yml file and won't use the database without some hacking. Try instead loading the msfrpc plugin to ensure the database is available.

I think there might be additional differences between the database and non-database search, but that's also the same story for the CLI. If you still don't see it doing database stuff from that point of view, we may have a weird scope issue.

thelightcosine pushed a commit to thelightcosine/metasploit-framework that referenced this pull request Jun 30, 2017
land's bcook's module search rpc work
@thelightcosine thelightcosine merged commit 79657f5 into rapid7:master Jun 30, 2017
@thelightcosine
Copy link

thelightcosine commented Jun 30, 2017

Release Notes

Module search capability has been added to the remote RPC interface. This capability allows you to search msfrpc as you would msfconsole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants