0%

Weblogic CVE-2020-14825 分析

Weblogic CVE-2020-14825 漏洞分析

调用链

1
2
3
4
5
6
7
8
9
10
11
12
13
14
connect:624, JdbcRowSetImpl (com.sun.rowset)
getDatabaseMetaData:4004, JdbcRowSetImpl (com.sun.rowset)
invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
invoke:62, NativeMethodAccessorImpl (sun.reflect)
invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
invoke:498, Method (java.lang.reflect)
getAttributeValueFromObject:82, MethodAttributeAccessor (org.eclipse.persistence.internal.descriptors)
getAttributeValueFromObject:61, MethodAttributeAccessor (org.eclipse.persistence.internal.descriptors)
extract:51, LockVersionExtractor (oracle.eclipselink.coherence.integrated.internal.cache)
compare:70, ExtractorComparator (com.tangosol.util.comparator)
siftDownUsingComparator:722, PriorityQueue (java.util)
siftDown:688, PriorityQueue (java.util)
heapify:737, PriorityQueue (java.util)
readObject:797, PriorityQueue (java.util)

可以看到前面部分还是熟悉的 CC 链,原理一致,不在多说:
image

看到 com.tangosol.util.comparator.compare:
image

因为传入的实例不属于 Entry 类,所以会执行后面的 this.m_extractor.extract(o2),从利用链可以看出这里的 this.m_extractororacle.eclipselink.coherence.integrated.internal.cache.LockVersionExtractor,继续跟进他的 extract 方法:
image

直接进入 this.accessor.getAttributeValueFromObject 方法,其中 this.accessor 是可以直接从构造方法传入的,也就是能被控制的,从利用链看出这里传入的是 org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor,先判断 this.accessor.isInitialized():
image

要满足条件,只需要 this.getMethodthis.isWriteOnly() 不为空即可,其中 this.isWriteOnly() 可以通过父类的 setIsWriteOnly 赋值:
image

this.getMethod 后面细说。
跟进其 getAttributeValueFromObject 方法:
image

可以看到这里调用了反射,但是 this.getMethod 没有明确,看下 this.getMethod 是如何赋值的:
image

有个 transient 关键字,所以这个属性不会被序列化,但该类中又恰好有 setGetMethod 方法,可以通过该方法对 getMethod 属性进行赋值,也是我们能够控制的,通过也满足了前面的 this.accessor.isInitialized() 的条件。
image

至此,所以整个利用链都能走通了。
image

如何继续挖呢?补丁的黑名单只限制了 oracle.eclipselink.coherence.integrated.internal.cache.LockVersionExtractor 这个类,可以看看有无类似的类
image