Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 630034 (CVE-2017-14159) - net-nds/openldap: creates a PID file after dropping privileges to a non-root account
Summary: net-nds/openldap: creates a PID file after dropping privileges to a non-root ...
Status: CONFIRMED
Alias: CVE-2017-14159
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Security
URL:
Whiteboard: B3 [upstream/cve]
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-05 19:55 UTC by Aleksandr Wagner (Kivak)
Modified: 2022-12-05 10:40 UTC (History)
3 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 Aleksandr Wagner (Kivak) 2017-09-05 19:55:06 UTC
CVE-2017-14159 (http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14159):

slapd in OpenLDAP 2.4.45 and earlier creates a PID file after dropping privileges to a non-root account, which might allow local users to kill arbitrary processes by leveraging access to this non-root account for PID file modification before a root script executes a "kill `cat /pathname`" command, as demonstrated by openldap-initscript. 

References:

http://www.openldap.org/its/index.cgi?findid=8703
Comment 1 Michael Orlitzky gentoo-dev 2017-09-06 21:24:57 UTC
Upstream's position on this is that it's not a problem, because (quoting)

  Nobody compromises slapd from the network. There are no buffer overflow 
  vulnerabilities, there are no RCE vulnerabilities.

*shrug*

You'll have to try to work around it in the init script. You can get the user of the process whose PID you find in the file with

  ps -p <pid> -o user=

and you can get the name of the command with

  ps -p <pid> -o comm=

If you check those against the expected values every time you send a signal, it's a lot safer. The most an attacker can do in that case is prevent you from killing his hacked process via the init script.
Comment 2 Michael Orlitzky gentoo-dev 2021-01-25 21:58:41 UTC
> See Also: https://bugs.gentoo.org/show_bug.cgi?id=767184

But I was told that slapd has no vulnerabilities. I wish you could see the face I'm making.
Comment 3 Dennis Lamm gentoo-dev 2022-07-15 06:51:46 UTC
According to https://nvd.nist.gov/vuln/detail/CVE-2017-14159#range-8035897 only versions up to 2.4.45 are affected.

The lowest version in portage is 2.4.57. I assume correctly that this issue could be closed now?
Comment 4 Michael Orlitzky gentoo-dev 2022-07-15 10:45:02 UTC
(In reply to Dennis Lamm from comment #3)
> According to https://nvd.nist.gov/vuln/detail/CVE-2017-14159#range-8035897
> only versions up to 2.4.45 are affected.
> 
> The lowest version in portage is 2.4.57. I assume correctly that this issue
> could be closed now?

2.4.45 was the latest version when I reported the bug, but it still exists.

I guess slapd now supports running in the foreground, to support systemd? If so, you could probably work around the issue in OpenRC relatively easily, by running slapd in the foreground and then using command_background=true to tell OpenRC to background the process itself. The way OpenRC does it is secure.

That approach is covered (indirectly) in,

  https://github.com/OpenRC/openrc/blob/master/service-script-guide.md

where the discussion is focused on daemons that don't know how to background themselves. But if you think of it as "daemons that don't know how to background themselves SECURELY", item 2 in the "Don't write your own start/stop functions" applies.
Comment 5 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-07-15 16:06:48 UTC
(In reply to Dennis Lamm from comment #3)
> According to https://nvd.nist.gov/vuln/detail/CVE-2017-14159#range-8035897
> only versions up to 2.4.45 are affected.
> 
> The lowest version in portage is 2.4.57. I assume correctly that this issue
> could be closed now?

No, CVEs aren't really trustworthy for anything. Rely instead on referenced upstream patches if there are any.