123/udp - Pentesting NTP

Reading time: 5 minutes

tip

AWSハッキングを学び、実践する:HackTricks Training AWS Red Team Expert (ARTE)
GCPハッキングを学び、実践する:HackTricks Training GCP Red Team Expert (GRTE) Azureハッキングを学び、実践する:HackTricks Training Azure Red Team Expert (AzRTE)

HackTricksをサポートする

基本情報

ネットワーク時間プロトコル (NTP) は、可変遅延ネットワーク上のコンピュータやネットワークデバイスが時計を正確に同期させることを保証します。これは、IT運用、セキュリティ、およびログ記録において正確な時間管理を維持するために重要です。NTPの正確性は不可欠ですが、適切に管理されない場合はセキュリティリスクも伴います。

概要とセキュリティのヒント:

  • 目的: ネットワークを介してデバイスの時計を同期させる。
  • 重要性: セキュリティ、ログ記録、および運用にとって重要。
  • セキュリティ対策:
  • 認証付きの信頼できるNTPソースを使用する。
  • NTPサーバーへのネットワークアクセスを制限する。
  • 改ざんの兆候がないか同期を監視する。

デフォルトポート: 123/udp

PORT    STATE SERVICE REASON
123/udp open  ntp     udp-response

列挙

bash
ntpq -c readlist <IP_ADDRESS>
ntpq -c readvar <IP_ADDRESS>
ntpq -c peers <IP_ADDRESS>
ntpq -c associations <IP_ADDRESS>
ntpdc -c monlist <IP_ADDRESS>
ntpdc -c listpeers <IP_ADDRESS>
ntpdc -c sysinfo <IP_ADDRESS>
bash
nmap -sU -sV --script "ntp* and (discovery or vuln) and not (dos or brute)" -p 123 <IP>

設定ファイルの確認

  • ntp.conf

NTP増幅攻撃

NTP DDoS攻撃の仕組み

NTPプロトコルは、UDPを使用しており、TCPとは異なり、ハンドシェイク手順なしで動作することができます。この特性は、NTP DDoS増幅攻撃で悪用されます。ここでは、攻撃者が偽のソースIPを持つパケットを作成し、攻撃リクエストが被害者から来ているように見せかけます。これらのパケットは最初は小さいですが、NTPサーバーははるかに大きなデータ量で応答し、攻撃を増幅させます。

_MONLIST_コマンドは、使用頻度は低いものの、NTPサービスに接続した最後の600クライアントを報告することができます。このコマンド自体は単純ですが、その悪用は重大なセキュリティ脆弱性を浮き彫りにします。

bash
ntpdc -n -c monlist <IP>

Shodan

  • ntp

HackTricks 自動コマンド

Protocol_Name: NTP    #Protocol Abbreviation if there is one.
Port_Number:  123     #Comma separated if there is more than one.
Protocol_Description: Network Time Protocol         #Protocol Abbreviation Spelled out

Entry_1:
Name: Notes
Description: Notes for NTP
Note: |
The Network Time Protocol (NTP) ensures computers and network devices across variable-latency networks sync their clocks accurately. It's vital for maintaining precise timekeeping in IT operations, security, and logging. NTP's accuracy is essential, but it also poses security risks if not properly managed.

https://book.hacktricks.wiki/en/network-services-pentesting/pentesting-ntp.html

Entry_2:
Name: Nmap
Description: Enumerate NTP
Command: nmap -sU -sV --script "ntp* and (discovery or vuln) and not (dos or brute)" -p 123 {IP}

tip

AWSハッキングを学び、実践する:HackTricks Training AWS Red Team Expert (ARTE)
GCPハッキングを学び、実践する:HackTricks Training GCP Red Team Expert (GRTE) Azureハッキングを学び、実践する:HackTricks Training Azure Red Team Expert (AzRTE)

HackTricksをサポートする