-
-
Notifications
You must be signed in to change notification settings - Fork 729
Description
Is your feature request related to a problem? Please describe.
One of use cases for bandit is a backdoor detection. It doesn't fit it well though, since for proper backdoor detection intermodule and runtime interactions must be addressed, i.e. with taint analysis (and the fact that using bandit for backdoor detection can be easily bypassed must be clearly stated in bold big red font).
It can detect very crude backdoors with explicit eval. But it is easy to mask them, by just obfuscating the string eval and getting the function using getattr.
Also getattr is a bad smell by itself, since it is often dangerously misused. I.e.
class A:
b = lambda b: b
function_id = "string from the net"
getattr(A, function_id)(*args_from_the_net)Instead a collection should be used and A[function_id], which will only allow calling an explicitly defined set of functions.
Describe the solution you'd like
getattr should be blacklisted.