BaseDraft

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

Category: other

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. If the product uses external inputs to determine which class to instantiate or which method to invoke, then an attacker could supply values to select unexpected classes or methods. If this occurs, then the attacker could create control flow paths that were not intended by the developer. These paths could bypass authentication or access control checks, or otherwise cause the product 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 product's classpath (CWE-427) or add new entries to the product's classpath (CWE-426). Under either of these conditions, the attacker can use reflection to introduce new, malicious behavior into the product.

Common consequences· 3

  • Integrity / Confidentiality / Availability / Other — Execute Unauthorized Code or Commands, Alter 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.
  • Availability / Other — DoS: Crash, Exit, or Restart, Other
    The attacker might be able to use reflection to call the wrong code, possibly with unexpected arguments that violate the API (CWE-227). This could cause the product to exit or hang.
  • Confidentiality — 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 CWE-536.

Potential mitigations· 3

  • [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.

Related CAPEC attack patterns· 1

CAPEC-138

References

  1. https://cwe.mitre.org/data/definitions/470.html

Exploits (incoming)1

TypeTargetConfidenceTier
AttackPatternReflection Injectioncapec-138100%live

(incoming)9

TypeTargetConfidenceTier
VulnerabilityCVE-2025-12967cve-2025-129670%live
VulnerabilityCVE-2025-34393cve-2025-343930%live
VulnerabilityCVE-2025-53693cve-2025-536930%live
VulnerabilityCVE-2025-63690cve-2025-636900%live
VulnerabilityCVE-2026-41175cve-2026-411750%live
VulnerabilityCVE-2026-42027cve-2026-420270%live
VulnerabilityCVE-2026-44339cve-2026-443390%live
VulnerabilityCVE-2026-8178cve-2026-81780%live
KEVEntryVMware vCenter Server Improper Input Validation Vulnerabilitykev-cve-2021-219850%live

Related by meaning· 6

Nearest entities by semantic similarity across the cs-graph corpus.

CWE
Improper Control of Resource Identifiers ('Resource Injection')
CWE
Improper Control of Dynamically-Managed Code Resources
CWE
Reliance on Untrusted Inputs in a Security Decision
CWE
Improper Control of Generation of Code ('Code Injection')
CWE
Exposed Dangerous Method or Function
CWE
Comparison of Classes by Name
Sourced from MITRE CWE 4.20. Curated for EU compliance use cases by Adam Lundqvist, Founder at SQUR.