123/udp - Pentesting NTP - HackTricks

# 123/udp - Pentesting NTP

> [!TIP] Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
> Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

> Support HackTricks
> - Check the subscription plans!
> - Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
> - Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.

## Basic Information

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.

### Summary & Security Tips:

- Purpose: Syncs device clocks over networks.
- Importance: Critical for security, logging, and operations.
- Security Measures:
  - Use trusted NTP sources with authentication.
  - Limit NTP server network access.
  - Monitor synchronization for signs of tampering.

Default port: 123/udp

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

## Enumeration

    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>

    nmap -sU -sV --script "ntp* and (discovery or vuln) and not (dos or brute)" -p 123 <IP>

## Examine configuration files

- ntp.conf

## NTP Amplification Attack

How NTP DDoS Attack Works

The NTP protocol, using UDP, allows for operation without the need for handshake procedures, unlike TCP. This characteristic is exploited in NTP DDoS amplification attacks. Here, attackers create packets with a fake source IP, making it seem as if the attack requests come from the victim. These packets, initially small, prompt the NTP server to respond with much larger data volumes, amplifying the attack.

The MONLIST command, despite its rare use, can report the last 600 clients connected to the NTP service. While the command itself is simple, its misuse in such attacks highlights critical security vulnerabilities.

    ntpdc -n -c monlist <IP>

## Shodan

- `ntp`

## HackTricks Automatic Commands

    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] Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
> Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

> Support HackTricks
> - Check the subscription plans!
> - Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
> - Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.