Network Time Protocol Daemon (ntpd) monlist Command Enabled DoS

1. 漏洞报告

image

2. 漏洞介绍

     CVE-2013-5211最早公布是2014年1月10日,由于NTP本身不会验证发送者的源ip地址。这就类似于DNS解析器使用的DRDoS(分布式反射型拒绝服务攻击)。攻击者HACK发送了一个伪造报文发送给NTP服务器Server A,将数据包中的源ip地址改成了受害者Client A的ip地址。NTP服务器Server A会响应这个请求,相对于初始请求,响应包发送的字节数是一个被放大的量,导致受害者Client A被dos攻击。最高的两个消息类型:REQ_MON_GETLIST和REQ_MON_GETLIST_1,通过高达3660和5500的一个因素分别放大原始请求。NTP包含一个monlist功能,也被成为MON_GETLIST,主要用于监控NTP服务器,NTP服务器响应monlist后就会返回与NTP服务器进行过时间同步的最后600个客户端的IP,响应包按照每6个IP进行分割,最多有100个响应包。

3. 漏洞危害

      在远程主机上运行的ntpd版本已启用"monlist"命令。此命令返回已连接到服务的最近主机的列表。但是,它受到ntp_request.c中的拒绝服务漏洞的影响,该漏洞允许未经身份验证的远程攻击者通过使用伪造的REQ_MON_GETLIST或REQ_MON_GETLIST_1请求将网络流量饱和到特定的IP地址。此外,攻击者可以利用此问题进行侦察或分布式拒绝服务(DDoS)攻击。

4. Nmap检测

#  获取并打印NTP服务器的监视器数据
λ nmap -sU -sV -Pn -p 123 --script="ntp-monlist" 192.168.43.58
Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower.
Starting Nmap 7.91 ( https://nmap.org ) at 2021-04-19 17:34 ?D1ú±ê×?ê±??
Nmap scan report for 192.168.43.58
Host is up (0.00088s latency).

PORT    STATE SERVICE VERSION
123/udp open  ntp     NTP v4 (unsynchronized)
| ntp-monlist:
|   Other Associations (1)
|_      192.168.43.232 (You?) seen 3 times. last tx was unicast v2 mode 7
MAC Address: 00:0C:29:3E:BA:70 (VMware)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 2.47 seconds

5. 漏洞修复

      由于默认情况下4.2.7之前的所有版本的ntpd都容易受到攻击,因此建议的最简单的操作方法是将可公开访问的所有ntpd版本升级到至少4.2.7。但是,在无法升级服务版本的情况下,可以在软件的早期版本中禁用监视器功能,也就是关闭“monlist”命令。

## 修改配置文件,将“ noquery”指令添加到系统ntp.conf中,保存后重新启动ntp服务。

root@zz:# cat /etc/ntp.conf | grep "# By default, " -A 3
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

root@zz:# /etc/init.d/ntp restart
 * Stopping NTP server ntpd                                              [ OK ] 
 * Starting NTP server ntpd                                              [ OK ] 
root@zz:# 


## 漏洞复测
λ nmap -sU -sV -Pn -p 123 --script="ntp-monlist" 192.168.43.58
Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower.
Starting Nmap 7.91 ( https://nmap.org ) at 2021-04-19 17:55 ?D1ú±ê×?ê±??
Nmap scan report for 192.168.43.58
Host is up (0.0021s latency).

PORT    STATE SERVICE VERSION
123/udp open  ntp     NTP v4 (unsynchronized)
MAC Address: 00:0C:29:3E:BA:70 (VMware)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 12.18 seconds
posted @ 2021-04-19 18:00  一曲天地远  阅读(294)  评论(0编辑  收藏  举报