保护Tomcat 6 APR SSL免受BEAST攻击

3
我们在Tomcat 6上运行一个Web应用程序,使用本地Apache Portable Runtime SSL连接器提供SSL连接。如何配置服务器以防范BEAST攻击?建议的解决方案(1)无法在Tomcat配置中进行配置,因为它不允许设置SSLHonorCipherOrder参数(2)。
我们目前仅使用设置SSLCipherSuite="ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM",但使用SSL服务器测试进行扫描后,服务器仍然容易受到BEAST攻击。我知道我们可以通过在Tomcat之前增加Apache代理来解决这个问题,但这个改变对于短期实施来说过于侵入性。我也可以修补Tomcat以添加支持,但这将阻止Tomcat包的自动更新,这与政策相悖。
1:https://community.qualys.com/blogs/securitylabs/2011/10/17/mitigating-the-beast-attack-on-tls

2: http://tomcat.apache.org/tomcat-6.0-doc/apr.html

2:{{链接1:http://tomcat.apache.org/tomcat-6.0-doc/apr.html}}
3个回答

2

解决这个问题的逻辑方法是Tomcat实现CipherOrder指令,正如这个BugZilla链接所显示的那样,似乎已经在Tomcat 7.0.30及以后版本中实现。我非常有兴趣尝试一下,并在尝试后反馈结果。 https://issues.apache.org/bugzilla/show_bug.cgi?id=53481


上面提到的错误报告称,Tomcat 6的CipherOrder指令已经在去年8月份被提出,但我没有看到它已经被实现的证据。同时,是否有一个明确的解决方案来应对Tomcat 6中的BEAST攻击呢?我们正在运行Tomcat 6.0.35和JRE 1.6.0_38,并未通过Trustwave和SSL Labs(https://www.ssllabs.com/ssltest/)的合规性扫描。 - user1940265
2013年1月的最新错误更新说明:[已修复于Tomcat 6.0.x中,将在Tomcat 6.0.37版中发布。] (https://issues.apache.org/bugzilla/show_bug.cgi?id=53481#c7) - Stefan Lasiewski
更改现在已经在Tomcat 6.x和7.x中进行。您可以在文档中查看配置选项(SSLHonorCipherOrder):http://tomcat.apache.org/tomcat-7.0-doc/config/http.html。然而,我刚刚启用了此选项(将其添加到我的服务器.xml连接器中,使用Tomcat 7.0.40),但它并没有从https://www.ssllabs.com/ssltest中删除BEAST攻击失败消息。 - Keith

1
我从未公开过我的解决方案。虽然它有点像黑客行为,但你不需要去修改/重新编译JSSE或Tomcat。
创建以下类:
/*
SSLSettingHelper prevents BEAST SSL attack by setting the appropriate option.
Due to protected variable must be in org.apache.tomcat.util.net package...
Instruction:
1) Compile and place JAR in tomcat /lib
2) Add protocol="org.apache.tomcat.util.net.SSLSettingHelper" to SSL APR connector
*/
package org.apache.tomcat.util.net;

public class SSLSettingHelper extends org.apache.coyote.http11.Http11AprProtocol {
    @Override
    public void init() throws Exception {
        super.init();
        org.apache.tomcat.jni.SSLContext.setOptions(endpoint.sslContext, org.apache.tomcat.jni.SSL.SSL_OP_CIPHER_SERVER_PREFERENCE);
        log.info("SSLSettingHelper set SSL_OP_CIPHER_SERVER_PREFERENCE to prevent BEAST SSL attack");
    }
}

然后配置连接器以使用此辅助类:

<Connector server="Server" protocol="org.apache.tomcat.util.net.SSLSettingHelper" port="8443" maxThreads="256" scheme="https" secure="true" SSLEnabled="true" SSLCertificateFile="..." SSLCertificateKeyFile="..." SSLCertificateChainFile="..." SSLCipherSuite="ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM" compression="on" compressableMimeType="text/html,text/xml,text/plain,application/json,text/css,text/javascript" maxPostSize="1024000"/>

这个修复了BEAST攻击。


0

我找到了一种方法,可以在纯Java中启用与“SSLHonorCipherOrder”相同的功能。通过(bootclasspath)修补一些行来获取服务器服务器顺序。

类:sun.security.ssl.ServerHandshaker

添加字段

public static boolean preferServerOrder = true;

替换方法 chooseCipherSuite:

private void chooseCipherSuite(final HandshakeMessage.ClientHello mesg) throws IOException {
    if(preferServerOrder) {
        final CipherSuiteList clientList = mesg.getCipherSuites();
        for(final CipherSuite serverSuite : getActiveCipherSuites().collection()) {
            if (this.doClientAuth == 2) {
                if (serverSuite.keyExchange == CipherSuite.KeyExchange.K_DH_ANON) continue;
                if (serverSuite.keyExchange == CipherSuite.KeyExchange.K_ECDH_ANON) continue;
            }
            if(!serverSuite.isNegotiable()) continue;
            if(clientList.contains(serverSuite)) {
                if (trySetCipherSuite(serverSuite)) return;
            }
        }
    } else {
        final Collection list = mesg.getCipherSuites().collection();
        for(final CipherSuite suite : list) {
            if (!(isNegotiable(suite))) continue;
            if (this.doClientAuth == 2) {
                if (suite.keyExchange == CipherSuite.KeyExchange.K_DH_ANON) continue;
                if (suite.keyExchange == CipherSuite.KeyExchange.K_ECDH_ANON) continue;
            }
            if (trySetCipherSuite(suite)) return;
        }
    }
    fatalSE(Alerts.alert_handshake_failure, "no cipher suites in common");
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接