1. 程式人生 > >【安全牛學習筆記】NTP放大攻擊

【安全牛學習筆記】NTP放大攻擊

NTP放大攻擊                                                

網路時間協議                                               

    - Network Time Protocol                                 

    - 保證網路裝置時間同步                                  

    - 電子裝置相互干擾導致時鐘差異越來越大                  

    - 影響應用正常執行、日誌審計不可信                      

    - 服務埠 UDP 123                                      

攻擊原理                                                   

    - NTP服務提monlist (MON_GETLIST) 查詢功能               

      監控NTP伺服器的狀態                                  

    - 客戶端查詢時,NTP伺服器返回最後同步時間的 600 個客戶IP

      每6個IP個數據包,最多100個數據包(放大約100倍)

NTP放大攻擊                                                

發現NTP服務                                                

    - nmap -sU -p123 1.1.1.1 / 127.0.0.1                    

發現漏洞                                                   

    - ntpdc -n -c monlist 1.1.1.1                           

    - ntpq -c rv 1.1.1.1                                    

    - ntpdc -c sysinfo 192.168.20.5                         

配置檔案                                                   

    - /etc/ntp.conf                                        

      restrict -4 default kod nomodify notrap nopeer noquery

      restrict -6 default kod nomodify notrap nopeer noquery

yuanfh@Bodhi:~$ ifconfig

192.168.1.125

yuanfh@Bodhi:~$ sudo apt-get update

yuanfh@Bodhi:~$ sudo apt-get install ntp

yuanfh@Bodhi:~$ netstat -pantu | grep 123

(Not all processes could be identified, non-wened process info

 will not be shown, you would hava to be root to see it all.)

udp        0      0 192.168.1.125:123       0.0.0.0:*                            -

udp        0      0 127.0.0.1:123           0.0.0.0:*                            -

udp        0      0 0.0.0.0:123             0.0.0.0:*                            -

udp6       0      0 fe00::a00:27ff:fe78:123 :::*                                 -

udp6       0      0 ::1:123                 :::*                                 -

udp6       0      0 :::123                  :::*                                 -

root@K:~# nmap -sU -p123 192.168.1.0/24 --open

