This vulnerability occurs when an application determines an object's trustworthiness or behavior solely by checking its class name. Since multiple classes can share identical names across different packages or classloaders, this comparison can lead to using the wrong, potentially malicious, class.
Relying on class name strings for security decisions is inherently risky. Attackers can craft classes with names identical to your trusted ones, tricking your application into granting them unauthorized privileges or executing unintended code paths. This is especially problematic in environments with multiple classloaders, like application servers, where the same fully-qualified name can point to completely different implementations. Detecting these logical flaws manually is challenging, as they depend on runtime context. While SAST tools can flag dangerous comparison patterns, Plexicus uses AI to not only identify the risk but also suggest specific, secure refactoring—such as using direct class object comparisons or verifying the classloader—saving significant manual review time and preventing impersonation attacks.
Impact: Execute Unauthorized Code or Commands
If a product relies solely on the name of an object to determine identity, it may execute the incorrect or unintended code.
java
// Do something assuming you trust inputClass*
javajava
// Do something assuming you trust inputClass*
javajava
// first check to see if the object is of the same class* if (obj.getClass().getName().equals(this.getClass().getName())) { ```
javajava
// first check to see if the object is of the same class* if (obj.getClass() == this.getClass()) { ``` ... } ... }
High