Created
September 6, 2017 05:27
-
-
Save stasinopoulos/8e05a601c1320d3b1bfe8ad3b7db2360 to your computer and use it in GitHub Desktop.
Simple ASPX application (vulnerable to blind OS command injections)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" Debug="true" Trace="false" %> | |
<%@ Import Namespace="System.Diagnostics" %> | |
<%@ Import Namespace="System.IO" %> | |
<script Language="C#" runat="server"> | |
string ExcuteCmd(string arg){ | |
ProcessStartInfo psi = new ProcessStartInfo(); | |
psi.FileName = "cmd.exe"; | |
psi.Arguments = "/c ping -n 2 " + arg; | |
psi.RedirectStandardOutput = true; | |
psi.UseShellExecute = false; | |
Process p = Process.Start(psi); | |
StreamReader stmrdr = p.StandardOutput; | |
string s = stmrdr.ReadToEnd(); | |
stmrdr.Close(); | |
return s; | |
} | |
void Page_Load(object sender, System.EventArgs e){ | |
string addr = Request.QueryString["addr"]; | |
Server.HtmlEncode(ExcuteCmd(addr)); | |
} | |
</script> | |
<HTML> | |
<HEAD> | |
<title>ASP.NET Ping Application</title> | |
</HEAD> | |
<body> | |
<form id="cmd" method="GET" runat="server"> | |
</form> | |
</body> | |
</HTML> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment