Skip to content

Commit a15c350

Browse files
David MaloneyDavid Maloney
authored andcommitted
Add the WinRM login module
1 parent e19f2d2 commit a15c350

File tree

2 files changed

+83
-4
lines changed

2 files changed

+83
-4
lines changed

lib/msf/core/exploit/winrm.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ def initialize(info = {})
2020
super
2121
register_options(
2222
[
23-
Opt::RHOST,
2423
Opt::RPORT(5985),
25-
OptString.new('VHOST', [ false, "HTTP server virtual host" ]),
26-
OptBool.new('SSL', [ false, 'Negotiate SSL for outgoing connections', false]),
27-
OptEnum.new('SSLVersion', [ false, 'Specify the version of SSL that should be used', 'SSL3', ['SSL2', 'SSL3', 'TLS1']]),
2824
OptString.new('DOMAIN', [ true, 'The domain to use for Windows authentification', 'WORKSTATION']),
2925
OptString.new('URI', [ true, "The URI of the WinRM service", "/wsman" ]),
3026
OptString.new('USERNAME', [ false, 'A specific username to authenticate as' ]),
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
##
2+
# $Id$
3+
##
4+
5+
##
6+
# This file is part of the Metasploit Framework and may be subject to
7+
# redistribution and commercial restrictions. Please see the Metasploit
8+
# web site for more information on licensing and terms of use.
9+
# http://metasploit.com/
10+
##
11+
12+
13+
require 'msf/core'
14+
require 'rex/proto/ntlm/message'
15+
16+
class Metasploit3 < Msf::Auxiliary
17+
18+
include Msf::Exploit::Remote::WinRM
19+
include Msf::Auxiliary::Report
20+
include Msf::Auxiliary::AuthBrute
21+
22+
include Msf::Auxiliary::Scanner
23+
24+
def initialize
25+
super(
26+
'Name' => 'WinRM Login Utility',
27+
'Version' => '$Revision$',
28+
'Description' => %q{
29+
This module attempts to authenticate to a WinRM service. It currently
30+
works only if the remote end allows Negotiate(NTLM) authentication.
31+
Kerberos is not currently supported.
32+
},
33+
'References' =>
34+
[
35+
36+
],
37+
'Author' => [ 'thelightcosine' ],
38+
'References' =>
39+
[
40+
[ 'CVE', '1999-0502'] # Weak password
41+
],
42+
'License' => MSF_LICENSE
43+
)
44+
45+
end
46+
47+
48+
def run_host(ip)
49+
unless accepts_ntlm_auth
50+
print_error "The Remote WinRM server (#{ip} does not appear to allow Negotiate(NTLM) auth"
51+
return
52+
end
53+
each_user_pass do |user, pass|
54+
resp,c = send_request_ntlm(test_request)
55+
if resp.nil?
56+
print_error "Got no reply from the server, connection may have timed out"
57+
return
58+
elsif resp.code == 200
59+
cred_hash = {
60+
:host => ip,
61+
:port => rport,
62+
:sname => 'winrm',
63+
:pass => pass,
64+
:user => user,
65+
:source_type => "user_supplied",
66+
:active => true
67+
}
68+
report_auth_info(cred_hash)
69+
print_good "Valid credential found: #{user}:#{pass}"
70+
elsif resp.code == 401
71+
print_error "Login failed: #{user}:#{pass}"
72+
else
73+
print_error "Recieved unexpected Response Code: #{resp.code}"
74+
end
75+
end
76+
end
77+
78+
79+
def test_request
80+
data = winrm_wql_msg("Select Name,Status from Win32_Service")
81+
end
82+
83+
end

0 commit comments

Comments
 (0)