Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 193589 (CVE-2007-6249) - sys-apps/portage < 2.1.3.11 File disclosure when when merging with etc-update (CVE-2007-6249)
Summary: sys-apps/portage < 2.1.3.11 File disclosure when when merging with etc-update...
Status: RESOLVED FIXED
Alias: CVE-2007-6249
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All All
: High normal
Assignee: Gentoo Security
URL:
Whiteboard: A3 [glsa]
Keywords:
Depends on:
Blocks: 194041
  Show dependency tree
 
Reported: 2007-09-24 07:16 UTC by SpanKY
Modified: 2007-12-13 22:07 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2007-09-24 07:16:56 UTC
the merge file etc-update uses while merging configuration files is created with umask based permissions instead of permissions like that of the files being merged ... i forget how i came across this originally, but it was just something i noticed randomly

so if you have:
/etc/foo - 0700
/etc/._cfg0000_foo - 0700
and you go to merge these, during the merge process the file:
/etc/foo.merged
will most likely be created with 0644 ... granted, this depends on the umask set for the user (probably root) running `etc-update`, but there's no reason this cant be handled securely

i dont know if people wish to issue a GLSA (would have to release a fixed version of portage first)

the exact fix is:
http://sources.gentoo.org/viewcvs.py/portage?rev=7799&view=rev
any input on how i fixed it would of course be welcomed, but the details are merely:
 - create tmpdir
 - force permission of tmpdir to 0700
 - force ownership to user running `etc-update`
 - store temp merged file in the tmpdir
 - change the permission/ownership of merged file before overwriting old file
Comment 1 Zac Medico gentoo-dev 2007-09-29 03:46:28 UTC
(In reply to comment #0)
> the exact fix is:
> http://sources.gentoo.org/viewcvs.py/portage?rev=7799&view=rev
> any input on how i fixed it would of course be welcomed, but the details are
> merely:
>  - create tmpdir
>  - force permission of tmpdir to 0700
>  - force ownership to user running `etc-update`
>  - store temp merged file in the tmpdir
>  - change the permission/ownership of merged file before overwriting old file

>=sys-apps/portage-2.1.3.11 has that fix.
Comment 2 Mikael Magnusson 2007-09-30 14:41:35 UTC
the code actually in 2.1.3.11 is the following, which is very unlikely to work:

#
# Run the script
#
scriptname=$(basename $0)

TMP="${PORTAGE_TMPDIR}/etc-update-$$"
trap die term

type portageq > /dev/null || exit $?
eval $(portageq envvar -v CONFIG_PROTECT \
	CONFIG_PROTECT_MASK PORTAGE_CONFIGROOT PORTAGE_TMPDIR ROOT USERLAND)
export PORTAGE_TMPDIR


I suggest setting PORTAGE_TMPDIR before trying to use it ;).
Comment 3 Zac Medico gentoo-dev 2007-09-30 16:36:57 UTC
(In reply to comment #2)
> I suggest setting PORTAGE_TMPDIR before trying to use it ;).

That's fixed in svn already. It still works, it's just that /etc-update-$$ is used as the temp dir, which is kind of weird.
Comment 4 Robert Buchholz (RETIRED) gentoo-dev 2007-11-06 04:21:35 UTC
Just to be sure: This is fixed without known regressions in portage-2.1.3.16 which is going stable per bug 197165?

Because it is not listed as blocking bug 194041.
Comment 5 Zac Medico gentoo-dev 2007-11-06 07:17:07 UTC
(In reply to comment #4)
> Just to be sure: This is fixed without known regressions in portage-2.1.3.16
> which is going stable per bug 197165?

That's right.
Comment 6 Robert Buchholz (RETIRED) gentoo-dev 2007-12-05 02:22:44 UTC
This one is ready for glsa decision. It somehow slipped through because of the wrong component :-/

I tend to vote YES here.
Comment 7 Pierre-Yves Rofes (RETIRED) gentoo-dev 2007-12-10 21:28:15 UTC
voting yes too, and this way, we'll be able to safely close #149062.
Comment 8 Robert Buchholz (RETIRED) gentoo-dev 2007-12-10 21:40:39 UTC
(In reply to comment #7)
> voting yes too, and this way, we'll be able to safely close #149062.

Do you plan to release a combo-glsa, because otherwise these two are unrelated.
Comment 9 Pierre-Yves Rofes (RETIRED) gentoo-dev 2007-12-13 22:07:57 UTC
GLSA 200712-11