test: add CB4 multi version gadgets integration test

This commit is contained in:
ReaJason
2025-02-19 22:21:17 +08:00
parent 7d567beba9
commit 41d2ea5c6d
22 changed files with 429 additions and 1 deletions
@@ -0,0 +1,17 @@
import com.googlecode.aviator.AviatorEvaluator;
import com.googlecode.aviator.AviatorEvaluatorInstance;
import org.junit.jupiter.api.Test;
/**
* @author ReaJason
* @since 2025/1/29
*/
class AviatorServletTest {
@Test
void test() {
String exp = "use org.springframework.cglib.core.*;use org.springframework.util.*;ReflectionUtils.invokeMethod(ClassUtils.getMethod(Class.forName('java.lang.Thread'), 'getContextClassLoader', nil), Thread.currentThread())";
AviatorEvaluatorInstance evaluator = AviatorEvaluator.newInstance();
System.out.println(evaluator.execute(exp));
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,18 @@
import org.apache.commons.jexl2.Expression;
import org.junit.jupiter.api.Test;
/**
* @author ReaJason
* @since 2025/1/29
*/
class JEXL2ServletTest {
@Test
void test() {
System.out.println(System.getProperty("java.version"));
org.apache.commons.jexl2.JexlEngine jexl = new org.apache.commons.jexl2.JexlEngine();
Expression e = jexl.createExpression("''.getClass().forName('javax.script.ScriptEngineManager').newInstance().getEngineByName('js')");
org.apache.commons.jexl2.MapContext jc = new org.apache.commons.jexl2.MapContext();
System.out.println(e.evaluate(jc));
}
}
@@ -0,0 +1,18 @@
import org.apache.commons.jexl3.*;
import org.junit.jupiter.api.Test;
/**
* @author ReaJason
* @since 2025/1/29
*/
class JEXL3ServletTest {
@Test
void test() {
System.out.println(System.getProperty("java.version"));
JexlEngine jexl = new JexlBuilder().create();
JexlExpression e = jexl.createExpression("''.getClass().forName('javax.script.ScriptEngineManager').newInstance().getEngineByName('js')");
JexlContext jc = new MapContext();
System.out.println(e.evaluate(jc));
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long