Debian 8.6의 Ghost NTP 서버

Debian 8.6의 Ghost NTP 서버

그래서 대학 IT 보안팀과 저는 이 문제에 대해 끊임없이 논의해 왔습니다. 혹시 이에 대해 생각하시는 분 계시나요?

나는 최근에 전용 컴퓨터(Intel Avoton C2550 프로세서 - 필요한 경우 더 많은 하드웨어 정보를 제공할 수 있어서 기쁘지만 꼭 필요한 것은 아니라고 생각합니다)에서 Debian 8.6을 실행하는 작은 파일 서버를 연구실에 설치했습니다. Debian은 아무 문제 없이 설치되었으며 당시에는 Samba, NTP, ZFS 및 Python도 설치되어 있었습니다. 모든 것이 잘 작동하는 것 같아서 몇 주 동안 연구실 한구석에서 실행해 보았습니다.

약 2주 전에 IT 팀으로부터 내 서버가 "손상"되었으며 NTP 증폭/DDoS 공격(설명된 대로 CVE-2013-5211을 사용하는 NTP 증폭 공격)에 취약하다는 내용의 이메일을 받았습니다.https://www.us-cert.gov/ncas/alerts/TA14-013A). 그들이 지적한 징후는 포트 123에 NTPv2 트래픽이 많다는 것입니다. 이상하게도 ()에서 식별한 IP 주소는 내 서버가 ifconfig()를 통해 *.*.*.233구성하고 보고한 IP 주소와 다릅니다 . *.*.*.77그럼에도 불구하고 몇 가지 기본적인 문제 해결을 통해 내 컴퓨터가 실제로 포트 123에서 이 트래픽을 생성하고 있음이 나타났습니다(tcpdump에 표시됨).

여기서부터 이상한 일이 시작됩니다. 먼저 CVE-2013-5211에 대해 권장되는 "수정"을 수행했습니다(둘 다 NTP 버전 4.2.7을 업데이트하고 monlist 기능을 비활성화했습니다). 교통 흐름도 멈추지 않았습니다. 그런 다음 IP 테이블을 통해 UDP 123 포트를 차단해 보았습니다.

$ /sbin/iptables -A INPUT -o eth0 -p udp --destination-port 123 -j DROP
$ /sbin/iptables -A OUTPUT -o eth0 -p udp --destination-port 123 -j DROP

하지만 이 역시 트래픽에는 아무런 영향을 미치지 않습니다. 결국 시스템에서 NTP를 삭제하려고 시도했지만 트래픽에도 아무런 영향을 미치지 않았습니다. 오늘 오후 현재 nmap은 계속해서 다음을 보고하고 있습니다.

Starting Nmap 5.51 ( http://nmap.org ) at 2016-12-19 16:15 EST
Nmap scan report for *.233
Host is up (0.0010s latency).
PORT    STATE SERVICE
123/udp open  ntp
| ntp-monlist:
|   Public Servers (2)
|       50.116.52.97    132.163.4.101
|   Public Clients (39)
|       54.90.159.15    185.35.62.119   185.35.62.233   185.35.63.86
|       54.197.89.98    185.35.62.142   185.35.62.250   185.35.63.108
|       128.197.24.176  185.35.62.144   185.35.62.251   185.35.63.128
|       180.97.106.37   185.35.62.152   185.35.63.15    185.35.63.145
|       185.35.62.27    185.35.62.159   185.35.63.27    185.35.63.146
|       185.35.62.52    185.35.62.176   185.35.63.30    185.35.63.167
|       185.35.62.65    185.35.62.186   185.35.63.34    185.35.63.180
|       185.35.62.97    185.35.62.194   185.35.63.38    185.35.63.183
|       185.35.62.106   185.35.62.209   185.35.63.39    185.35.63.185
|_      185.35.62.117   185.35.62.212   185.35.63.43

NTP가 몇 주 동안 시스템에서 제거되었기 때문에 이는 이상합니다.

이 경로에서 막다른 골목에 부딪힌 후 전체 IP 주소 불일치 문제에 대해 생각하기 시작했습니다. 내 컴퓨터는 *.233 및 *.77 IP에 모두 있는 것으로 보이지만(이더넷 케이블이 연결된 상태에서 두 IP를 모두 성공적으로 ping하여 확인했으며 케이블을 제거한 후에는 둘 다 사용할 수 없음) ifconfig에 * .233이 나타나지 않습니다.

Link encap:Ethernet  HWaddr d0:XX:XX:51:78:XX  
inet addr:*.77  Bcast:*.255  Mask:255.255.255.0
inet6 addr: X::X:X:X:787a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:23023571 errors:0 dropped:1362 overruns:0 frame:0
TX packets:364849 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:7441732389 (6.9 GiB)  TX bytes:44699444 (42.6 MiB)
Memory:df300000-df37ffff 

/etc/network/interfaces에는 *.233에 대한 참조가 없으므로 이 IP 할당이 어디에서 왔는지 알 수 없습니다.

따라서 누군가가 나를 도울 수 있기를 바라는 잠재적으로 관련된 두 가지 질문이 있습니다. 1) 내 서버에서 뿌려지는 NTP 트래픽을 제거하고 IT를 방해하지 않게 하려면 어떻게 해야 합니까? 2) 내 서버가 위치한 두 번째 IP 주소는 어떻게 되나요? 어떻게 삭제하나요?

