P is for Practical | |
PerlMonks |
Re^3: Taint and Shellshockby LanX (Saint) |
on Sep 28, 2014 at 10:00 UTC ( [id://1102265]=note: print w/replies, xml ) | Need Help?? |
While in theory you can whitelist keys which need to be passed thru from parents env to bash, you'll hardly be able to avoid dangerous values without some heuristics... Like forbidding anything which looks like an env-function. That's what my regex does in a generic way, ie erasing magic values starting with () { . You are free to combine it with further defense measures.° But I doubt you can efficiently realize an individual validation for each string format (like PATH, HOST, IP, USERNAME, ...)
Cheers Rolf (addicted to the Perl Programming Language and ☆☆☆☆ :) °) something like (untested) local %ENV = map { $_ => kill_func $ENV{$_} } @whitelist
In Section
Seekers of Perl Wisdom
|
|