在 OpenSSL 中启用 SSLv2 和 SSLv3 的简单方法?

在 OpenSSL 中启用 SSLv2 和 SSLv3 的简单方法?

这里全新安装了 Ubuntu 并尝试使用 SSLScan 工具,结果发现出现以下错误:

OpenSSL version does not support SSLv2
SSLv2 ciphers will not be detected

OpenSSL version does not support SSLv3
SSLv3 ciphers will not be detected
Testing SSL server xyzx on port 443

  TLS renegotiation:
Session renegotiation not supported

  TLS Compression:
OpenSSL version does not support compression
Rebuild with zlib1g-dev package for zlib support

我在网上找到了一些关于尝试重新编译 OpenSSL 而不明确禁用这些标志的文章,但我甚至无法完成其中一些指南中的前几个步骤。例如,一个指南建议运行sudo apt-get build-dep openssl。我无法运行它,因为这样我会收到以下错误:

[03.14.2017/23:47:31] user@box $ sudo apt-get build-dep openssl
Reading package lists... Done
E: You must put some 'source' URIs in your sources.list

尽管我的 /etc/apt/sources.list 文件中有许多未注释的源。

有什么建议吗?我只想启用 SSLv2 和 SSLv3,至少也启用压缩。我可以简单地重新启用所有已禁用的功能吗?

答案1

我的解决方案是仅构建 openssl 二进制文件以避免覆盖系统 OpenSSL 安装:

wget https://openssl.org/source/openssl-1.0.2k.tar.gz
tar -xvf openssl-1.0.2k.tar.gz
cd openssl-1.0.2k/
# --prefix will make sure that make install copies the files locally instead of system-wide
# --openssldir will make sure that the binary will look in the regular system location for openssl.cnf
# no-shared builds a mostly static binary
./config --prefix=`pwd`/local --openssldir=/usr/lib/ssl enable-ssl2 enable-ssl3 no-shared
make depend
make
make -i install
sudo cp local/bin/openssl /usr/local/bin/

去测试:

$ openssl s_client -connect google.com:443 -ssl2
CONNECTED(00000003)
139675635414688:error:1407F0E5:SSL routines:ssl2_write:ssl handshake failure:s2_pkt.c:412:

$ openssl s_client -connect google.com:443 -ssl3
CONNECTED(00000003)
140647504119456:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number:s3_pkt.c:365:

如果你有兴趣的话我这里有一个更完整的脚本:https://gist.github.com/bmaupin/8caca3a1e8c3c5686141

答案2

我也遇到了同样的问题!(这篇文章现在是 Google 上的第一个热门文章。)

我通过sslscan自己构建静态链接解决了这个问题;这会将 SSLv2 和 SSLv3 支持放入可执行文件本身。让全局 openssl 库支持旧的易受攻击的协议版本可能会很危险。

源代码仓库sslscan在这里:https://github.com/rbsec/sslscan

我无法让那里的说明正常工作,因为我没有任何deb-src/etc/apt/sources.list,所以出现错误:

E: You must put some 'source' URIs in your sources.list

但是,我忽略了错误,它还是成功了。在我的笔记本电脑上构建大约花了 10 分钟(-j 标志不起作用)。构建因某种原因失败了一次(测试未通过),但再次编译后它成功了。

TL;DR: 运行:

sudo apt-get install build-essential git zlib1g-dev

git clone https://github.com/rbsec/sslscan.git
cd sslscan
make static

验证输出

./sslscan --version
                1.11.13-rbsec-9-g55ec8c7-static
                OpenSSL 1.0.2-chacha (1.0.2g-dev)

答案3

我遇到了同样的错误。在 /etc/apt/sources.list 中取消注释所有以 deb-src 开头的行,这些行具有匹配的未注释行,后面跟着一个,这sudo apt-get upgrade为我在 Ubuntu 16.04 上清除了错误。

我主要关注的是https://www.hackwhackandsmack.com/?p=46现在我可以让 ssl3 正常工作了(我想我漏掉了 ssl2 的一个额外标志,因此请仔细检查您是否已设置好所有补丁/系列和规则选项)。

相关内容