다들 감사 해요:)

업데이트: 요청한 대로: $iptables -L -v -n

Chain INPUT (policy ACCEPT 57 packets, 6540 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 27 packets, 2076 bytes)
 pkts bytes target     prot opt in     out     source               destination

그리고$ip addr ls

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether d0:50:99:51:78:7a brd ff:ff:ff:ff:ff:ff
    inet *.77/24 brd *.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet *.167/24 brd *.255 scope global secondary dynamic eth0
       valid_lft 24612sec preferred_lft 24612sec
    inet6 X::X:X:X:787a/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether d0:50:99:51:78:7b brd ff:ff:ff:ff:ff:ff

업데이트 2: IP 주소가 일치하지 않을 뿐만 아니라 MAC ID도 일치하지 않는다는 점을 언급하지 못했습니다. 이로 인해 트래픽이 실제로 내 컴퓨터에서 나오는지 다시 생각하게 되었습니다. 그러나 (1) 네트워크에서 서버를 분리하면 트래픽이 사라지고 (2) 다른 네트워크 포트로 이동하고 (3) tcpdump port 123비정상적인 트래픽이 표시됩니다.

13:24:33.329514 IP cumm024-0701-dhcp-233.bu.edu.ntp > 183.61.254.77.44300: NTPv2, Reserved, length 440
13:24:33.329666 IP cumm024-0701-dhcp-233.bu.edu.ntp > 183.61.254.77.44300: NTPv2, Reserved, length 440
13:24:33.329777 IP cumm024-0701-dhcp-233.bu.edu.ntp > 183.61.254.77.44300: NTPv2, Reserved, length 296

업데이트 3: $ss -uapn 'sport = :123'

State      Recv-Q Send-Q                  Local Address:Port                    Peer Address:Port 

(즉, 아무것도 아니다)

$sudo cat /proc/net/dev

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:  327357    5455    0    0    0     0          0         0   327357    5455    0    0    0     0       0          0
  eth1:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0: 13642399917 36270491    0 6522    0     0          0   2721337 45098276  368537    0    0    0     0       0          0

업데이트 4: 이 패킷은 며칠 전부터 일반적이었습니다. 오늘(그러나 여전히 높음):

20:19:37.011762 IP cumm024-0701-dhcp-233.bu.edu.ntp > 103.56.63.147.26656: NTPv2, Reserved, length 152
20:19:37.011900 IP cumm024-0701-dhcp-233.bu.edu.ntp > 202.83.122.78.58066: NTPv2, Reserved, length 152
20:19:37.012036 IP cumm024-0701-dhcp-233.bu.edu.ntp > 103.56.63.147.17665: NTPv2, Reserved, length 152
20:19:37.014539 IP cumm024-0701-dhcp-233.bu.edu.ntp > 202.83.122.78.27945: NTPv2, Reserved, length 152
20:19:37.015482 IP cumm024-0701-dhcp-233.bu.edu.ntp > 202.83.122.78.42426: NTPv2, Reserved, length 152
20:19:37.015644 IP cumm024-0701-dhcp-233.bu.edu.ntp > 103.56.63.147.16086: NTPv2, Reserved, length 152

