Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 630922

Summary: net-voip/openmcu: root privilege escalation via "chown -R" in pkg_postinst
Product: Gentoo Security Reporter: Michael Orlitzky <mjo>
Component: AuditingAssignee: Gentoo Security Audit Team <security-audit>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Michael Orlitzky gentoo-dev 2017-09-13 18:35:17 UTC
The openmcu ebuild calls "chown -R" on the live root filesystem in pkg_postinst:

  pkg_postinst() {
      einfo "Setting permissions..."
      chown -R openmcu:openmcu "${ROOT}"etc/openmcu
      ...

This can be exploited by the "openmcu" user to gain root if he places a hard link to a root-owned file in one of those directories. The next time the package is upgraded or reinstalled, the "chown -R" will give root's file to the "openmcu" user. For example,

  1. emerge openmcu
  2. su -s /bin/sh -c 'ln /etc/passwd /etc/openmcu/x' openmcu
  3. emerge openmcu
  4. /etc/passwd is owned by openmcu:openmcu

I'm marking this private, but the package is maintainer-needed, to security@ will need to CC someone appropriate to fix it.
Comment 1 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2018-01-26 23:01:42 UTC
The package has been removed.