Created
August 24, 2015 03:54
-
-
Save jsyeo/b6acdcf168822695a95f to your computer and use it in GitHub Desktop.
Object virtual call
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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