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

Implement "intelligent" use command with search -u #11724

Merged
merged 1 commit into from
Apr 17, 2019

Conversation

wvu
Copy link
Contributor

@wvu wvu commented Apr 12, 2019

This implementation could use a refactor, and my brain is fried right now, so I'm marking this as WIP. Still could use a refactor, but I'm opening this up to review/testing.

  • Investigate whether RC and -x being processed before modules loaded causing errors #4340 affects MSF5 and come up with a proper fix if possible
    • I can no longer reproduce this on MSF5, and the search adds a small delay as well
  • Consider what we want to do about search -u (I see no harm in keeping it, but I think most folks will reach for use)
    • I say we keep it, since searching is the primary functionality, using second
msf5 > use rv130

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

   #  Name                                    Disclosure Date  Rank  Check  Description
   -  ----                                    ---------------  ----  -----  -----------
   1  exploit/linux/http/cisco_rv130_rmi_rce  2019-02-27       good  No     Cisco RV130W Routers Management Interface Remote Command Execution


[*] Using exploit/linux/http/cisco_rv130_rmi_rce
msf5 exploit(linux/http/cisco_rv130_rmi_rce) >
msf5 exploit(linux/http/cisco_rv130_rmi_rce) > use eternalblue

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

   #  Name                                           Disclosure Date  Rank     Check  Description
   -  ----                                           ---------------  ----     -----  -----------
   1  auxiliary/admin/smb/ms17_010_command           2017-03-14       normal   Yes    MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Command Execution
   2  auxiliary/scanner/smb/smb_ms17_010                              normal   Yes    MS17-010 SMB RCE Detection
   3  exploit/windows/smb/ms17_010_eternalblue       2017-03-14       average  No     MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
   4  exploit/windows/smb/ms17_010_eternalblue_win8  2017-03-14       average  No     MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption for Win8+
   5  exploit/windows/smb/ms17_010_psexec            2017-03-14       normal   No     MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Code Execution


msf5 exploit(linux/http/cisco_rv130_rmi_rce) > use exploit/windows/smb/ms17_010_eternalblue
msf5 exploit(windows/smb/ms17_010_eternalblue) >

Note that there is some overlap with regex-enhanced tab completion:

msf5 > use .*rv130.*

# Verify that our search string is a valid regex
begin
Regexp.compile(str,Regexp::IGNORECASE)
rescue RegexpError
str = Regexp.escape(str)
end

I may attempt to merge the two. The two functionalities are complementary.

Updates #4615 and #11652.

@wvu wvu added library blocked Blocked by one or more additional tasks msfconsole enhancement msf5 labels Apr 12, 2019
@wvu wvu requested a review from busterb April 12, 2019 23:37
@h00die
Copy link
Contributor

h00die commented Apr 12, 2019

.....oh...my...gosh....
Becky, look @wvu-r7 use command.
its so intelligent, its like one of those hacker's commands

Seriously though, this is the freaking hotness!

Copy link
Member

@busterb busterb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, go for it!

@ccondon-r7 ccondon-r7 added the hotness Something we're really excited about label Apr 13, 2019
@wvu wvu changed the title [WIP] Implement "intelligent" use command with search -u Implement "intelligent" use command with search -u Apr 16, 2019
@wvu wvu removed the blocked Blocked by one or more additional tasks label Apr 16, 2019
@wvu wvu marked this pull request as ready for review April 16, 2019 15:58
@busterb busterb self-assigned this Apr 17, 2019
@busterb
Copy link
Member

busterb commented Apr 17, 2019

I may never use search again. Great work!

msf5 exploit(windows/misc/achat_bof) > use icq

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

   #  Name                                           Disclosure Date  Rank       Check  Description
   -  ----                                           ---------------  ----       -----  -----------
   1  exploit/windows/browser/aol_icq_downloadagent  2006-11-06       excellent  No     America Online ICQ ActiveX Control Arbitrary File Download and Execute
   2  exploit/windows/firewall/blackice_pam_icq      2004-03-18       great      No     ISS PAM.dll ICQ Parser Buffer Overflow


msf5 exploit(windows/misc/achat_bof) > use pam_icq

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

   #  Name                                       Disclosure Date  Rank   Check  Description
   -  ----                                       ---------------  ----   -----  -----------
   1  exploit/windows/firewall/blackice_pam_icq  2004-03-18       great  No     ISS PAM.dll ICQ Parser Buffer Overflow


[*] Using exploit/windows/firewall/blackice_pam_icq
msf5 exploit(windows/firewall/blackice_pam_icq) > use ms08_07

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

   #  Name                                                   Disclosure Date  Rank    Check  Description
   -  ----                                                   ---------------  ----    -----  -----------
   1  exploit/windows/browser/ms08_070_visual_studio_msmask  2008-08-13       normal  No     Microsoft Visual Studio Mdmask32.ocx ActiveX Buffer Overflow
   2  exploit/windows/browser/ms08_078_xml_corruption        2008-12-07       normal  No     MS08-078 Microsoft Internet Explorer Data Binding Memory Corruption


msf5 exploit(windows/firewall/blackice_pam_icq) > use ms08_078

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

   #  Name                                             Disclosure Date  Rank    Check  Description
   -  ----                                             ---------------  ----    -----  -----------
   1  exploit/windows/browser/ms08_078_xml_corruption  2008-12-07       normal  No     MS08-078 Microsoft Internet Explorer Data Binding Memory Corruption

@busterb busterb merged commit 23f28e8 into rapid7:master Apr 17, 2019
busterb added a commit that referenced this pull request Apr 17, 2019
@busterb
Copy link
Member

busterb commented Apr 17, 2019

Release Notes

The msfconsole use command now applies intelligent search capabilities when you do not specify an exact module name. If the argument specified to the use command matches a single module, that module is automatically selected. You're always given a full list of possible module matches and metadata to help ensure that the intended module was selected or to help refine the search.

@wvu
Copy link
Contributor Author

wvu commented Apr 17, 2019

If we decide "use by index" makes more sense now, we can implement it. I've been copying and pasting or tab-completing.

@wvu wvu deleted the feature/use branch April 17, 2019 07:56
jmartin-tech pushed a commit to jmartin-tech/metasploit-framework that referenced this pull request Jul 16, 2019
@tdoan-r7 tdoan-r7 added the rn-enhancement release notes enhancement label Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement hotness Something we're really excited about library msf5 msfconsole rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants