3

我们使用本地 Apache Portable Runtime SSL 连接器在 Tomcat 6 上运行 Web 应用程序,以提供 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.quallys.com/blogs/securitylabs/2011/10/17/mitigating-the-beast-attack-on-tls

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

4

3 回答 3

2

解决这个问题的合乎逻辑的方法是让 Tomcat 实现一个 CipherOrder 指令,正如这个 BugZilla 链接所示,它似乎被合并到 Tomcat 7.0.30 及以后的版本中。我最有兴趣尝试一下,尝试后会反馈。 https://issues.apache.org/bugzilla/show_bug.cgi?id=53481

于 2012-10-10T09:06:54.360 回答
1

我从来没有发布过我的解决方案。这有点像 hack,但您不需要修补/重新编译 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 攻击。

于 2013-06-02T11:12:57.747 回答
0

我找到了一个解决方案,可以在普通 java 中启用与“SSLHonorCipherOrder”相同的解决方案。通过 (bootclasspath) 修补一些原始 Sun JSSE 行以使服务器服务器顺序正常工作。

类: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");
}
于 2013-06-01T18:02:24.160 回答