在审查 Apache 代码中是否存在与该问题相关的任何问题时,我们发现了一些问题。其中许多不是 Apache 中的错误,而是 Apache 可以做更多的事情来避免容易受到跨站脚本攻击安全问题的影响的地方。这些更改都没有修复 Apache 本身中可能直接危及服务器的任何安全漏洞,而是侧重于其与客户端的交互。
以下是当前已知问题和修复程序(如果可用)的摘要。随着信息的发布和时间的推移,这些信息将得到扩展。
printenv
CGI 脚本没有正确编码其输出。如果您在系统上拥有其中一个,并且此问题影响您的网站,您应该禁用该 CGI。printenv
和 test-cgi
以 text/plain 的 MIME 类型发送内容,这意味着不需要或不可能进行编码。为了解决 printenv
未正确编码其输出的问题,在 Apache 1.3.11 中有效地进行了更改。不幸的是,Microsoft Internet Explorer 不尊重该 MIME 类型,并且错误地将输出处理为 HTML,这就是它猜测的类型。此安全问题已报告给 Microsoft。目前,建议的解决方法是,如果此问题影响您,只需从您的网站中删除 printenv
和 test-cgi
脚本。mod_status
)不会在其输出上设置显式字符集。使用 AddDefaultCharset 指令将解决此问题。不设置显式字符集的模块通常对用户不可访问,并且它们被认为不会构成重大风险。随着时间的推移,这些将得到扩展。这些补丁在针对 Apache 1.3.11 的当前 Apache 补丁 中可用。
*) Add an explicit charset=iso-8859-1 to pages generated by ap_send_error_response(), such as the default 404 page. [Marc Slemko] *) Add the AddDefaultCharset and AddDefaultCharsetName directives. These allow you to tell Apache to specify the given character set on any document that does not have one explicitly specified in the headers. [Marc Slemko] *) Properly escape various messages output to the client from a number of modules and places in the core code. [Marc Slemko] *) Change mod_actions, mod_autoindex, mod_expires, and mod_log_config to not consider any parameters such as charset when making decisions based on content type. This does remove some functionality for some users, but means that when these modules are configured to do particular things with particular MIME types, the charset should not be included. A better way of addressing this for users who want to set things on a per charset basis is necessary in the future. [Marc Slemko] *) mod_include now entity encodes output from "printenv" and "echo var" by default. The encoding for "echo var" can be set to URL encoding or no encoding using the new "encoding" attribute to the echo tag. [Marc Slemko]