用友 NC 6.5反序列化漏洞复现与分析 | 您所在的位置:网站首页 › 阻止序列化 › 用友 NC 6.5反序列化漏洞复现与分析 |
进入“文件服务器”→“读取”,此处添加服务器ip地址,端口,存储路径,及选择元数据仓库,如下图所示:
由于程序刚启动的时候locatorMap的值为空,则会进入下面的分支语句中去判断locatorProvider值,而此时又因为locatorProvider的值为空,svcDispatchURL的值(http://ip:port/ServiceDispatcherServlet)不为空,所以会创建RmiNCLocator实例,将其存放至locatorMap中。
获取到RmiNCLocator实例后,查看其lookup()方法:
通过java代理的相关知识可以知道,无论调用代理对象的任何方法,该方法都会调用处理器的invoke方法,在本程序中即是nc.bs.framework.rmi.RemoteInvocationHandler#invoke: //nc.bs.framework.rmi.RemoteInvocationHandler#invoke public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String mn = method.getName(); Class[] ps = method.getParameterTypes(); if (mn.equals("equals") && ps.length == 1 && ps[0].equals(Object.class)) { Object value = args[0]; if (value != null && Proxy.isProxyClass(value.getClass())) { Object h = Proxy.getInvocationHandler(value); return !(h instanceof RemoteInvocationHandler) ? Boolean.FALSE : this.meta.equals(((RemoteInvocationHandler)h).meta) && this.ras.equals(((RemoteInvocationHandler)h).ras); } else { return Boolean.FALSE; } } else if (mn.equals("hashCode") && ps.length == 0) { return this.meta.hashCode() + 27 * this.ras.hashCode(); } else if (mn.equals("toString") && ps.length == 0) { return this.meta.toString(); } else { return method.getDeclaringClass() == RemoteProxy.class ? method.invoke(this, args) : this.sendRequest(method, args); } }此时mn的值为“lookup”,因此会进入最后一条分支语句中,又因为二者不等,最终会执行this.sendRequest(method, args)方法 //nc.bs.framework.rmi.RemoteInvocationHandler#sendRequest public Object sendRequest(Method method, Object[] args) throws Throwable { InvocationInfo ii = this.newInvocationInfo(method, args); Address old = null; int retry = 0; ConnectorFailException error = null; do { Address target = this.ras.select(); if (old != null) { Logger.error("connect to: " + old + " failed, now retry connect to: " + target); if (old.equals(target)) { try { Thread.sleep(this.retryInterval); } catch (Exception var13) { ; } } } this.restoreToken(ii, target); try { Object var8 = this.sendRequest(target, ii, method, args); return var8; } catch (ConnectorFailException var14) { ++retry; old = target; error = var14; } finally { this.storeToken(ii, target); } } while(retry |
CopyRight 2018-2019 实验室设备网 版权所有 |