在 Linux 上用 OpenSSL 检查漏洞,通常分为 检查 OpenSSL 本身版本/漏洞 和 检查服务是否使用了存在漏洞的 SSL/TLS 配置 两大类。下面按常见场景给你一个实用清单。
openssl version -a
重点关注:
1.0.2k、1.1.1q、3.0.8)然后对照官方漏洞公告:
⚠️ 注意:
即使版本号看起来“旧”,只要发行版(Ubuntu / CentOS / RHEL)还在维护,通常已经 backport(回移植)修复补丁,不一定真的有漏洞。
dpkg -l | grep openssl
apt changelog openssl | head -50
rpm -qa | grep openssl
rpm -q --changelog openssl | head -50
✅ 重点看 changelog 里是否修复了某个 CVE
vulners 或 openvas(较专业)sudo apt install漏洞扫描工具
uname -a
cat /etc/os-release
然后到:
确认系统是否已修复。
openssl s_client -connect example.com:443 -ssl3
openssl s_client -connect example.com:443 -tls1
✅ 正常情况应:
openssl s_client -connect example.com:443 -cipher 'ALL:COMPLEMENTOFALL'
或使用:
nmap --script ssl-enum-ciphers -p 443 example.com
⚠️ 不安全的:
openssl s_client -connect example.com:443 </dev/null 2>/dev/null | openssl x509 -noout -text
重点看:
openssl s_client -connect example.com:443 -tlsextdebug 2>&1 | grep heartbeat
或使用专用工具:
git clone https://github.com/FiloSottile/Heartbleed
| 漏洞 | 影响版本 | 说明 |
|---|---|---|
| Heartbleed | 1.0.1 – 1.0.1f | 内存泄露 |
| POODLE | SSLv3 | 协议漏洞 |
| CCS Injection | 1.0.1h 之前 | MITM |
| CVE-2022-3786 / 3602 | 3.x | 缓冲区溢出 |
| CVE-2023-0286 | 3.x | X.400 地址处理 |
✅ 不要手动升级 OpenSSL 源码(容易出问题)
✅ 使用系统包管理器:
apt update && apt upgrade openssl
yum update openssl
✅ 升级后重启依赖服务:
systemctl restart nginx
systemctl restart apache2
openssl version
nmap --script ssl-enum-ciphers -p 443 127.0.0.1
dpkg -l | grep openssl
如果你愿意,可以告诉我:
我可以给你 更精确的命令和判断结果。