in reply to Taint Mode

Well, you will get this error message if the shebang line is actually no more used as such:

$ cat example #!/usr/bin/perl -T print "hello\n"; $ chmod u+x example; example hello $ perl example Too late for "-T" option at ol line 1.

I can only guess what this means: When you start a script with `perl scriptname`, perl starts up and might enable the "taint mode" or not and _then_ takes your script. Because it's clever it examines the input file for a shebang line and tries to get as much as possible out of it, but '-T' can no more be evaluated. If you start your script as `scriptname`, the shebang is _really_ the perl-call and so perl gets all startup-information from that line. In CGI environment the shebang is also the startup-information-source for perl, so it's not "too" late there.

--
http://fruiture.de

Replies are listed 'Best First'.
Re: Re: Taint Mode
by diotalevi (Canon) on Sep 24, 2002 at 17:33 UTC

    In some close reading of the OpenBSD kernel (for example) you'll notice that the shebang line is handled directly by the underlying exec() call. This is partly where the old thing about interpreted scripts under SUID had issues - #1 the OS reads the file, #2 interpretes the shebang, #3 executes the interpretor, #4 the interpretor reads from the already open file and executes. The attack was to replace the OK code with bad code somewhere between step #1 and step #4.

    I think the fix was to prevent the non-SUID user from getting access to the SUID's user's about-to-be-passed filehandles though I don't really recall.

Re: Re: Taint Mode
by kryberg (Pilgrim) on Sep 24, 2002 at 17:22 UTC
    Wow. I've never posted here before. That was fast. All the replies helped me understand things better. Thanks.