Skip to content

Instantly share code, notes, and snippets.

@jsyeo
Created August 24, 2015 03:54
Show Gist options
  • Save jsyeo/b6acdcf168822695a95f to your computer and use it in GitHub Desktop.
Save jsyeo/b6acdcf168822695a95f to your computer and use it in GitHub Desktop.
Object virtual call
public class Main {
public static void main(String[] args) {
Object a = new VulnerableClass();
a.toString();
}
}
class VulnerableClass {
void vulnerableMethod() {
}
@Override
public String toString() {
vulnerableMethod();
return "pwned";
}
}
class HarmlessClass {
@Override
public String toString() {
return "";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment