asish80/HollowByte-OpenSSL-scanner-

GitHub: asish80/HollowByte-OpenSSL-scanner-

一款用于检测 OpenSSL HollowByte 拒绝服务漏洞的 Python 扫描工具,通过版本指纹与行为分析判断服务器是否存在风险。

Stars: 0 | Forks: 0

hollow byte openssl 漏洞扫描器。 # HollowByte OpenSSL Scanner 一个基于 Python 的检测工具,用于发现由 [Okta Red Team](https://sec.okta.com/articles/2026/06/openssl-hollowbtye-a-dos-hiding-in-11-bytes/) 披露的 OpenSSL **HollowByte** 拒绝服务漏洞。 HollowByte 允许远程、未经身份验证的攻击者发送 11 字节的恶意 TLS payload,迫使未打补丁的 OpenSSL 服务器为每个连接预分配高达 131 KB 的内存——由于 glibc 堆碎片化,这些内存将永远无法被回收。 该工具通过版本指纹识别、行为定时分析以及可选的本地内存跟踪,来检测服务器是否存在此漏洞。 ## 为什么开发此工具 - **目前尚未分配 CVE 编号** —— 传统的扫描器不会标记它。 - **尚未发布安全公告** —— 补丁管理流程不会优先处理它。 该扫描器通过结合多种检测策略填补了这一空白,即使服务器隐藏了其版本,这些策略依然有效。 ## 工作原理 扫描器运行一个 5 步分析 pipeline: | 步骤 | 方法 | 检测内容 | |------|--------|-----------------| | **1. TLS 握手** | 标准 TLS 连接 | 确认目标可达且支持 TLS | | **2. 远程指纹识别** | HTTP header 解析 | 从 `Server` header 中提取 OpenSSL 版本;识别非 OpenSSL 协议栈(如 SChannel、BoringSSL、s2n-tls)为不受影响 | | **3. 行为分析** | 构造数据包计时 | 发送 11 字节的 HollowByte payload 并测量服务器保持连接的时间(对比随机垃圾数据);测试 2 KB–128 KB 声明大小下的依赖行为 | | **4. 数据包洪泛** | 连接波次 | 发送多波构造的连接;如果提供了本地 PID,则跟踪 RSS 内存增长 | | **5. 判定** | 多信号融合 | 综合版本、计时、大小相关性和内存证据,得出最终判定 | ### 关键检测信号:依赖大小的行为 最强的指标是**大小相关性**——存在漏洞的 OpenSSL 服务器会为较小的声明大小保持连接,但会拒绝高于特定阈值的请求。没有任何其他 TLS 协议栈(SChannel、BoringSSL、s2n-tls、已打补丁的 OpenSSL)表现出这种行为。这使得即使在不知道服务器版本的情况下,检测结果也是明确的。 ## 安装说明 无需外部依赖——仅使用 Python 标准库。 ``` git clone https://github.com/asish80/HollowByte-OpenSSL-scanner-.git cd HollowByte-OpenSSL-scanner- ``` **可选依赖**(用于增强功能): ``` pip install psutil # Local process memory tracking pip install cryptography # Self-signed cert generation for --auto mode ``` **环境要求:** Python 3.7+ ## 用法 ### 扫描远程服务器 ``` python hollowbyte_ooenssl.py --host 10.0.0.50 --port 443 ``` ### 通过本地内存跟踪进行扫描 如果目标在本地运行且您知道服务器的 PID: ``` python hollowbyte_ooenssl.py --host 127.0.0.1 --port 443 --pid 12345 ``` ### 自测模式 启动一个本地 TLS 服务器,并针对您系统自身的 OpenSSL 进行扫描: ``` python hollowbyte_ooenssl.py --auto ``` ### 将结果导出为 CSV ``` python hollowbyte_ooenssl.py --host 10.0.0.50 --port 443 --csv results.csv ``` ### 所有选项 ``` --host Target hostname or IP (default: 127.0.0.1) --port Target port (default: 4433) --auto Start a built-in test server and scan it --pid PID of the local process to track memory (optional) --waves Number of connection waves (default: 6) --per-wave Connections per wave (default: 25) --timing-rounds Rounds for behavioral timing test (default: 5) --timeout Timeout in seconds for behavioral test (default: 8) --csv Export memory tracking data to CSV ``` ## 示例输出 ``` ┌────────────────────────────────────────────────────────────────┐ │ HollowByte Tester v2 — Remote Server Detection │ ├────────────────────────────────────────────────────────────────┤ │ Target: 10.0.0.50:443 │ │ Platform: Linux 5.15.0 │ └────────────────────────────────────────────────────────────────┘ ═══ STEP 1: TLS handshake ═══ ✓ TLS handshake successful Protocol: TLSv1.3 Cipher: TLS_AES_256_GCM_SHA384 ═══ STEP 2: Remote server fingerprinting ═══ Server: nginx/1.24.0 ✓ Remote OpenSSL: 3.0.13 (VULNERABLE) ═══ STEP 3: Behavioral analysis (5 rounds) ═══ Part A: Alert analysis + timing 1 CRAFT 8.01s no response (held connection) 1 GARBAGE 0.02s handshake_failure Part B: Size correlation 2 KB 8.00s YES no response (held connection) 32 KB 8.01s YES no response (held connection) 128 KB 0.04s no handshake_failure ⚠ Size-dependent behavior detected! ═══ STEP 5: Post-test + Verdict ═══ ════════════════════════════════════════════════════════════════ RESULTS ════════════════════════════════════════════════════════════════ Verdict: VULNERABLE Remediation — upgrade OpenSSL: 3.0.x → 3.0.21+ 3.4.x → 3.4.6+ 3.5.x → 3.5.7+ 3.6.x → 3.6.3+ 4.0.x → 4.0.1+ ``` ## 判定级别 | 判定 | 含义 | |---------|---------| | **VULNERABLE (存在漏洞)** | 明确——已确认版本或检测到依赖大小的行为 | | **LIKELY VULNERABLE (极有可能存在漏洞)** | 有强烈的行为指标,但无版本确认 | | **POSSIBLY VULNERABLE (可能存在漏洞)** | 存在部分信号,需直接检查版本 | | **INCONCLUSIVE (无法确定)** | 无法判定——过长的 TCP 超时掩盖了信号 | | **LIKELY NOT VULNERABLE (可能不存在漏洞)** | 服务器在所有大小下均立即拒绝构造的数据包 | | **NOT VULNERABLE (不存在漏洞)** | 确认使用非 OpenSSL 的 TLS 协议栈或已打补丁的 OpenSSL 版本 | ## 受影响版本 在以下补丁发布版本之前的所有 OpenSSL 版本均存在漏洞: | 分支 | 已修复版本 | |--------|-----------------| | 4.0.x | 4.0.1 | | 3.6.x | 3.6.3 | | 3.5.x | 3.5.7 | | 3.4.x | 3.4.6 | | 3.0.x | 3.0.21 | 内置 OpenSSL 的软件(NGINX、Apache、Node.js、Python、Ruby、PHP、MySQL、PostgreSQL)也必须进行排查——仅靠操作系统级别的补丁无法修复内置的副本。 ## HollowByte 的工作原理 在 TLS 握手期间,每条消息都带有一个 4 字节的 header 用于声明主体大小。**在任何数据到达之前**,存在漏洞的 OpenSSL 版本会根据攻击者声明的长度调用 `grow_init_buf()` → `OPENSSL_clear_realloc()` → `malloc()`。单个 11 字节的数据包即可迫使服务器分配高达 131 KB 的内存。 当攻击者断开连接时,OpenSSL 会释放该 buffer,但 **glibc 并不会将内存归还给操作系统**——而是将其保留以备重用。通过发送具有随机声明大小的连接波次,攻击者阻止了内存块的重用,从而导致永久的堆碎片化。服务器的 RSS 会持续攀升,并且在进程重启之前永远无法恢复。 ## 重要说明 - **仅扫描您拥有或获得明确测试授权的服务器。** 数据包洪泛步骤会发送真实的构造流量。 - **在本地测试效果最佳。** 远程行为测试取决于网络条件和服务器配置。 - **这是一个检测工具,而非漏洞利用程序。** 它仅用于识别漏洞状态——不会尝试使目标崩溃或性能下降。 ## 参考 - [Okta Security — OpenSSL HollowByte: A DoS Hiding in 11 Bytes](https://sec.okta.com/articles/2026/06/openssl-hollowbtye-a-dos-hiding-in-11-bytes/) - [BleepingComputer — HollowByte DDoS flaw bloats OpenSSL server memory](https://www.bleepingcomputer.com/news/security/hollowbyte-ddos-flaw-bloats-openssl-server-memory-with-11-byte-payload/) - [The Hacker News — OpenSSL HollowByte Flaw Could Freeze Server Memory](https://thehackernews.com/2026/07/openssl-hollowbyte-flaw-could-freeze.html) - [OpenSSL 4.0.1 Release Notes](https://github.com/openssl/openssl/releases) - [OpenSSL Fix PRs — Incremental buffer growth](https://github.com/openssl/openssl) ## 许可证 MIT
标签:OpenSSL, Python, 加密, 安全测试工具, 底层编程, 拒绝服务检测, 插件系统, 无后门, 漏洞扫描器, 网络协议分析, 逆向工具