Openssh MaxAuthTries限制绕过漏洞(CVE-2015-5600)的研究与验证

工作中扫描发现Openssh MaxAuthTries限制绕过漏洞(CVE-2015-5600),对于该漏洞,我们做出如下验证与研究:

1. 漏洞信息
d1
OpenSSH 6.9及之前版本的sshd中的auth2-chall.c文件中的‘kbdint_next_device’函数存在安全漏洞,该漏洞源于程序没有正确限制处理单链接中的keyboard-interactive设备。远程攻击者可借助ssh -oKbdInteractiveDevices选项中较长且重复的列表利用该漏洞实施暴力破解攻击,或造成拒绝服务(CPU消耗)。

简单来说,OpenSSH软件被爆出一个简单的高危的漏洞,攻击者可以在短时间内进行数千次的登录尝试。

2.漏洞研究与验证:
一般OpenSSH软件允许3到6次的密码登陆尝试,如果都登陆失败,连接将会断开,我们在311测试机中安装了redhat6.5进行测试:
OpenSSH版本 5.3p1

d2
如图所示,尝试6次错误的登陆密码后,连接断开了。
d3
但是这个漏洞会允许攻击者执行大量的登录尝试。对于使用键盘交互认证模式的OpenSSH服务器,包括FreeBSD Linux,黑客都可以实施暴力破解。Redhat官网对该漏洞做出如下说明:

It was found that OpenSSH would allow an attacker to request a large number of keyboard-interactive devices when entering a password, which could allow a remote attacker to bypass the MaxAuthTries limit defined in the sshd_config file.

This flaw only affects OpenSSH configurations that have the ‘KbdInteractiveAuthentication’ configuration option set to ‘yes’. By default, this option has the same value as the ‘ChallengeResponseAuthentication’ option.

也就是说,该漏洞仅仅影响支持键盘交互认证模式的OpenSSH服务器,即/etc/ssh/sshd_config 文件中ChallengeResponseAuthentication为yes的OpenSSH服务器。

我们将测试redhat服务器/etc/ssh/sshd_config 文件中ChallengeResponseAuthentication修为yes

d4
根据网上的POC:

ssh -lusername -oKbdInteractiveDevices=`perl -e 'print "pam," x 10000'` targethost  

测试发现,我们可以尝试多次密码尝试,直至登陆成功:

d5
因此,版本小于等于6.9,并且支持键盘交互认证模式的OpenSSH受该漏洞影响,存在暴力破解风险。
快速验证系统是否受影响方法,用verbose模式登陆,如:

$ ssh -v root@127.0.0.1  

d6
如果发现包含”keyboard-interactive”,系统即有可能受该漏洞影响,否则不受该漏洞影响。 Redhat官网声明:
Statement:
This issue does not affect the default OpenSSH sshd configuration in Red Hat Enterprise Linux 4, 5, 6 and 7.
Redhat默认配置是不受该漏洞影响的。

3.总结:

版本小于等于6.9,并且支持键盘交互认证模式的OpenSSH受该漏洞影响,存在暴力破解风险,Redhat默认配置不受该漏洞影响。建议关闭键盘交互模式,避免遭受该漏洞影响。



blog comments powered by Disqus