【问题标题】:How to prevent content-spoofing on Apache 2.4?如何防止 Apache 2.4 上的内容欺骗?
【发布时间】:2019-08-05 04:23:15
【问题描述】:

以下 URL 是内容欺骗的示例。当我点击如下 URL 时,我需要显示我的 404 页面:

http://www.example.com/you%27re%20are%20looking%20for%20was%20not%20found%20on%20this%20server%20Please%20visit%20this%20webpage%20to%20fix%20the%20issue%20%28http%3a%2f%2fmalicious.site.evil.com%2f.%20Again%2cthe%20page%20

目前我看到 Apache 的默认错误页面如下:

在此服务器上找不到您要查找的请求 URL 请访问此网页以解决问题 (http://malicious.site.evil.com/。同样,在此找不到该页面 服务器。

我尝试在 .htaccess 中添加 RewriteCond。我也尝试添加以下内容

AllowEncodedSlashes NoDecode

this 中提到的httpd.conf 文件的末尾。

但似乎没有任何效果。

有人可以帮忙吗?

更新

下面是.htaccess的sn-p

ErrorDocument 404 /404.html

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ /404.html [L,R=404]

【问题讨论】:

  • 只使用自定义错误文档?
  • 我在 .htaccess 中有自定义错误页面。但是如何重定向上面提到的 URL 以显示我的错误页面?
  • 如果您已正确配置自定义错误,则不需要
  • 使用 .htaccess sn-p 更新问题。
  • 是在您的服务器配置中启用的 .htaccess 文件,是否允许它们设置 ErrorDocument

标签: apache apache2.4 apache-config


【解决方案1】:

修复很“简单”,但需要明确应用于每个易受攻击的虚拟主机

VirtualHost *:80
[...]

AllowEncodedSlashes nodecode

/VirtualHost>



 VirtualHost *:433
[...]

AllowEncodedSlashes nodecode

/VirtualHost

不要忘记虚拟主机开头的

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-12
    • 2017-05-14
    • 2017-01-08
    • 1970-01-01
    • 1970-01-01
    • 2017-01-19
    • 2012-11-01
    • 2011-03-03
    相关资源
    最近更新 更多