If an attacker can control the value of attacker_controlled_nasty_variable
, is this segment of code vulnerable?
dic={"one":1,
"nasty":attacker_controlled_nasty_variable,
}
store=str(dict)
...
dic=eval(store)
Use ast.literal_eval()
instead of eval()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With