禁用HTTPS的通用名称检查的安全隐患 [英] Security implications of disabling the Common Name check for HTTPS

查看:90
本文介绍了禁用HTTPS的通用名称检查的安全隐患的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要检查一些我通过HTTPS进行安全通信而继承的客户端代码,看来这不是在检查服务器证书中的通用名称(例如, CN = example.com)是否与实际请求的网址。这可能是故意的,因为我们的客户端应用需要与各种环境进行对话,因此在联系初始门户网站(例如example.com/main)并选择环境后,用户会将应用重定向到特定IP,因此所有将来的请求都类似于 http://127.0.0.1/page

I'm going over some client code I've inherited for doing secure communication over HTTPS, and it seems that it's not checking the common name in the server certificate (eg. 'CN = "example.com"' against the actual URL that's being requested. This is probably deliberate, since our client app is required to talk to various environments, so after contacting an initial portal (eg. example.com/main) and the user choosing an environment the app gets redirected to a specific IP, so all future requests look something like "http://127.0.0.1/page".

但是,作为SSL新手,我不确定禁用此检查的含义。我的第一个反应是,执行某种人工干预会更容易中间攻击,因为其他人可以只复制我们的证书并假装成我们的服务器之一,但是如果我们进行通用名称检查,则无论如何都可以使用自定义DNS设置执行相同的操作,例如o它似乎并没有真正给我们带来任何好处。还有其他攻击方式让我们敞开心open吗?

However being an SSL newbie, I'm unsure of the implications of disabling this check. My first reaction would be that it'd be easier to perform some kind of man-in-the-middle attack, since someone else could just copy our certificate and pretend to be one of our servers. But if we were doing common name checking you'd be able to do the same thing with custom DNS settings anyway, so it doesn't seem to actually gain us anything. Are there other attacks that this leaves us open to which we wouldn't be otherwise?

谢谢

推荐答案

其他人不能只是复制您的证书并使用它,因为它们没有您的私钥。

Someone else can't just copy your certificate and use it because they don't have your private key.

如果您没有不要检查证书的CN是否与域名匹配,然后他们可以简单地创建自己的证书(并由受信任的CA签名,这样看起来就有效),用它代替您的证书,然后在中间扮演一个男人

If you don't check that the certificate's CN doesn't match the domain name then they can simply create their own certificate (and have it signed by a trusted CA so it looks valid), use it in place of yours, and perform a man in the middle attack.

此外,您还需要检查证书是否来自受信任的CA。确保您仅实际控制该域是CA的工作,这是CA的工作。

Also, you need to be checking that the certificate comes from a trusted CA. It's the CA's job to make sure that you can only get a certificate with the CN= if you actually control that domain.

如果您跳过这两项检查中的任何一项,则说明您可能会遭受MITM攻击。

If you skip either of these checks then you are at risk of a MITM attack.

另请参见此答案,这是一种其他方法,如果您对客户端有足够的控制权,则可以使用该方法。

See also this answer for a different approach that will work if you have sufficient control over the client.

这篇关于禁用HTTPS的通用名称检查的安全隐患的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