升级到 9.5.17 后的安全消息
security message after upgrade to 9.5.17
升级到 9.5.17 后,我在报告中收到以下安全消息:
服务器对静态文件的响应:
www.mydomain.de/typo3temp/assets/43cd7f07.tmp/2500f854.html.wrong
unexpected content-type text/html
www.mydomain.de/typo3temp/assets/43cd7f07.tmp/2500f854.1.svg.wrong
unexpected content-type image/svg+xml
www.mydomain.de/typo3temp/assets/43cd7f07.tmp/2500f854.php.wrong
unexpected content PHP content
www.mydomain.de/typo3temp/assets/43cd7f07.tmp/2500f854.php.txt
unexpected content PHP content
这是什么意思?
我检查了文件夹 /typo3temp/assets/ - 没有文件夹 43cd7f07.tmp
谢谢!
您收到的错误消息是集成到最新 TYPO3 v9.5.17 和 v10.4.2 版本中的安全功能的一部分,请参阅 https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5.x/Feature-91354-IntegrateServerResponseSecurityChecks.html
基本上就是你当前的服务器系统
- 正在评估像
test.php.txt
这样的文件(.php
不在文件名的末尾)仍然是 PHP 内容 - 这可能会导致安全漏洞,以防有人设法上传类似文件(可能被认为是 text/plain
文件,但实际上是可执行的 PHP 代码)
- 可能远程代码执行
- 正在提供像
test.html.wrong
这样的文件(.html
不在文件名的末尾)仍然是 text/html
这会触发浏览器执行 HTML 标签和潜在的危险<script>
个标签
- 可能跨站点脚本
Call for action
In case this is a live and in production server, you should adjust your web server configuration.
解决方法是将那些 Web 服务器 MIME 类型映射限制为仅具有例如.html
在最后,如 Apache HTTP 网络服务器示例所示
<FilesMatch ".+\.html?$">
AddType text/html .html .htm
</FilesMatch>
服务器管理员的 TYPO3 安全指南中找到更多细节和解释
2020 年 5 月 17 日更新
https://gist.github.com/ohader/11d737de95895f8ca16495a8b7001c45 包含如何调整 .htaccess
文件的示例,以防无法在(共享)托管环境中更改设置。
<IfModule mod_mime.c>
RemoveType .html .htm
<FilesMatch ".+\.html?$">
AddType text/html .html
AddType text/html .htm
</FilesMatch>
RemoveType .svg .svgz
<FilesMatch ".+\.svgz?$">
AddType image/svg+xml .svg
AddType image/svg+xml .svgz
</FilesMatch>
RemoveHandler .php
<FilesMatch ".+\.php$">
# IMPORTANT: `php-fcgid` is using in THIS example
# Most probably is different for each individual configuration
SetHandler php-fcgid
# SetHandler php-script
# SetHandler application/x-httpd-php
</FilesMatch>
</IfModule>
当前处理程序标识符 php-fcgid
是为上面的示例使用 phpinfo();
并搜索 $_SERVER[REDIRECT_HANDLER]
:
确定的
$_SERVER['REDIRECT_HANDLER'] php-fcgid
这里有一些 Domainfactory 的特色。
注意 ForceType
指令(在此处设置您的特定 PHP 版本)。如果不使用,其网络服务器仍将使用 mimetype-sniffing.
用于最新的 .htaccess 模板 (10.4, 9.5) 的底部,其中已经包含对 .svg[z]
/.htm[l]
的严格处理
# DomainFactory-special:
# 1) remove mimetype-sniffing anything for PHP
# 2) force PHP 7.3 mimetype on .php files
<IfModule mod_mime.c>
RemoveType .php
<FilesMatch ".+\.php$">
ForceType application/x-httpd-php73
</FilesMatch>
</IfModule>
对于共享主机,可能很难找到 php 的正确处理程序。
1&1 Ionos 的一些特色,甚至可能对这个特定的共享主机包来说是特别的:
与 php 7.3 共享主机(在 phpinfo 中确认),但 $_SERVER['REDIRECT_HANDLER'] 给出“x-mapp-php5” (不知道为什么,可能是主机 运行 多年并升级到 php 7 并且他们出于某种原因以某种方式为它起了别名)
对我来说可行的解决方案是:
<IfModule mod_mime.c>
RemoveType .html .htm
<FilesMatch ".+\.html?$">
AddType text/html .html
AddType text/html .htm
</FilesMatch>
RemoveType .svg .svgz
<FilesMatch ".+\.svgz?$">
AddType image/svg+xml .svg
AddType image/svg+xml .svgz
</FilesMatch>
RemoveHandler .php
RemoveType .php
<FilesMatch ".+\.php$">
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
</FilesMatch>
</IfModule>
我不得不删除两个 handler/type 并在文件匹配中再次添加它们。
我花了很长时间才完成这项工作,希望对您有所帮助。
因为 host-europe $_SERVER['REDIRECT_HANDLER'] 是空的,php7.4:
<IfModule mod_mime.c>
....
RemoveHandler .php
RemoveType .php
<FilesMatch ".+\.php$">
# only this handler seems to work
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
</FilesMatch>
</IfModule>
ALL-INKL.COM 的支持团队向我推荐了以下解决方案。
我不得不联系他们,因为删除语句 (RemoveHandler .php) 不起作用。
<FilesMatch "\.(php[0-9,x]*|phtml)\.">
SetHandler text/plain
</FilesMatch>
感谢所有-INKL.COM-支持团队
这适用于 JWEILAND、WEBGO 和 PHP:
<IfModule mod_mime.c>
RemoveHandler .php
RemoveType .php
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
</FilesMatch>
</IfModule>
升级到 9.5.17 后,我在报告中收到以下安全消息:
服务器对静态文件的响应:
www.mydomain.de/typo3temp/assets/43cd7f07.tmp/2500f854.html.wrong
unexpected content-type text/html
www.mydomain.de/typo3temp/assets/43cd7f07.tmp/2500f854.1.svg.wrong
unexpected content-type image/svg+xml
www.mydomain.de/typo3temp/assets/43cd7f07.tmp/2500f854.php.wrong
unexpected content PHP content
www.mydomain.de/typo3temp/assets/43cd7f07.tmp/2500f854.php.txt
unexpected content PHP content
这是什么意思?
我检查了文件夹 /typo3temp/assets/ - 没有文件夹 43cd7f07.tmp
谢谢!
您收到的错误消息是集成到最新 TYPO3 v9.5.17 和 v10.4.2 版本中的安全功能的一部分,请参阅 https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5.x/Feature-91354-IntegrateServerResponseSecurityChecks.html
基本上就是你当前的服务器系统
- 正在评估像
test.php.txt
这样的文件(.php
不在文件名的末尾)仍然是 PHP 内容 - 这可能会导致安全漏洞,以防有人设法上传类似文件(可能被认为是text/plain
文件,但实际上是可执行的 PHP 代码)- 可能远程代码执行
- 正在提供像
test.html.wrong
这样的文件(.html
不在文件名的末尾)仍然是text/html
这会触发浏览器执行 HTML 标签和潜在的危险<script>
个标签- 可能跨站点脚本
Call for action
In case this is a live and in production server, you should adjust your web server configuration.
解决方法是将那些 Web 服务器 MIME 类型映射限制为仅具有例如.html
在最后,如 Apache HTTP 网络服务器示例所示
<FilesMatch ".+\.html?$">
AddType text/html .html .htm
</FilesMatch>
服务器管理员的 TYPO3 安全指南中找到更多细节和解释
2020 年 5 月 17 日更新
https://gist.github.com/ohader/11d737de95895f8ca16495a8b7001c45 包含如何调整 .htaccess
文件的示例,以防无法在(共享)托管环境中更改设置。
<IfModule mod_mime.c>
RemoveType .html .htm
<FilesMatch ".+\.html?$">
AddType text/html .html
AddType text/html .htm
</FilesMatch>
RemoveType .svg .svgz
<FilesMatch ".+\.svgz?$">
AddType image/svg+xml .svg
AddType image/svg+xml .svgz
</FilesMatch>
RemoveHandler .php
<FilesMatch ".+\.php$">
# IMPORTANT: `php-fcgid` is using in THIS example
# Most probably is different for each individual configuration
SetHandler php-fcgid
# SetHandler php-script
# SetHandler application/x-httpd-php
</FilesMatch>
</IfModule>
当前处理程序标识符 php-fcgid
是为上面的示例使用 phpinfo();
并搜索 $_SERVER[REDIRECT_HANDLER]
:
$_SERVER['REDIRECT_HANDLER'] php-fcgid
这里有一些 Domainfactory 的特色。
注意 ForceType
指令(在此处设置您的特定 PHP 版本)。如果不使用,其网络服务器仍将使用 mimetype-sniffing.
用于最新的 .htaccess 模板 (10.4, 9.5) 的底部,其中已经包含对 .svg[z]
/.htm[l]
的严格处理
# DomainFactory-special:
# 1) remove mimetype-sniffing anything for PHP
# 2) force PHP 7.3 mimetype on .php files
<IfModule mod_mime.c>
RemoveType .php
<FilesMatch ".+\.php$">
ForceType application/x-httpd-php73
</FilesMatch>
</IfModule>
对于共享主机,可能很难找到 php 的正确处理程序。
1&1 Ionos 的一些特色,甚至可能对这个特定的共享主机包来说是特别的:
与 php 7.3 共享主机(在 phpinfo 中确认),但 $_SERVER['REDIRECT_HANDLER'] 给出“x-mapp-php5” (不知道为什么,可能是主机 运行 多年并升级到 php 7 并且他们出于某种原因以某种方式为它起了别名)
对我来说可行的解决方案是:
<IfModule mod_mime.c>
RemoveType .html .htm
<FilesMatch ".+\.html?$">
AddType text/html .html
AddType text/html .htm
</FilesMatch>
RemoveType .svg .svgz
<FilesMatch ".+\.svgz?$">
AddType image/svg+xml .svg
AddType image/svg+xml .svgz
</FilesMatch>
RemoveHandler .php
RemoveType .php
<FilesMatch ".+\.php$">
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
</FilesMatch>
</IfModule>
我不得不删除两个 handler/type 并在文件匹配中再次添加它们。 我花了很长时间才完成这项工作,希望对您有所帮助。
因为 host-europe $_SERVER['REDIRECT_HANDLER'] 是空的,php7.4:
<IfModule mod_mime.c>
....
RemoveHandler .php
RemoveType .php
<FilesMatch ".+\.php$">
# only this handler seems to work
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
</FilesMatch>
</IfModule>
ALL-INKL.COM 的支持团队向我推荐了以下解决方案。 我不得不联系他们,因为删除语句 (RemoveHandler .php) 不起作用。
<FilesMatch "\.(php[0-9,x]*|phtml)\.">
SetHandler text/plain
</FilesMatch>
感谢所有-INKL.COM-支持团队
这适用于 JWEILAND、WEBGO 和 PHP:
<IfModule mod_mime.c>
RemoveHandler .php
RemoveType .php
<FilesMatch ".+\.php$">
SetHandler application/x-httpd-php
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
</FilesMatch>
</IfModule>