@@ -53,7 +53,7 @@ def check_rdp
53
53
res = sock . get_once ( -1 , 5 )
54
54
55
55
# return true if this matches our vulnerable response
56
- ( res and res == "\x03 \x00 \x00 \x0b \x06 \xd0 \x00 \x00 \x12 \x34 \x00 " )
56
+ ( res and res . match ( "\x03 \x00 \x00 \x0b \x06 \xd0 \x00 \x00 \x12 \x34 \x00 " ) )
57
57
end
58
58
59
59
def report_goods
@@ -121,16 +121,9 @@ def user_request
121
121
"\x28 " # PER encoded PDU contents
122
122
end
123
123
124
- def channel_request_one
124
+ def channel_request
125
125
"\x03 \x00 \x00 \x0c " +
126
- "\x02 \xf0 \x80 \x38 " +
127
- "\x00 \x01 \x03 \xeb "
128
- end
129
-
130
- def channel_request_two
131
- "\x03 \x00 \x00 \x0c " +
132
- "\x02 \xf0 \x80 \x38 " +
133
- "\x00 \x02 \x03 \xeb "
126
+ "\x02 \xf0 \x80 \x38 "
134
127
end
135
128
136
129
def peer
@@ -143,6 +136,7 @@ def run_host(ip)
143
136
144
137
# check if rdp is open
145
138
if not check_rdp
139
+ vprint_status "#{ peer } Could not connect to RDP."
146
140
disconnect
147
141
return
148
142
end
@@ -153,18 +147,23 @@ def run_host(ip)
153
147
# send userRequest
154
148
sock . put ( user_request )
155
149
res = sock . get_once ( -1 , 5 )
150
+ user1 = res [ 9 , 2 ] . unpack ( "n" ) . first
151
+ chan1 = user1 + 1001
156
152
157
153
# send 2nd userRequest
158
154
sock . put ( user_request )
159
155
res = sock . get_once ( -1 , 5 )
160
156
157
+ user2 = res [ 9 , 2 ] . unpack ( "n" ) . first
158
+ chan2 = user2 + 1001
159
+
161
160
# send channel request one
162
- sock . put ( channel_request_one )
161
+ sock . put ( channel_request << [ user1 , chan2 ] . pack ( "nn" ) )
163
162
res = sock . get_once ( -1 , 5 )
164
163
165
- if res and res [ 8 , 2 ] == "\x3e \x00 "
164
+ if res and res [ 7 , 2 ] == "\x3e \x00 "
166
165
# send ChannelRequestTwo - prevent BSoD
167
- sock . put ( channel_request_two )
166
+ sock . put ( channel_request << [ user2 , chan2 ] . pack ( "nn" ) )
168
167
169
168
print_good ( "#{ peer } Vulnerable to MS12-020" )
170
169
report_goods
0 commit comments