@@ -15,6 +15,7 @@ class Metasploit3 < Msf::Auxiliary
15
15
16
16
NTP_SUPPORTED_VERSIONS = ( 0 ..7 ) . to_a
17
17
NTP_SUPPORTED_MODES = ( 0 ..7 ) . to_a
18
+ NTP_SUPPORTED_MODE_6_OPERATIONS = ( 0 ..31 ) . to_a
18
19
NTP_SUPPORTED_MODE_7_IMPLEMENTATIONS = ( 0 ..255 ) . to_a
19
20
NTP_SUPPORTED_MODE_7_REQUEST_CODES = ( 0 ..255 ) . to_a
20
21
@@ -53,6 +54,7 @@ def initialize
53
54
Opt ::RPORT ( 123 ) ,
54
55
OptString . new ( 'VERSIONS' , [ true , 'Versions to fuzz' , [ 3 , 2 , 4 ] ] ) ,
55
56
OptString . new ( 'MODES' , [ true , 'Modes to fuzz' , NTP_SUPPORTED_MODES ] ) ,
57
+ OptString . new ( 'MODE_6_OPERATIONS' , [ true , 'Mode 6 operations to fuzz' , NTP_SUPPORTED_MODE_6_OPERATIONS ] ) ,
56
58
OptString . new ( 'MODE_7_IMPLEMENTATIONS' , [ true , 'Mode 7 implementations to fuzz' , [ 3 , 2 , 0 ] ] ) ,
57
59
OptString . new ( 'MODE_7_REQUEST_CODES' , [ true , 'Mode 7 request codes to fuzz' , ( 0 ..45 ) . to_a ] ) ,
58
60
OptInt . new ( 'SLEEP' , [ true , 'Sleep for this many ms between requests' , 0 ] ) ,
@@ -174,13 +176,17 @@ def run_host(ip)
174
176
@modes = datastore [ 'MODES' ] . split ( /[^\d ]/ ) . select { |m | !m . empty? } . map { |v | v . to_i }
175
177
unsupported_modes = @modes - NTP_SUPPORTED_MODES
176
178
fail "Unsupported NTP modes: #{ unsupported_modes } " unless unsupported_modes . empty?
179
+ # parse and sanity check mode 6 operations
180
+ @mode_6_operations = datastore [ 'MODE_6_OPERATIONS' ] . split ( /[^\d ]/ ) . select { |m | !m . empty? } . map { |v | v . to_i }
181
+ unsupported_ops = @mode_6_operations - NTP_SUPPORTED_MODE_6_OPERATIONS
182
+ fail "Unsupported NTP mode 6 operations: #{ unsupported_ops } " unless unsupported_ops . empty?
177
183
# parse and sanity check mode 7 implementations
178
- @implementations = datastore [ 'MODE_7_IMPLEMENTATIONS' ] . split ( /[^\d ]/ ) . select { |m | !m . empty? } . map { |v | v . to_i }
179
- unsupported_implementations = @implementations - NTP_SUPPORTED_MODE_7_IMPLEMENTATIONS
180
- fail "Unsupported NTP mode 7implementations : #{ unsupported_implementations } " unless unsupported_implementations . empty?
181
- # parse and sanity check mode 7 REQUEST_CODES
182
- @request_codes = datastore [ 'MODE_7_REQUEST_CODES' ] . split ( /[^\d ]/ ) . select { |m | !m . empty? } . map { |v | v . to_i }
183
- unsupported_request_codes = @request_codes - NTP_SUPPORTED_MODE_7_REQUEST_CODES
184
+ @mode_7_implementations = datastore [ 'MODE_7_IMPLEMENTATIONS' ] . split ( /[^\d ]/ ) . select { |m | !m . empty? } . map { |v | v . to_i }
185
+ unsupported_implementations = @mode_7_implementations - NTP_SUPPORTED_MODE_7_IMPLEMENTATIONS
186
+ fail "Unsupported NTP mode 7 implementations : #{ unsupported_implementations } " unless unsupported_implementations . empty?
187
+ # parse and sanity check mode 7 request codes
188
+ @mode_7_request_codes = datastore [ 'MODE_7_REQUEST_CODES' ] . split ( /[^\d ]/ ) . select { |m | !m . empty? } . map { |v | v . to_i }
189
+ unsupported_request_codes = @mode_7_request_codes - NTP_SUPPORTED_MODE_7_REQUEST_CODES
184
190
fail "Unsupported NTP mode 7 request codes: #{ unsupported_request_codes } " unless unsupported_request_codes . empty?
185
191
186
192
connect_udp
@@ -197,7 +203,7 @@ def run_host(ip)
197
203
def fuzz_control ( host )
198
204
@versions . each do |version |
199
205
print_status ( "#{ host } :#{ rport } fuzzing version #{ version } control messages (mode 6)" )
200
- 0 . upto ( 31 ) do |op |
206
+ @mode_6_operations . each do |op |
201
207
request = build_ntp_control ( version , op )
202
208
what = "#{ request . size } -byte version #{ version } mode 6 op #{ op } message"
203
209
vprint_status ( "#{ host } :#{ rport } probing with #{ request . size } -byte #{ what } " )
@@ -212,8 +218,8 @@ def fuzz_control(host)
212
218
def fuzz_private ( host )
213
219
@versions . each do |version |
214
220
print_status ( "#{ host } :#{ rport } fuzzing version #{ version } private messages (mode 7)" )
215
- @implementations . each do |implementation |
216
- @request_codes . each do |request_code |
221
+ @mode_7_implementations . each do |implementation |
222
+ @mode_7_request_codes . each do |request_code |
217
223
request = build_ntp_private ( version , implementation , request_code , "\x00 " *188 )
218
224
what = "#{ request . size } -byte version #{ version } mode 7 imp #{ implementation } req #{ request_code } message"
219
225
vprint_status ( "#{ host } :#{ rport } probing with #{ request . size } -byte #{ what } " )
0 commit comments