Re: y won't this work: chmod u+s /bin/sh

From: Nico Kadel-Garcia (nkadel_at_verizon.net)
Date: 06/06/03


Date: Fri, 06 Jun 2003 12:39:12 GMT

Kasper Dupont wrote:

> Vilmos Soti wrote:

>>The kernel ignores the suid bit for shell scripts due to
>>race condition. When you execute a program, the system
>>checks if it is an executable. If the first two bytes
>>are "#!", then it is supposed to be a script which should
>>be executed with the program which's name immediately
>>follows the "#!" bytes. That program is called, and the name
>>of the script is passed to it as an argument. And here is
>>a gap between the first read, and when the program (shell,
>>perl, etc.) opens the file. If the file is replaced during
>>that time, then it can cause problems. Therefore, the
>>suid bit is ignored for scripts.
>
>
> On my system /bin/sh is *not* a script.

Scripts that need to be executed as root should either be sudo'd, which
is not very safe because scripts can often be replaced if not locked
down with root ownership, or written with perl and run with suidperl
(which does decent checking of the script itself).



Relevant Pages

  • Re: Any Perl that works offline from WinXP desktop?
    ... I'm looking for a Perl program that will allow me to ... > execute Perl scripts offline on my WinXP desktop. ... GCI scripts you are probably better off installing a web server. ...
    (comp.lang.perl.misc)
  • Re: Security Breach ?
    ... > Alright well not it's certain I have a friend on my system. ... A perl script does not have to be executable to run. ... Perl can run the contents simply by reading it, without having execute ... The same thing applies to shell scripts, python scripts, etc. ...
    (Fedora)
  • SEO and processing forms.
    ... Presume John Bokma is for sure, as he's into Perl. ... I have been trying to use some scripts but nothing seems to work. ... Below you can find info that 1&1 provide on CGI scripts. ... option to execute your own CGI scripts. ...
    (alt.internet.search-engines)
  • Re: ActiveState Perl mangles text files
    ... > Perl only looks for the word perl in the first line./ ... The use of perl to execute your .pl files is done ... XP now integrates the file associations into calls from a command ... And running scripts under ...
    (comp.lang.perl.misc)
  • Re: Problem with IIS 6.0 serving .NET applications
    ... It's working now because you need to have "scripts and executable" ... > to "None" and I'd get the content of the exe shown in the browser, ... >> Did you set Application & Scripts execute permissions? ... >>> execute permission on that Virutal Directory, ...
    (microsoft.public.inetserver.iis.security)