|Pathologically Eclectic Rubbish Lister|
I'm a little suprised people are still being suprised by the magic of the open call.
I'm not surprised by the open call. I'm surprised that Perl uses this way to open files with magic ARGV. Three argument open would have been a lot safer.
I'm very sure I'm not the only one who forgot that magic ARGV uses normal two-arg open internally. The number of exploitable scripts made by my customers and myself proves that most people are unaware of the security problems or chose to simply ignore them. I found 15 so far.
If you're worried, turn on taint.
Thanks. Even though I hate Perl's tainting mechanism, I'll use it here. It still cannot really fix the problem, since scripts will now die if they encounter an invalid file.
BTW, who runs oneliners as root? (i'd consider that a bug)
Everyone who needs a script to run as root runs scripts as root.
Users can't do everything root can, and sometimes you need to be root to do what you want to do.
And some of those things are made by me, and those things made by me are written in Perl.
The one-liners run as root because they need to do things that only root can do.