hacktricks/src/pentesting-web/timing-attacks.md

40 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Timing Attacks
{{#include ../banners/hacktricks-training.md}}
> [!WARNING]
> 要深入了解此技术,请查看原始报告 [https://portswigger.net/research/listen-to-the-whispers-web-timing-attacks-that-actually-work](https://portswigger.net/research/listen-to-the-whispers-web-timing-attacks-that-actually-work)
## Basic Information
时序攻击的基本目标是通过**检查相似请求的响应时间差异**来回答复杂问题或检测隐藏功能。
传统上,这一直非常复杂,因为网络和服务器引入的延迟和抖动。然而,自从发现和改进了[**Race Condition Single Packet attack**](race-condition.md#http-2-single-packet-attack-vs.-http-1.1-last-byte-synchronization)后,可以使用此技术将所有网络延迟噪声从方程中去除。\
只留下**服务器延迟**使得时序攻击更容易被发现和利用。
## Discoveries
### Hidden Attack Surface
在博客文章中提到,使用此技术可以找到隐藏参数甚至头部,只需检查每当参数或头部出现在请求中时,**时间差约为5毫秒**。实际上这种发现技术已被添加到Burp Suite的**Param Miner**中。
这些时间差可能是因为**DNS请求**被执行,某些**日志被写入**因为无效输入,或者因为在请求中存在参数时执行了一些**检查**。
在执行这种攻击时需要记住的一点是,由于表面的隐藏性质,您可能不知道时间差的实际原因。
### Reverse Proxy Misconfigurations
在同一研究中分享了时序技术非常适合发现“范围内的SSRF”只能访问允许的IP/域的SSRF。只需**检查设置允许域时的时间差**与设置不允许域时的时间差,有助于发现开放代理,即使响应相同。
一旦发现范围内的开放代理,就可以通过解析目标的已知子域找到有效目标,这使得:
- **绕过防火墙**,通过**开放代理**访问受限子域,而不是通过互联网
- 此外,利用**开放代理**,还可以**发现仅在内部可访问的新子域。**
- **前端冒充攻击**:前端服务器通常会为后端添加头部,如`X-Forwarded-For``X-Real-IP`。接收这些头部的开放代理将其添加到请求的端点,因此,攻击者可以通过添加这些头部与白名单值来访问更多内部域。
## References
- [https://portswigger.net/research/listen-to-the-whispers-web-timing-attacks-that-actually-work](https://portswigger.net/research/listen-to-the-whispers-web-timing-attacks-that-actually-work)
{{#include ../banners/hacktricks-training.md}}