Re: writing logs in a file that needs root previlages

Rahul <nospam@xxxxxxxxxxxxxx> writes:

Thanks! The only secure solution seems a setuid and unfortunately C seems
the only way to do that. Too bad that bash scripts aren't allowed to do a
previlage escalation for the log writing part. I wonder why though? Is bash
in some way less secure than C?

The real problem with set UID scripts is that the kernel has to do three steps:

1) Open the file, find the name of the engine (bash) and start the
2) Set the UID
3) Open the file read it into the engine.

Between 1 and 3, it is possible to change the contents of the script
file. While it seems hard, I can create a series of symbolic links
(hundreds) that point to the script. I then execute the setuid script,
and if I change one of the symbolic links, I can point to a new file
and gain priviledges.

Solaris allows setuid shell scripts. The Bourne shell has a special
flag that passes the contents of the script as a file descriptor,
instead of passing a file name.


Relevant Pages

  • Re: [ Attn: Randy ] Ad-hoc Parsing?
    ... > 1) They were out of context quotes, as the quotes came with no context. ... embed cpu instructions within a DOS/Windows batch script. ... that this also is possible with bash scripts. ... statement "It can execute the .com file as easily as a ...
  • Re: [opensuse] Editting PATH variable
    ... SuSEconfig script ... ... not knowing what you options you used to install ... If your unfamiliar with Bash a good book is 'Learning the Bash Shell' by ... For Java use editing the PATH variable is NOT required... ...
  • Re: Command Line Interface
    ... >> should accept system commands only for an administrator. ... >> how should I supress the bash shell and launch my custom CLI ... > The script could run in a restricted shell and offer a menu of ... account, and either 1) change account password, 2) ...
  • Re: Reverse ldd ??
    ... people don't use them and that bash is what everyone does use, ... learning a new language in order to recode a snippet. ... then you will quickly recognize what the tclshell script ... I just am saying that's what I found confusing. ...
  • Re: bash: WHY???
    ... IMHO bash 2.05+ is the most usable interactive shell as it has ... OK - but call it a bash script, ... default in sh using sh features. ...