...
The attacker can create a new instance of MyPrivacy class by using a cloneable subclass and by-pass the constructor.
Bypassing the constructor leads to bypassing the password check done in the constructor.
Code Block | ||
---|---|---|
| ||
class Test extends MyPrivacy implements Cloneable{ public static void somefunction(MyPrivacy obj) { try { Test t = (Test)obj.clone() }catch(Exception e) { System.out.println("not cloneable"); } if (t != null) t.use(); // Another object instantiated without knowing the password..... } } |
...