Gentoo Archives: gentoo-hardened

From: Alex Efros <powerman@××××××××.name>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] GRKERNSEC_PROC_USERGROUP and docker exec
Date: Sat, 09 Sep 2017 09:39:45
Message-Id: 20170909093940.GD2677@home.power
In Reply to: Re: [gentoo-hardened] GRKERNSEC_PROC_USERGROUP and docker exec by "Tóth Attila"
1 Hi!
2
3 On Sat, Sep 09, 2017 at 11:23:46AM +0200, "Tóth Attila" wrote:
4 > I don't use docker myself, but if we are speaking about
5 > CONFIG_GRKERNSEC_PROC_USER and CONFIG_GRKERNSEC_PROC_USERGROUP, it would
6 > be important to know what GID is specified in CONFIG_GRKERNSEC_PROC_GID?
7
8 It's 3 (group "sys"). :)
9
10 # zgrep GRKERNSEC_PROC_GID /proc/config.gz
11 CONFIG_GRKERNSEC_PROC_GID=3
12
13 > So if you can figure out the important
14 > process's GID, you can officially circumwent the restrictions. Too bad if
15 > the incriminated process runs as root... If you can influence with what
16 > GID the important process starts, you have a key for a solution.
17
18 It's a docker's "root", it has fewer capabilities than real root.
19 But, anyway, docker's "root" has mostly same groups (including "sys") as
20 host root:
21
22 $ docker run -it --rm alpine id
23 uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
24 $ sudo id
25 uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),26(tape),27(video)
26
27 Looks like being in group 3(sys) within container just doesn't have same
28 effect as on host. Maybe it's because of some capabilities dropped from
29 container's root account by docker?
30
31 --
32 WBR, Alex.