REFLECTION INJECTION

Feature Value
Type Detection
Risk OWASP A1
Covered by Agent

The application takes data from the user and uses it to load classes by reflection. If an attacker can supply values that the application then uses to determine which class to instantiate or which method to invoke, the potential exists for the attacker to create control flow paths through the application that were not intended by the application developers. This attack vector may allow the attacker to bypass authentication or access control checks or otherwise cause the application to behave in an unexpected manner.

This situation becomes a doomsday scenario if the attacker can upload files into a location that appears on the application's classpath or add new entries to the application's classpath. In either of these situations, the attacker can use reflection to introduce new, presumably malicious behavior into the application.

Example:

Report r = Class.forName("com.mycompany.report."+request.getParameter("ReportType"));
r.execute();

More information

How to solve it

Define practises that reduce the risk and perform better checks