Unsafe Reflection High

The Go reflect package allows dynamic invocation of methods and fields by name at runtime. When reflection by name is used with externally provided input, an adversary may be able to manipulate the invoked target. This could enable them to bypass authentication or access controls by directing execution to unintended code paths. Reflection is powerful but input used for sensitive operations like MethodByName and FieldByName requires careful validation. Avoiding reflection by name or validating inputs helps prevent unintended behavior resulting from malicious input.

Detector ID
go/unsafe-reflection@v1.0
Category
Common Weakness Enumeration (CWE) external icon