Skip to content

Instantly share code, notes, and snippets.

@jsyeo
Last active September 8, 2015 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsyeo/60079ea42c4c682129f8 to your computer and use it in GitHub Desktop.
Save jsyeo/60079ea42c4c682129f8 to your computer and use it in GitHub Desktop.
Dot Class Reflection
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Main {
public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
// write your code here
Class a = A.class;
Method m = a.getMethod("vulnerableMethod");
m.invoke(null);
}
}
class A {
public static void vulnerableMethod() {
System.out.println("pwned");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment