Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 628656 - <app-admin/vault-0.7.3-r1: privilege escalation via PID file manipulation
Summary: <app-admin/vault-0.7.3-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 trivial (vote)
Assignee: Gentoo Security
URL:
Whiteboard: ~3 [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-22 22:09 UTC by Michael Orlitzky
Modified: 2017-09-01 19:55 UTC (History)
1 user (show)

See Also:
Package list:
=app-admin/vault-0.7.3-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:09:57 UTC
The init script for vault 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.
Comment 1 Christopher Díaz Riveros (RETIRED) gentoo-dev Security 2017-09-01 04:12:44 UTC
@Maintainer: After the bump please let us know when the tree is clean from vulnerable versions, thanks.

Gentoo Security Padawan
ChrisADR
Comment 3 Aaron Bauman (RETIRED) gentoo-dev 2017-09-01 19:55:44 UTC
(In reply to Zac Medico from comment #2)
> Fixed in 0.7.3-r1:
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=090a2be8642f6de680cfe1e93c5e12b8074adf91
> 
> Removed vulnerable versions:
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=555ea185d91907439adac5135b4c48d0210584cd

Thanks again, Zac!