From: Alexey Tourbin <at@altlinux.ru>
To: devel@altlinux.ru
Subject: [devel] suid/sgid programs and temporary files
Date: Tue, 16 Aug 2005 23:31:36 +0400
Message-ID: <20050816193136.GT19097@solemn.turbinal.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]
В /usr/lib/perl5/File/Temp.pm есть функция проверки временного каталога,
в котором будут созданы временные файлы.
649 # internal routine to check to see if the directory is safe
650 # First checks to see if the directory is not owned by the
651 # current user or root. Then checks to see if anyone else
652 # can write to the directory and if so, checks to see if
653 # it has the sticky bit set
...
668 sub _is_safe {
669
670 my $path = shift;
671 my $err_ref = shift;
672
673 # Stat path
674 my @info = stat($path);
675 unless (scalar(@info)) {
676 $$err_ref = "stat(path) returned no values";
677 return 0;
678 };
679 return 1 if $^O eq 'VMS'; # owner delete control at file level
680
681 # Check to see whether owner is neither superuser (or a system uid) nor me
682 # Use the real uid from the $< variable
683 # UID is in [4]
684 if ($info[4] > File::Temp->top_system_uid() && $info[4] != $<) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
685
686 Carp::cluck(sprintf "uid=$info[4] topuid=%s \$<=$< path='$path'",
687 File::Temp->top_system_uid());
688
689 $$err_ref = "Directory owned neither by root nor the current user"
690 if ref($err_ref);
691 return 0;
692 }
...
Условия подчеркнутой проверки можно перевести примерно как
st.st_uid > 10 && st.st_uid != getuid()
Вопрос: хорошо ли, что здесь используется real uid? Не лучше ли
проверять effective uid?
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2005-08-16 19:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-16 19:31 Alexey Tourbin [this message]
2005-08-16 19:56 ` Dmitry V. Levin
2005-08-16 21:42 ` [devel] " Alexey Tourbin
2005-08-16 22:06 ` Dmitry V. Levin
2005-08-16 22:34 ` Alexey Tourbin
2005-08-16 22:50 ` Dmitry V. Levin
2005-08-16 23:33 ` Alexey Tourbin
2005-08-16 23:38 ` Dmitry V. Levin
2005-08-16 23:52 ` Alexey Tourbin
2005-08-17 7:14 ` [devel] [wiki] " Michael Shigorin
2005-08-16 22:44 ` [devel] " Alexey Tourbin
2005-08-16 22:55 ` Dmitry V. Levin
2005-08-16 23:20 ` Alexey Tourbin
2005-08-16 23:30 ` Alexey Tourbin
2005-08-17 0:37 ` Alexey Tourbin
2005-08-17 0:46 ` Alexey Tourbin
2005-08-17 3:02 ` Andrey Rahmatullin
2005-08-17 6:37 ` Alexey Tourbin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050816193136.GT19097@solemn.turbinal.org \
--to=at@altlinux.ru \
--cc=devel@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git