$ sudo ss -uapn '( sport = :42426 or dport = :42426 )'
State       Recv-Q Send-Q                                                        Local Address:Port                                                          Peer Address:Port 

예, *.233 IP를 ping할 수 있습니다.

$ping 128.197.112.233
PING 128.197.112.233 (128.197.112.233) 56(84) bytes of data.
64 bytes from 128.197.112.233: icmp_seq=1 ttl=64 time=0.278 ms
64 bytes from 128.197.112.233: icmp_seq=2 ttl=64 time=0.282 ms
64 bytes from 128.197.112.233: icmp_seq=3 ttl=64 time=0.320 ms

아니요, MAC이 내 하드웨어 MAC 주소와 일치하지 않습니다: d0:50:99:51:78:7a MAC과 관련된 트래픽: bc:5f:f4:fe:a1:00

업데이트 5: 요청에 따라 *.233에 대한 포트 스캔:

Starting Nmap 6.00 ( http://nmap.org ) at 2016-12-20 20:38 EET
NSE: Loaded 17 scripts for scanning.
Initiating SYN Stealth Scan at 20:38
Scanning cumm024-0701-dhcp-233.bu.edu (128.197.112.233) [1024 ports]
Discovered open port 22/tcp on 128.197.112.233
Completed SYN Stealth Scan at 20:38, 9.79s elapsed (1024 total ports)
Initiating Service scan at 20:38
Scanning 1 service on cumm024-0701-dhcp-233.bu.edu (128.197.112.233)
Completed Service scan at 20:38, 0.37s elapsed (1 service on 1 host)
Initiating OS detection (try #1) against cumm024-0701-dhcp-233.bu.edu (128.197.112.233)
Initiating Traceroute at 20:38
Completed Traceroute at 20:38, 0.10s elapsed
NSE: Script scanning 128.197.112.233.

[+] Nmap scan report for cumm024-0701-dhcp-233.bu.edu (128.197.112.233)
Host is up (0.083s latency).
Not shown: 1013 filtered ports

PORT    STATE  SERVICE VERSION
21/tcp  closed ftp
22/tcp  open   ssh     OpenSSH 5.5p1 Debian 6+squeeze1 (protocol 2.0)
23/tcp  closed telnet
25/tcp  closed smtp
43/tcp  closed whois
80/tcp  closed http
105/tcp closed unknown
113/tcp closed ident
210/tcp closed z39.50
443/tcp closed https
554/tcp closed rtsp

Device type: general purpose
Running: Linux 2.6.X
OS CPE: cpe:/o:linux:kernel:2.6
OS details: DD-WRT v24-sp2 (Linux 2.6.19)
Uptime guess: 45.708 days (since Sat Nov  5 03:39:36 2016)
Network Distance: 9 hops
TCP Sequence Prediction: Difficulty=204 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: OS: Linux; CPE: cpe:/o:linux:kernel


TRACEROUTE (using port 25/tcp)
HOP RTT      ADDRESS
1   0.95 ms  router1-lon.linode.com (212.111.33.229)
2   0.70 ms  109.74.207.0
3   1.09 ms  be4464.ccr21.lon01.atlas.cogentco.com (204.68.252.85)
4   1.00 ms  be2871.ccr42.lon13.atlas.cogentco.com (154.54.58.185)
5   63.45 ms be2983.ccr22.bos01.atlas.cogentco.com (154.54.1.178)
6   63.60 ms TrusteesOfBostonUniversity.demarc.cogentco.com (38.112.23.118)
7   63.55 ms comm595-core-res01-gi2-3-cumm111-bdr-gw01-gi1-2.bu.edu (128.197.254.125)
8   63.61 ms cumm024-dist-aca01-gi5-2-comm595-core-aca01-gi2-2.bu.edu (128.197.254.206)
9   90.28 ms cumm024-0701-dhcp-233.bu.edu (128.197.112.233)

OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .

Nmap done: 1 IP address (1 host up) scanned in 20.73 seconds
           Raw packets sent: 557 (25.462KB) | Rcvd: 97 (8.560KB)

UDP의 경우:

Starting Nmap 6.00 ( http://nmap.org ) at 2016-12-20 20:44 EET
NSE: Loaded 17 scripts for scanning.
Initiating Ping Scan at 20:44
Scanning 128.197.112.233 [4 ports]
Completed Ping Scan at 20:44, 1.10s elapsed (1 total hosts)
Initiating UDP Scan at 20:44
Scanning cumm024-0701-dhcp-233.bu.edu (128.197.112.233) [1024 ports]
Completed UDP Scan at 20:44, 6.31s elapsed (1024 total ports)
Initiating Service scan at 20:44
Scanning 1024 services on cumm024-0701-dhcp-233.bu.edu (128.197.112.233)
Service scan Timing: About 0.39% done
Service scan Timing: About 3.12% done; ETC: 22:12 (1:25:46 remaining)
Service scan Timing: About 6.05% done; ETC: 21:53 (1:04:39 remaining)
Service scan Timing: About 8.98% done; ETC: 21:46 (0:56:03 remaining)
Discovered open port 123/udp on 128.197.112.233
Discovered open|filtered port 123/udp on cumm024-0701-dhcp-233.bu.edu (128.197.112.233) is actually open
Completed Service scan at 21:31, 2833.50s elapsed (1024 services on 1 host)
Initiating OS detection (try #1) against cumm024-0701-dhcp-233.bu.edu (128.197.112.233)
Retrying OS detection (try #2) against cumm024-0701-dhcp-233.bu.edu (128.197.112.233)
NSE: Script scanning 128.197.112.233.
Initiating NSE at 21:31
Completed NSE at 21:31, 10.02s elapsed

[+] Nmap scan report for cumm024-0701-dhcp-233.bu.edu (128.197.112.233)
Host is up (0.089s latency).
Not shown: 1023 open|filtered ports

PORT    STATE SERVICE VERSION
123/udp open  ntp?

1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :
SF-Port123-UDP:V=6.00%I=7%D=12/20%Time=58597D5C%P=x86_64-unknown-linux-gnu
SF:%r(NTPRequest,30,"\xe4\x02\x04\xee\0\0\x8a\xff\0:t\xd9\x84\xa3\x04e\xdb
SF:\xcaeEX\xdbC'\xc5O#Kq\xb1R\xf3\xdc\x03\xfb\xb8\+>U\xab\xdc\x03\xfb\xb8\
SF:+T\xd1\xe9")%r(Citrix,C,"\xde\xc0\x010\x02\0\xa8\xe3\0\0\0\0");

Too many fingerprints match this host to give specific OS details
Network Distance: 9 hops

OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .

Nmap done: 1 IP address (1 host up) scanned in 2863.89 seconds
           Raw packets sent: 175 (6.720KB) | Rcvd: 50 (10.088KB)

답변1

이는 IPMI가 있는 서버급 시스템입니다. 문제를 일으키는 "유령" NTP 서버는 메인 CPU가 아닌 시스템의 BMC 프로세서에서 실행되고 있습니다.

답변2

이미 말했듯이 IPMI BMC가 (아마도) 문제일 것입니다. IPMI 인터페이스의 웹 인터페이스나 SSH 인터페이스에 접근할 수 없는 경우, 설치된 Debian에서 IPMI 도구를 사용하여 다음에 접근할 수 있습니다:

apt install ipmitool

설치한 후에는 다음과 같이 BMC(포트 1에 있는 경우)에 명령을 전달할 수 있습니다.

ipmitool lan set 1 ipaddr 192.168.1.211

이것은 리소스입니다IPMI 네트워크 구성을 위해 IPMITool 사용. man ipmitool막막할 때마다 읽으면 좋은 책입니다...

당신은 할 수BMC 재설정필요한 경우.

관련 정보