SiteShadow
Back to vulnerability library

CWE-470 Unsafe Reflection

What this means

SiteShadow flagged reflection or dynamic class/module loading that is influenced by untrusted input. Reflection is powerful, but if attackers can choose what gets loaded or invoked, they can often bypass intended restrictions.

Why it matters

Unsafe reflection can load unexpected classes or behaviors.

Safer examples

1) Replace reflection with allowlisted dispatch

handlers = {"create": create_user, "delete": delete_user}
handler = handlers.get(action)
if not handler:
    raise ValueError("Invalid action")
handler()

2) Don't build class/module names from user input

Map user input to known implementations instead.

3) Add authorization around dynamic dispatch

Even with allowlists, ensure the selected action is authorized for the caller.

How SiteShadow detects it (high level)

References

---

← Back to Vulnerability Library

Request access View coverage