ASP.NET版本泄露【原理扫描】

如果想屏蔽 Server,X-AspNet-Version,X-AspNetMvc-Version 和 X-Powered-By,需要增加:

<httpProtocol>
  <customerHeaders>
    <remove name="Server" />
    <remove name="X-AspNet-Version" />
    <remove name="X-AspNetMvc-Version" />
    <remove name="X-Powered-By" />
  </customerHeaders>
</httpProtocol>

 <system.web> 
    <httpRuntime targetFramework="4.7.2" enableVersionHeader="false" />
  </system.web>

修改之后的web.config:

<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=301880 -->
<configuration>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0"/>
  </appSettings>
  <system.web>
    <compilation targetFramework="4.7.2"/>
    <httpRuntime targetFramework="4.7.2" enableVersionHeader="false" />
  </system.web>

   <system.webServer>      
        <httpProtocol>
            <customHeaders>
                <remove name="Server" />
                <remove name="X-AspNet-Version" />
                <remove name="X-AspNetMvc-Version" />
                <remove name="X-Powered-By" />
            </customHeaders>
        </httpProtocol>
        <security>
            <requestFiltering removeServerHeader="true" />
        </security>
    </system.webServer>
</configuration>

按照操作进行设置操作后,会看到X-AspNet-Version不再显示
ASP.NET版本泄露【原理扫描】_第1张图片

你可能感兴趣的:(web漏洞,asp.net,服务器,后端)