mirror of
https://github.com/carlospolop/hacktricks
synced 2024-12-12 22:33:13 +00:00
227 lines
11 KiB
Markdown
227 lines
11 KiB
Markdown
# 123/udp - NTP渗透测试
|
||
|
||
<details>
|
||
|
||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks云 ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||
|
||
* 你在一家**网络安全公司**工作吗?想要在HackTricks中看到你的**公司广告**吗?或者你想要**获取PEASS的最新版本或下载HackTricks的PDF**吗?请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
||
* 发现我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品- [**The PEASS Family**](https://opensea.io/collection/the-peass-family)
|
||
* 获取[**官方PEASS和HackTricks周边产品**](https://peass.creator-spring.com)
|
||
* **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord群组**](https://discord.gg/hRep4RUj7f) 或 [**telegram群组**](https://t.me/peass) 或 **关注**我在**Twitter**上的[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||
* **通过向** [**hacktricks repo**](https://github.com/carlospolop/hacktricks) **和** [**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **提交PR来分享你的黑客技巧。**
|
||
|
||
</details>
|
||
|
||
<figure><img src="../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
|
||
|
||
**HackenProof是所有加密漏洞赏金的家园。**
|
||
|
||
**无需等待即可获得奖励**\
|
||
HackenProof的赏金只有在客户存入奖励预算后才会启动。在漏洞验证后,您将获得奖励。
|
||
|
||
**在web3渗透测试中积累经验**\
|
||
区块链协议和智能合约是新的互联网!在其兴起的时代掌握web3安全。
|
||
|
||
**成为web3黑客传奇**\
|
||
每次验证的漏洞都会获得声誉积分,并占据每周排行榜的榜首。
|
||
|
||
[**在HackenProof上注册**](https://hackenproof.com/register)开始从您的黑客攻击中获利!
|
||
|
||
{% embed url="https://hackenproof.com/register" %}
|
||
|
||
## 基本信息
|
||
|
||
网络时间协议(**NTP**)是一种用于在分组交换、可变延迟数据网络上进行计算机系统时钟同步的网络协议。
|
||
|
||
**默认端口:** 123/udp
|
||
```
|
||
PORT STATE SERVICE REASON
|
||
123/udp open ntp udp-response
|
||
```
|
||
## 枚举
|
||
|
||
### NTP Enumeration
|
||
|
||
### NTP 枚举
|
||
|
||
NTP (Network Time Protocol) is a protocol used to synchronize the clocks of computers over a network. It is commonly used to ensure accurate timekeeping on computer systems.
|
||
|
||
NTP (Network Time Protocol) 是一种用于在网络上同步计算机时钟的协议。它通常用于确保计算机系统的准确时间。
|
||
|
||
#### NTP Enumeration with nmap
|
||
|
||
#### 使用 nmap 进行 NTP 枚举
|
||
|
||
Nmap can be used to perform NTP enumeration by scanning for open NTP ports (123/udp) on target systems. This can be done using the following command:
|
||
|
||
可以使用 nmap 扫描目标系统上的开放 NTP 端口(123/udp)来执行 NTP 枚举。可以使用以下命令完成此操作:
|
||
|
||
```plaintext
|
||
nmap -p 123 -sU <target>
|
||
```
|
||
|
||
#### NTP Enumeration with ntpq
|
||
|
||
#### 使用 ntpq 进行 NTP 枚举
|
||
|
||
The `ntpq` command-line utility can also be used to perform NTP enumeration. It allows you to query NTP servers for information about their configuration and status. To use `ntpq`, you can run the following command:
|
||
|
||
`ntpq` 命令行实用程序也可以用于执行 NTP 枚举。它允许您查询 NTP 服务器以获取有关其配置和状态的信息。要使用 `ntpq`,可以运行以下命令:
|
||
|
||
```plaintext
|
||
ntpq -p <target>
|
||
```
|
||
|
||
This will display a list of NTP servers and their associated information, such as the server's IP address, stratum level, and reachability.
|
||
|
||
这将显示 NTP 服务器的列表及其相关信息,例如服务器的 IP 地址、层级和可达性。
|
||
|
||
#### NTP Enumeration with ntptrace
|
||
|
||
#### 使用 ntptrace 进行 NTP 枚举
|
||
|
||
The `ntptrace` command-line utility can be used to trace the path of NTP packets from the local system to a target NTP server. This can help identify the NTP servers in the network and their relationships. To use `ntptrace`, you can run the following command:
|
||
|
||
`ntptrace` 命令行实用程序可用于跟踪从本地系统到目标 NTP 服务器的 NTP 数据包的路径。这可以帮助识别网络中的 NTP 服务器及其关系。要使用 `ntptrace`,可以运行以下命令:
|
||
|
||
```plaintext
|
||
ntptrace <target>
|
||
```
|
||
|
||
This will display the path of NTP packets and the IP addresses of the NTP servers along the way.
|
||
|
||
这将显示 NTP 数据包的路径以及沿途的 NTP 服务器的 IP 地址。
|
||
|
||
#### NTP Enumeration with ntpdc
|
||
|
||
#### 使用 ntpdc 进行 NTP 枚举
|
||
|
||
The `ntpdc` command-line utility can be used to query and control an NTP server. It provides various commands to retrieve information about the server's configuration and status. To use `ntpdc`, you can run the following command:
|
||
|
||
`ntpdc` 命令行实用程序可用于查询和控制 NTP 服务器。它提供了各种命令来获取有关服务器配置和状态的信息。要使用 `ntpdc`,可以运行以下命令:
|
||
|
||
```plaintext
|
||
ntpdc -c monlist <target>
|
||
```
|
||
|
||
This will display a list of the last 600 clients that have connected to the NTP server, along with their IP addresses and timestamps.
|
||
|
||
这将显示最近连接到 NTP 服务器的最后 600 个客户端的列表,以及它们的 IP 地址和时间戳。
|
||
|
||
### NTP Enumeration with Metasploit
|
||
|
||
### 使用 Metasploit 进行 NTP 枚举
|
||
|
||
Metasploit, a popular penetration testing framework, also provides modules for NTP enumeration. These modules can be used to scan for NTP servers, gather information about them, and even exploit vulnerabilities if any are found.
|
||
|
||
Metasploit 是一个流行的渗透测试框架,还提供了用于 NTP 枚举的模块。这些模块可用于扫描 NTP 服务器、收集有关它们的信息,甚至在发现漏洞时利用它们。
|
||
|
||
To use Metasploit for NTP enumeration, you can follow these steps:
|
||
|
||
要使用 Metasploit 进行 NTP 枚举,可以按照以下步骤进行操作:
|
||
|
||
1. Start Metasploit by running the `msfconsole` command.
|
||
|
||
运行 `msfconsole` 命令启动 Metasploit。
|
||
|
||
2. Search for NTP-related modules using the `search` command.
|
||
|
||
使用 `search` 命令搜索与 NTP 相关的模块。
|
||
|
||
3. Select a module that suits your needs and load it using the `use` command.
|
||
|
||
选择适合您需求的模块,并使用 `use` 命令加载它。
|
||
|
||
4. Set the required options for the module using the `set` command.
|
||
|
||
使用 `set` 命令设置模块的必需选项。
|
||
|
||
5. Run the module using the `run` command.
|
||
|
||
使用 `run` 命令运行模块。
|
||
|
||
6. Review the results and gather the necessary information.
|
||
|
||
查看结果并收集必要的信息。
|
||
|
||
Metasploit provides a wide range of NTP enumeration modules, allowing you to choose the most suitable one for your specific needs.
|
||
|
||
Metasploit 提供了广泛的 NTP 枚举模块,使您可以根据特定需求选择最合适的模块。
|
||
```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攻击的工作原理**](https://resources.infosecinstitute.com/network-time-protocol-ntp-threats-countermeasures/#gref)
|
||
|
||
NTP协议的设计使用UDP进行操作,不需要像TCP那样进行握手,因此没有请求的记录。因此,NTP DDoS放大攻击开始于攻击者伪造带有欺骗性源IP的数据包,使数据包看起来来自目标服务器,并将其发送到NTP服务器。攻击者最初构造了几个字节的数据包,但NTP会以大量数据进行响应,从而放大了这次攻击。
|
||
|
||
_MONLIST命令_:这是一个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) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks.
|
||
|
||
https://book.hacktricks.xyz/pentesting/pentesting-ntp
|
||
|
||
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}
|
||
```
|
||
<figure><img src="../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
|
||
|
||
**HackenProof是所有加密漏洞赏金的家园。**
|
||
|
||
**即时获得奖励**\
|
||
HackenProof的赏金只有在客户存入奖励预算后才会启动。在漏洞验证后,您将获得奖励。
|
||
|
||
**在web3渗透测试中积累经验**\
|
||
区块链协议和智能合约是新的互联网!在其兴起的时代掌握web3安全。
|
||
|
||
**成为web3黑客传奇**\
|
||
每次验证的漏洞都会获得声望积分,并登上每周排行榜的榜首。
|
||
|
||
[**在HackenProof上注册**](https://hackenproof.com/register)并从您的黑客攻击中获利!
|
||
|
||
{% embed url="https://hackenproof.com/register" %}
|
||
|
||
<details>
|
||
|
||
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks云 ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 推特 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
|
||
|
||
* 您在**网络安全公司**工作吗?您想在HackTricks中看到您的**公司广告**吗?或者您想获得**PEASS的最新版本或下载PDF格式的HackTricks**吗?请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
||
* 发现我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品[**The PEASS Family**](https://opensea.io/collection/the-peass-family)
|
||
* 获得[**官方PEASS和HackTricks周边产品**](https://peass.creator-spring.com)
|
||
* **加入**[**💬**](https://emojipedia.org/speech-balloon/) [**Discord群组**](https://discord.gg/hRep4RUj7f)或[**电报群组**](https://t.me/peass),或在**Twitter**上**关注**我[**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks\_live)**。**
|
||
* **通过向**[**hacktricks repo**](https://github.com/carlospolop/hacktricks) **和**[**hacktricks-cloud repo**](https://github.com/carlospolop/hacktricks-cloud) **提交PR来分享您的黑客技巧。**
|
||
|
||
</details>
|