This vulnerability occurs when an application uses unvalidated external input, like a URL parameter or form field, to dynamically decide which class to load or which method to execute via reflection. An attacker can manipulate this input to force the application to load unexpected, potentially malicious code.
When an application lets user input dictate its control flow through reflection, it hands partial control of its logic to an attacker. By supplying crafted values, an attacker can bypass security checks, access unauthorized features, or trigger unexpected behaviors. The risk becomes critical if an attacker can also place malicious files on the application's classpath, allowing them to directly inject and execute their own code through this same reflection mechanism. Preventing unsafe reflection requires strict allow-listing of permitted classes or methods and rigorous validation of all dynamic input. While SAST tools can identify the vulnerable pattern, Plexicus uses AI to analyze the context and suggest precise code fixes—such as implementing a secure allow-list—transforming a complex security finding into an actionable remediation that saves development time.
Impact: Execute Unauthorized Code or CommandsAlter Execution Logic
The attacker might be able to execute code that is not directly accessible to the attacker. Alternately, the attacker could call unexpected code in the wrong place or the wrong time, possibly modifying critical system state.
Impact: DoS: Crash, Exit, or RestartOther
The attacker might be able to use reflection to call the wrong code, possibly with unexpected arguments that violate the API (7PK - API Abuse). This could cause the product to exit or hang.
Impact: Read Application Data
By causing the wrong code to be invoked, the attacker might be able to trigger a runtime error that leaks sensitive information in the error message, such as Servlet Runtime Error Message Containing Sensitive Information.
javajavajava