From: Dominik Vogt <dominik.vogt@gmx.de>
To: linux-kernel@vger.kernel.org
Cc: dominik.vogt@gmx.de
Subject: SECURITY BUG: Symlink exploit in 2.6.8 ia64 build scripts
Date: Tue, 5 Oct 2004 20:49:49 +0200 [thread overview]
Message-ID: <20041005184949.GA24154@gmx.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]
The 2.6.8 kernel sources (and earlier 2.6.x versions) are
susceptible to temporary filename attacks. In the arch/ia64
branch, there are several scripts that are vulnerable to known
temporary filename attacks:
scripts/check-gas
scripts/toolchain-flags
sn/runsim
All three write to temporary files named out$$, out$$.o or tmp.$$
where $$ is replaced with the process pid.
A local attacker can use symlinks to let the build processes
overwrite any file if they are executed as root.
Exploit script:
$ cd /tmp || exit 1
$ for i in `seq 32767`; do ln -s owned out.$i.o; done
$ cd <path_to_2.6.8 sources>
$ make ARCH=ia64
should demonstrate the problem, but I can't test it as I don't
have an ia64 cross compiler. However, I can see that, for
example, the line
gcc -c <path>/arch/ia64/scripts/check-gas-asm.S -o /tmp/out29763.o
is executed, and if I remove the contents of check-gas-asm.S, the
symlink attack does work (i.e. the file /tmp/owned is
overwritten).
Proposed fix:
Normally, I would fix that by using the mktemp command to generate
the temporary filenames, but I'm not sure that is acceptable for
the kernel:
umask 077
out=`mktemp "$tmp/outXXXXXXXX.o"` || exit 1
An alternate solution might be
umask 077
set -C
(Please CC me)
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt, dominik.vogt@gmx.de
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
reply other threads:[~2004-10-05 18:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20041005184949.GA24154@gmx.de \
--to=dominik.vogt@gmx.de \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.