首页 > 解决方案 > 由于 X-ORIGINAL-URL 标头(CVE-2018-14773),Cloudflare 阻止了我们的“子域之间”url 重写为 403

问题描述

问题:如何删除Azure ARR中的X-ORIGINAL-URL标头?

由于 X-ORIGINAL-URL 标头 (CVE-2018-14773),Cloudflare 使用 403 阻止了我们的“子域之间”url 重写。

我们正在使用 applicationHost.xdt 文件并在 web.config 中重写规则。

规则是:

<rule name="Rule" stopProcessing="true">
    <match url="^(ab|cd|ef|gh)/(.*)" />
    <conditions logicalGrouping="MatchAny">
        <add matchType="Pattern" input="{HTTP_HOST}" pattern="^sub\.domain\.com$" />
    </conditions>
    <serverVariables>
        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
        <set name="HTTP_ACCEPT_ENCODING" value="" />
    </serverVariables>
    <action type="Rewrite" url="https://sub.{R:1}.domain.com/{R:2}" appendQueryString="false" logRewrittenUrl="true" />
</rule>

应用程序主机.xdt:

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <system.webServer>
        <proxy xdt:Transform="InsertIfMissing" enabled="true" preserveHostHeader="false" reverseRewriteHostInResponseHeaders="false" />
    </system.webServer>
    <location path="%XDT_SITENAME%" xdt:Locator="Match(path)">
        <system.webServer xdt:Transform="InsertIfMissing">
            <httpProtocol xdt:Transform="InsertIfMissing">
                <customHeaders xdt:Transform="InsertIfMissing">
                     <add xdt:Transform="Remove" /> 
                </customHeaders>
            </httpProtocol>
            
            <rewrite xdt:Transform="InsertIfMissing">
                <allowedServerVariables xdt:Transform="InsertIfMissing" >
                    <add name="HTTP_X_ORIGINAL_HOST" xdt:Transform="InsertIfMissing" />
                    <add name="HTTP_HOST" xdt:Transform="InsertIfMissing" />
                    <add name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                    <add name="HTTP_ACCEPT_ENCODING" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
                </allowedServerVariables>
            </rewrite>
        </system.webServer>            
    </location>
</configuration>

Cloudflare 日志(部分):

{
    "key": "rule_message",
    "value": "Drupal, Wordpress - Anomaly:Header:X-Original-Url, Anomaly:Header:X-Rewrite-Url - CVE:CVE-2018-14773"
},

标签: azureurl-rewritingcloudflarearrazure-webapps

解决方案


推荐阅读