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

Cleanup auxiliary/scanner/msf/msf_rpc_login #8830

Merged
merged 1 commit into from Aug 14, 2017

Conversation

bcoles
Copy link
Contributor

@bcoles bcoles commented Aug 14, 2017

This PR includes a couple of bug fixes and minor code clean up for the Metasploit RPC Interface Login Utility module.

Output before and after this patch is shown below.

Changes

  • Libraries:

    • The RPC library loading has been moved to the top of the file. This is cleaner and should be safe, given that the msf/core/rpc/v10/client library is packaged with Metasploit, and that the msgpack Gem requirement is included in Gemfile.lock.
    • The include Msf::Exploit::Remote::Tcp library has been included, for no other reason than to allow access to peer, rhost, rport, ssl variables.
  • Output

    • When scanning more than one host the output made no sense. This has been cleaned up with the use of peer in output.
  • Bug Fixes

    • If the connection is refused, the module will now skip the host, instead of needlessly continuing login attempts with all passwords against all users.
    • The proof has been removed from the reported credentials. The proof was res.body which was raising undefined method `body' for true:TrueClass which was triggering the rescue, causing the call to report_cred to fail, resulting in credentials being reported to console, but never to the database.

Output (Before)

msf auxiliary(msf_rpc_login) > set rhosts 127.0.0.1 172.16.191.181
rhosts => 127.0.0.1 172.16.191.181
rmsf auxiliary(msf_rpc_login) > run

[*] Trying username:'msf' with password:'test'
[*] true - Bad login
[*] Trying username:'msf' with password:'12345'
[*] true - Bad login
[*] Trying username:'msf' with password:'123456'
[*] true - Bad login
[*] Trying username:'msf' with password:'password'
[*] true - Bad login
[*] Trying username:'msf' with password:'abc123'
[*] true - Bad login
[*] Trying username:'msf' with password:'msfchangeme'
[*] true - Bad login
[*] Scanned 1 of 2 hosts (50% complete)
[*] Trying username:'msf' with password:'test'
[*] true - Bad login
[*] Trying username:'msf' with password:'12345'
[*] true - Bad login
[*] Trying username:'msf' with password:'123456'
[*] true - Bad login
[*] Trying username:'msf' with password:'password'
[*] true - Bad login
[*] Trying username:'msf' with password:'abc123'
[+] SUCCESSFUL LOGIN. 'msf' : 'abc123'
[*] true - Bad login
[*] Trying username:'msf' with password:'msfchangeme'
[*] true - Bad login
[*] Scanned 2 of 2 hosts (100% complete)
[*] Auxiliary module execution completed

Output (After)

msf auxiliary(msf_rpc_login) > set rhosts 127.0.0.1 172.16.191.181
rhosts => 127.0.0.1 172.16.191.181
msf auxiliary(msf_rpc_login) > run

[*] 127.0.0.1:55553       - Trying username:'msf' with password:'test'
[-] 127.0.0.1:55553       - 127.0.0.1:55553       - Connection refused
[*] Scanned 1 of 2 hosts (50% complete)
[*] 172.16.191.181:55553  - Trying username:'msf' with password:'test'
[*] 172.16.191.181:55553  - 172.16.191.181:55553 - [1/6] - Bad login
[*] 172.16.191.181:55553  - Trying username:'msf' with password:'12345'
[*] 172.16.191.181:55553  - 172.16.191.181:55553 - [2/6] - Bad login
[*] 172.16.191.181:55553  - Trying username:'msf' with password:'123456'
[*] 172.16.191.181:55553  - 172.16.191.181:55553 - [3/6] - Bad login
[*] 172.16.191.181:55553  - Trying username:'msf' with password:'password'
[*] 172.16.191.181:55553  - 172.16.191.181:55553 - [4/6] - Bad login
[*] 172.16.191.181:55553  - Trying username:'msf' with password:'abc123'
[+] 172.16.191.181:55553  - SUCCESSFUL LOGIN. 'msf' : 'abc123'
[!] 172.16.191.181:55553  - No active DB -- Credential data will not be saved!
[*] Scanned 2 of 2 hosts (100% complete)
[*] Auxiliary module execution completed

@bcoles
Copy link
Contributor Author

bcoles commented Aug 14, 2017

New PR of #8654 which had merge conflicts.

@busterb
Copy link
Member

busterb commented Aug 14, 2017

Works for me, landing.

@busterb busterb merged commit fa4fae3 into rapid7:master Aug 14, 2017
@bcoles bcoles deleted the msf_rpc_login branch August 14, 2017 06:52
@busterb
Copy link
Member

busterb commented Aug 14, 2017

Release Notes

The auxiliary/scanner/msf/msf_rpc_login module has been updated to properly display target host information as the scan proceeds. Also, the module's scanning behavior now skips hosts that are not listening on the target service port, and the credential information is properly stored in the database.

@alrosenthal-r7 alrosenthal-r7 added the rn-enhancement release notes enhancement label Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants