> For the complete documentation index, see [llms.txt](https://hacktricks.xsx.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacktricks.xsx.tw/generic-methodologies-and-resources/pentesting-network/ids-evasion.md).

# IDS and IPS Evasion

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS红队专家）</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上关注我们 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**。**
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。

</details>

## **TTL操纵**

发送一些具有足够TTL以到达IDS/IPS但不足以到达最终系统的数据包。然后，发送另一个具有与其他数据包相同序列的数据包，以便IPS/IDS会认为它们是重复的并不会检查它们，但实际上它们携带了恶意内容。

**Nmap选项：** `--ttlvalue <value>`

## 避免签名

只需向数据包添加垃圾数据，以避免IPS/IDS签名。

**Nmap选项：** `--data-length 25`

## **分段数据包**

只需分段数据包并发送它们。如果IDS/IPS无法重新组装它们，它们将到达最终主机。

**Nmap选项：** `-f`

## **无效** ***校验和***

传感器通常不会计算校验和以提高性能。因此，攻击者可以发送一个数据包，该数据包将被传感器解释但被最终主机拒绝。示例：

发送一个带有RST标志和无效校验和的数据包，因此，IPS/IDS可能会认为此数据包将关闭连接，但最终主机将丢弃该数据包，因为校验和无效。

## **不常见的IP和TCP选项**

传感器可能会忽略在IP和TCP头中设置的某些标志和选项的数据包，而目标主机在接收后接受该数据包。

## **重叠**

当您分段数据包时，可能存在某种重叠（也许数据包2的前8个字节与数据包1的最后8个字节重叠，数据包2的最后8个字节与数据包3的前8个字节重叠）。然后，如果IDS/IPS以与最终主机不同的方式重新组装它们，将解释为不同的数据包。\
或者，也许，两个具有相同偏移量的数据包到达，主机必须决定采用哪一个。

* **BSD**：它偏好具有较小**偏移量**的数据包。对于具有相同偏移量的数据包，它将选择第一个数据包。
* **Linux**：与BSD类似，但它更喜欢具有相同偏移量的最后一个数据包。
* **First**（Windows）：来的第一个值，就是留下的值。
* **Last**（思科）：来的最后一个值，就是留下的值。

## 工具

* <https://github.com/vecna/sniffjoke>

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS红队专家）</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上关注我们 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**。**
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。

</details>