Startomh Nmap 7.12 (https://nmap.org) at 2016-06-28 06:38 EDT

Nmap scan report for 192.168.1.1

Host is up (0.0021s latency).

PORT    STATE         SERVICE

123/udp open|filtered ntp

MAC Address: 14:75:90:21:4F:56 (Tp-link Technologies)

Nmap scan report for 192.168.1.115

Host is up (0.0018s latency).

PORT    STATE         SERVICE

123/udp open|filtered ntp

MAC address: 78:920:9C:03:6F:18 (Intel Corporate)

Nmap scan report for 192.168.1.125

Host is up (0.0018s latency).

PORT    STATE         SERVICE

123/udp open|filtered ntp

MAC address: 08:00:27:78:23:0D (Oracle VirtualBox virtual NIC)

Nmap done: 256 IP addresses (4 hosts up) scanned in 4.79 seconds

root@K:~# nmap -sU -p123 -sv 192.168.1.125

Startomh Nmap 7.12 (https://nmap.org) at 2016-06-28 06:38 EDT

Nmap scan report for 192.168.1.125

Host is up (0.0018s latency).

PORT    STATE         SERVICE

123/udp open|filtered ntp

MAC address: 08:00:27:78:23:0D (Oracle VirtualBox virtual NIC)

Service detection performed. Please report any incorrect result at https://nmap.org/submit/ .

Nmap done: 1 IP addresses (4 hosts up) scanned in 1.36 seconds

root@K:~# ntpdc -n -c monlist 192.168.1.125    //不支援放大攻擊

192.168.1.125: time out, nothing received

***Request timed out

yuanfh@Bodhi:~$ sudo vi /etc/ntp.conf

restrict -4 default kod nomodify notrap nopeer noquery

restrict -6 default kod nomodify notrap nopeer noquery

把這兩行用#禁用掉!

yuanfh@Bodhi:~$ sudo service ntp

fore-reload  restart         start      status         stop          try-restart

yuanfh@Bodhi:~$ sudo service ntp stop

 * Stopping NTP server ntpd                                                          [ OK ]

yuanfh@Bodhi:~$ sudo service ntp start

 * Starting NTP server ntpd                                                          [ OK ]

root@K:~# ntpdc -n -c monlist 192.168.1.125

temote address          port local address      count m ver rstr avgint  lstint

===============================================================================

91.189.89.199           123 192.168.1.125            1 4 4     0      4       4

202.118.1.130           123 192.168.1.125            1 4 3     0      5       5

root@K:~# ntpdc -n -c monlist 192.168.1.125

temote address          port local address      count m ver rstr avgint  lstint

===============================================================================

91.189.89.199           123 192.168.1.125            1 4 4     0     29      29

202.118.1.130           123 192.168.1.125            1 4 3     0     30      30

root@K:~# ntpdc -n -c monlist 192.168.1.125

temote address          port local address      count m ver rstr avgint  lstint

===============================================================================

91.189.89.199           123 192.168.1.125            1 4 4     0     31      31

202.118.1.130           123 192.168.1.125            1 4 3     0     32      32

root@K:~# ntpq -c rv 192.168.1.125    //查詢伺服器端的配置

associd=0 status=c011 leap_alarm, sync_unspec, 1 event, freq_not_set,

version="ntpd [email protected] Thu Feb 11 18:30:40 UTC 2016 (1)",

processor="x86_64", system="Linux/4.2.0-30-generic", leap=11, stratum=16,

precision=-23, rootdelay=0.000, rootdisp=1.560, refid=INIT,

reftime=00000000.00000000 Thu, Feb  7 2036  1:28:16.00

clock-db1cd43a.f78cda79  Thu, Jun 28 2016  6:47:22.966, peer=0, tc=3,

minc=3, offset=0.000, frequency=0.00., sys_jitter=0.000

clk_jitter=0.000, clk_wander=0.000

root@K:~# ntpdc -c sysinfo 192.168.1.125     //查詢其他的系統資訊

system peer:          0.0.0.0

system peer mode:     unspce

leap indicator:       11

stratum:              16

precision:            -23

root distance:        0.00000 s

root dispersion:      0.00247 s

reference ID:         [73.78.73.84]

reference time:       00000000.00000000 Thu, Feb  7 2036  1:28:16.00

system flags:         auth monitor ntp kernel stats

jtter:                0.000000 s

stability:            0.000 ppm

broadcastdelay:       0.000000 s

autdelay:             0.000000 s

NTP放大攻擊                                                

NTP攻擊對策                                                

    - 升級到 ntpd 4.2.7p26 及以上的版本(預設關閉monlist查詢)

    - 手動關閉monlist查詢功能

該筆記為安全牛課堂學員筆記,想看此課程或者資訊保安類乾貨可以移步到安全牛課堂

Security+認證為什麼是網際網路+時代最火爆的認證?

      牛妹先給大家介紹一下Security+

        Security+ 認證是一種中立第三方認證,其發證機構為美國計算機行業協會CompTIA ;是和CISSP、ITIL 等共同包含在內的國際 IT 業 10 大熱門認證之一,和CISSP偏重資訊保安管理相比,Security+ 認證更偏重資訊保安技術和操作。

       通過該認證證明了您具備網路安全,合規性和操作安全,威脅和漏洞,應用程式、資料和主機安全,訪問控制和身份管理以及加密技術等方面的能力。因其考試難度不易,含金量較高,目前已被全球企業和安全專業人士所普遍採納。

Security+認證如此火爆的原因?  

       原因一:在所有資訊保安認證當中,偏重資訊保安技術的認證是空白的, Security+認證正好可以彌補資訊保安技術領域的空白 。

      目前行業內受認可的資訊保安認證主要有CISP和CISSP,但是無論CISP還是CISSP都是偏重資訊保安管理的,技術知識講的寬泛且淺顯,考試都是一帶而過。而且CISSP要求持證人員的資訊保安工作經驗都要5年以上,CISP也要求大專學歷4年以上工作經驗,這些要求無疑把有能力且上進的年輕人的持證之路堵住。在現實社會中,無論是找工作還是升職加薪,或是投標時候報人員,認證都是必不可少的,這給年輕人帶來了很多不公平。而Security+的出現可以掃清這些年輕人職業發展中的障礙,由於Security+偏重資訊保安技術,所以對工作經驗沒有特別的要求。只要你有IT相關背景,追求進步就可以學習和考試。

       原因二: IT運維人員工作與翻身的利器。

       在銀行、證券、保險、資訊通訊等行業,IT運維人員非常多,IT運維涉及的工作面也非常廣。是一個集網路、系統、安全、應用架構、儲存為一體的綜合性技術崗。雖然沒有程式猿們“生當做光棍,死亦寫程式碼”的悲壯,但也有著“鋤禾日當午,不如運維苦“的感慨。天天對著電腦和機器,時間長了難免有對於職業發展的迷茫和困惑。Security+國際認證的出現可以讓有追求的IT運維人員學習網路安全知識,掌握網路安全實踐。職業發展朝著網路安全的方向發展,解決國內資訊保安人才的匱乏問題。另外,即使不轉型,要做好運維工作,學習安全知識取得安全認證也是必不可少的。

        原因三:接地氣、國際範兒、考試方便、費用適中!

CompTIA作為全球ICT領域最具影響力的全球領先機構,在資訊保安人才認證方面是專業、公平、公正的。Security+認證偏重操作且和一線工程師的日常工作息息相關。適合銀行、證券、保險、網際網路公司等IT相關人員學習。作為國際認證在全球147個國家受到廣泛的認可。

        在目前的資訊保安大潮之下,人才是資訊保安發展的關鍵。而目前國內的資訊保安人才是非常匱乏的,相信Security+認證一定會成為最火爆的資訊保安認證。