mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NiTRo <nitroml@ntd.homelinux.org>
To: linux-kernel@vger.kernel.org
Cc: cve@mitre.org
Subject: SECURITY PROBLEM: filesystem permiossion bypass on FD already opened
Date: Fri, 23 Oct 2009 22:00:47 +0200	[thread overview]
Message-ID: <4AE20B6F.4060606@ntd.homelinux.org> (raw)

Hi to all,
    Sorry for my bad english.
    Just discovered this security problem on my Suse 11 (Linux xxxx
2.6.25.18-0.2-pae #1 SMP 2008-10-21 16:30:26 +0200 i686 i686 i386
GNU/Linux) and my Slackware 10.1.0 (Linux xxxx 2.4.29-ow1 #1 Wed Feb 2
00:05:42 CET 2005 i586 unknown unknown GNU/Linux) with OpenWall patch.
If a FD is opened on a allowed file and then the permission is changed
the file is still redeable starting from the already read position to
the EOF.

This is the scenario:

<root> creates a file /tmp/aaaa with 666 permission an with the "test"
string inside it
        xxx:/tmp # echo test > /tmp/aaaa
        xxx:/tmp # chmod 666 /tmp/aaaa
<sb> opens this file hooking it in a shell as FD number 3
        sb@xxx:~> bash 3< /tmp/aaaa
<sb> read and prints it
        sb@xxx:~> read a <&3
        sb@xxx:~> echo $a
        test
        sb@xxx:~>
...anythig as expected...
<root> changes the permissions on file to 600 and changes its content
into "test o.o I cannot believe it..."
        xxx:/tmp # chmod 600 /tmp/aaaa
        xxx:/tmp # echo "test o.o I cannot believe it..." > /tmp/aaaa
<sb> continue to try reading the file
        sb@xxx:~> read a <&3
        sb@xxx:~> echo $a
        o.o I cannot believe it...
        sb@test:~>
... and this is not expected...

Writing control seems to be working fine... "bash: echo: write error:
Bad file descriptor"

Hope this can help...

Thanks to all
Alessandro Soraruf

             reply	other threads:[~2009-10-23 20:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23 20:00 NiTRo [this message]
2009-10-23 20:44 ` Marcin Slusarz
2009-10-23 20:54   ` Pavel Machek
2009-10-23 22:42     ` NiTRo
2009-10-23 20:59 ` Pavel Machek
2009-10-23 22:55 ` David Wagner
2009-10-25  6:30   ` Pavel Machek

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=4AE20B6F.4060606@ntd.homelinux.org \
    --to=nitroml@ntd.homelinux.org \
    --cc=cve@mitre.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®