Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 628654 - <app-admin/serf-0.8.1-r1: privilege escalation via PID file manipulation
Summary: <app-admin/serf-0.8.1-r1: privilege escalation via PID file manipulation
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Security
URL:
Whiteboard: ~3 [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-22 22:06 UTC by Michael Orlitzky
Modified: 2017-09-02 13:43 UTC (History)
1 user (show)

See Also:
Package list:
=app-admin/serf-0.8.1-r1
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Orlitzky gentoo-dev 2017-08-22 22:06:05 UTC
The init script for serf gives ownership of the PID file directory to the same user that the daemon runs as:

  start_pre() {
      checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}"
  }

As a result, the $user can write whatever he wants into the PID file. Later, that may be exploitable: when the service is stopped, root will call "kill" on the contents of that file.

But there's good news: there's no need for the call to "checkpath" above. With command_background=true, OpenRC creates the PID file as root:root, and start_pre() can be deleted if you store the PID file directly in /run.

Some other minor improvements to consider while you're touching the init script:

  1. Use "command_user" for the user/group instead of start_stop_daemon_args.

  2. Can the OpenRC "stopsig" variable be used to eliminate stop() ?
Comment 1 Christopher Díaz Riveros (RETIRED) gentoo-dev Security 2017-09-01 04:11:23 UTC
@Maintainer: After the bump please let us know when no vulnerable versions are in the tree, thanks.

Gentoo Security Padawan
ChrisADR