CWE-470

Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')

High

Description

The product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code.

Potential Impact

How to Fix

Architecture and Design

Refactor your code to avoid using reflection.

Architecture and Design

Do not use user-controlled inputs to select and load classes or code.

Implementation

Apply strict input validation by using allowlists or indirect selection to ensure that the user is only selecting allowable classes or code.

Detection Methods

Related Weaknesses

References

View on MITRE CWE Database →

Need Help Fixing This Vulnerability?

Our security experts can help you identify and remediate CWE-470 vulnerabilities in your codebase.

Get Security Assessment