Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 68846
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Security <security@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Florian Schilhabel (RETIRED) <ruth@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 68846 depends on: 69147 Show dependency tree
Bug 68846 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2004-10-25 08:42 0000
app-portage/gentoolkit / qpkg: symlink attack vulnerability

hi,
i have found a tmpfile / symlink attack vulnerability in qpkg (part of app-portage/gentoolkit):

-- snip --

# $Header: /home/cvsroot/gentoolkit/src/qpkg/qpkg,v 1.13 2004/02/18 15:25:43 los
tlogic Exp $
ID='$Id: qpkg,v 1.13 2004/02/18 15:25:43 lostlogic Exp $'
VERSION=0.`echo ${ID} | cut -d\  -f3`

TMP="/tmp/qpkg-${$}/"
rm -rf ${TMP}
mkdir -p ${TMP}

PROG=`basename ${0}`

# Parse args

-- snip --
as you can see, qpkg creates a temporary directory in /tmp, that is highly predictable (insecure!!!), because the
directoryname is derived from the pid of the qpkg process...
an attacker could do a simple symlink from
/etc/ to /tmp/qpk-[pidnumber]
for example, and completely delete the /etc directory.
the same is possible, of course, with every directory on the system (qpkg is usually invoked a root)

impact:
an attacker is able to delete / overwrite virtually every directory (file) on the system.


solution:

create a secure temporary directory (mktemp), set up a secure umask.

best regards
florian [rootshell]

------- Comment #1 From Thierry Carrez (RETIRED) 2004-10-26 01:31:25 0000 -------
Genone, any hint on who specifically we should call to fix that ?

------- Comment #2 From solar 2004-10-26 08:34:06 0000 -------
After looking at this bug jstubbs noticed the same symlink problems exist for
portage's handling of dispatch.conf. Jason is working on a patch for that now. 

------- Comment #3 From Marius Mauch (RETIRED) 2004-10-26 15:34:49 0000 -------
Well, personally I'd like to just drop qpkg, but I guess we can't do that :(
I'll fix it in CVS but I'm not sure if I can make a release at this moment (as CVS currently has some experimental stuff, read: is broken), I have to check for that and report back later.
PS: I'm on the security alias, no need to CC me (unless you want to remove me from it).

------- Comment #4 From Marius Mauch (RETIRED) 2004-10-26 16:22:09 0000 -------
Hmm, apparently I can't access the bug when I'm not in the CC list even though
I get all mails about it ...

------- Comment #5 From Thierry Carrez (RETIRED) 2004-10-30 09:32:13 0000 -------
Where are we now ? Was a patch written / put in CVS ? 

------- Comment #6 From Marius Mauch (RETIRED) 2004-10-30 18:14:16 0000 -------
added a patch for this and released pre8-r1 (arch) and pre10-r1 (~arch).

------- Comment #7 From Sune Kloppenborg Jeppesen 2004-10-31 00:16:15 0000 -------
Thx Marius

Time for GLSA decision. Perhaps it should be combined with bug #69147?

------- Comment #8 From Thierry Carrez (RETIRED) 2004-10-31 02:33:13 0000 -------
Yes, good idea. These are all symlink vulns in portage-related tools.

------- Comment #9 From Sune Kloppenborg Jeppesen 2004-11-07 10:51:08 0000 -------
GLSA 200411-13

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug