Skip to content

Commit 5eecb1f

Browse files
authored
Land rapid7#20535, adds a test login scanner and fixes ANONYMOUS_LOGIN
Add a test login scanner and fix ANONYMOUS_LOGIN
2 parents 76977ae + 1bd44fa commit 5eecb1f

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

lib/msf/core/auxiliary/auth_brute.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def initialize(info = {})
5959
# @return [Metasploit::Framework::CredentialCollection] the built CredentialCollection
6060
def build_credential_collection(opts)
6161
cred_collection = Metasploit::Framework::CredentialCollection.new({
62+
anonymous_login: datastore['ANONYMOUS_LOGIN'],
6263
blank_passwords: datastore['BLANK_PASSWORDS'],
6364
pass_file: datastore['PASS_FILE'],
6465
user_file: datastore['USER_FILE'],
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
##
2+
# This module requires Metasploit: https://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'metasploit/framework/login_scanner/base'
7+
require 'metasploit/framework/credential_collection'
8+
9+
class MetasploitModule < Msf::Auxiliary
10+
include Msf::Auxiliary::Scanner
11+
include Msf::Auxiliary::Report
12+
include Msf::Auxiliary::AuthBrute
13+
14+
def initialize
15+
super(
16+
'Name' => 'Test Login Scanner',
17+
'Description' => %q{
18+
Use this module to test how credentials are generated for login scanners.
19+
},
20+
'Author' => [
21+
'Spencer McIntyre'
22+
],
23+
'References' => [
24+
[ 'CVE', '1999-0506'], # Weak password
25+
],
26+
'DefaultOptions' => { 'RHOSTS' => '192.0.2.1' },
27+
'License' => MSF_LICENSE
28+
)
29+
end
30+
31+
def run_host(ip)
32+
print_brute(level: :vstatus, ip: ip, msg: 'Starting login bruteforce')
33+
34+
@scanner = TestLoginScanner.new(
35+
host: ip,
36+
port: 80,
37+
stop_on_success: datastore['STOP_ON_SUCCESS'],
38+
proxies: datastore['Proxies'],
39+
bruteforce_speed: datastore['BRUTEFORCE_SPEED'],
40+
framework: framework,
41+
framework_module: self
42+
)
43+
44+
cred_collection = build_credential_collection(
45+
username: datastore['USERNAME'],
46+
password: datastore['PASSWORD']
47+
)
48+
cred_collection = prepend_db_hashes(cred_collection)
49+
50+
@scanner.cred_details = cred_collection
51+
52+
@scanner.each_credential do |credential|
53+
print_status("username: #{credential.public.inspect}, password: #{credential.private.inspect}")
54+
end
55+
end
56+
57+
class TestLoginScanner
58+
include Metasploit::Framework::LoginScanner::Base
59+
60+
REALM_KEY = nil
61+
62+
def attempt_login(credential)
63+
::Metasploit::Framework::LoginScanner::Result.new(
64+
host: host,
65+
port: port,
66+
protocol: 'tcp',
67+
credential: credential,
68+
status: Metasploit::Model::Login::Status::SUCCESSFUL
69+
)
70+
end
71+
end
72+
end

0 commit comments

Comments
 (0)