Bug 13511 - nagios-check_mk new security issues CVE-2014-2329, CVE-2014-233[0-2], and CVE-2014-0243
Summary: nagios-check_mk new security issues CVE-2014-2329, CVE-2014-233[0-2], and CVE...
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: Security (show other bugs)
Version: 4
Hardware: i586 Linux
Priority: Normal critical
Target Milestone: ---
Assignee: AL13N
QA Contact: Sec team
URL: http://lwn.net/Vulnerabilities/595993/
Whiteboard: MGA3TOO
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-10 18:29 CEST by David Walser
Modified: 2015-09-02 17:36 CEST (History)
3 users (show)

See Also:
Source RPM: nagios-check_mk-1.2.3i1-3.mga4.src.rpm
CVE:
Status comment:


Attachments

Description David Walser 2014-06-10 18:29:12 CEST
Fedora has issued an advisory on May 28:
https://lists.fedoraproject.org/pipermail/package-announce/2014-June/134166.html

For the first 4 CVEs, it appears that they were fixed in 1.2.3i5 and 1.2.4p1.

It's not immediately clear whether 1.2.0p3 is affected, but I'll assume so.

For the last CVE, the job directory is not shipped in the package, so apparently it gets created at runtime with permssions that cause this issue.  Fedora fixed it by shipping the directory in the package with appropriate permissions.  I would think a %post scriplet to fix the directory permissions if it already exists would be appropriate too, but they didn't do that.

Reproducible: 

Steps to Reproduce:
David Walser 2014-06-10 18:29:18 CEST

Whiteboard: (none) => MGA4TOO, MGA3TOO

Comment 1 David Walser 2014-06-10 19:51:58 CEST
LWN reference for CVE-2014-0243:
http://lwn.net/Vulnerabilities/601893/
Comment 2 roelof Wobben 2014-06-16 17:31:31 CEST
Committed revision 637577.

CC: (none) => r.wobben

Comment 3 David Walser 2014-06-16 18:24:27 CEST
(In reply to roelof Wobben from comment #2)
> Committed revision 637577.

The name of our package is nagios-check_mk.  In Fedora (where you probably got your SPEC from), it's called check_mk.  We need to keep ours the same as it was.  So, you should restore the realname macro at the top at least, and use it how it was used.  The other ones don't need to be defined explicitly (since RPM defines them implicitly).

After that, it's really hard to follow all of the changes because you just completely replace the SPEC file.  It's better to just keep the SPEC file mostly the same, and just integrate the changes that are needed to update it to the newer version.  I'd suggest reverting this revision and starting over.
Comment 4 roelof Wobben 2014-06-16 18:51:26 CEST
oke, 

But still I have to replace the build section because it looks like to me that the old version needs to be changed to work with systemd. The new version works fine with systemd. 

Roelof

CC: (none) => rwobben

Comment 5 David Walser 2014-06-16 19:00:18 CEST
The old version had a patch for systemd support and already had a systemd-check_mk_agent package.  I guess the patch may not be needed with the new version.  It is quite a long and complicated %install section, it very well may require changes.
Comment 6 David Walser 2014-07-03 17:50:01 CEST
(In reply to David Walser from comment #3)
> (In reply to roelof Wobben from comment #2)
> > Committed revision 637577.
> 
> I'd suggest reverting this revision and starting over.

Commit 637577 has been reverted.
Comment 7 David Walser 2014-07-09 00:49:57 CEST
Looking into this more carefully, not all of the issues (at least CVE-2014-2330) were fixed in any 1.2.3 release (and the DT advisory hints that CVE-2014-2330 and CVE-2014-2331 weren't fixed upstream at the time it was posted).  So, it does appear that an update to at least 1.2.4p1 would be necessary.  It does not appear that backporting patches would be a realistic option for this one.  The current upstream release is 1.2.4p5.  I'll have to leave this up to the package maintainers to update it.  Please note the information in Comment 0 about fixing CVE-2014-0243.

CC: r.wobben, rwobben => guillomovitch

Comment 8 AL13N 2014-07-09 22:54:25 CEST
well, let's see if this works for cauldron first...

not sure on the %post scriptlet for mga4, what did you have in mind?

%post agent
chmod 0755 %{_localstatedir}/check_mk_agent/job


something like this?

or g-s ?
Comment 9 David Walser 2014-07-09 22:59:37 CEST
(In reply to AL13N from comment #8)
> well, let's see if this works for cauldron first...
> 
> not sure on the %post scriptlet for mga4, what did you have in mind?
> 
> %post agent
> chmod 0755 %{_localstatedir}/check_mk_agent/job
> 
> 
> something like this?

Not just for mga4, but yes, exactly that.
Comment 10 AL13N 2014-07-09 23:36:16 CEST
hmm, it looks like this last CVE was put into 4p5 tarball after all, even though that commit is not in the 4p5 branch... ???
Comment 11 David Walser 2014-07-09 23:42:42 CEST
(In reply to AL13N from comment #10)
> hmm, it looks like this last CVE was put into 4p5 tarball after all, even
> though that commit is not in the 4p5 branch... ???

Not sure what you mean.  CVE-2014-0243, if that's the one you're talking about is I guess a upstream issue that can mitigated through packaging, so whether or not it was addressed upstream, we can address it in the package the same way Fedora did (plus the %post that they forgot).  If you're talking about something else, then you'll need to clarify.
Comment 12 AL13N 2014-07-09 23:46:40 CEST
i'm talking about:
- https://bugzilla.redhat.com/show_bug.cgi?id=1101669
- which links to http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a2ef8d00c53ec9cbd05c4ae2f09b50761130e7ce

now, that commit is not in 1.2.4p5 branch so i figured i needed to add it, but then i saw that this code was in the 1.2.4p5 tarball after all... 

they solved it by having per user subdir in the check_mk_agent/job/ directory instead of having setuid bit set...
Comment 13 David Walser 2014-07-09 23:56:54 CEST
(In reply to AL13N from comment #12)
> i'm talking about:
> - https://bugzilla.redhat.com/show_bug.cgi?id=1101669
> - which links to
> http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;
> h=a2ef8d00c53ec9cbd05c4ae2f09b50761130e7ce
> 
> now, that commit is not in 1.2.4p5 branch so i figured i needed to add it,
> but then i saw that this code was in the 1.2.4p5 tarball after all... 
> 
> they solved it by having per user subdir in the check_mk_agent/job/
> directory instead of having setuid bit set...

Ahh, I see.  So Fedora's workaround shouldn't be needed anymore.  That commit actually *is* in the 1.2.4 branch.  It's the last commit before 1.2.4p3 was tagged.

So if that change is a big deal, you might want to add a note to the advisory pointing users to the migration notes that upstream mentioned in the commit.
Comment 14 AL13N 2014-07-10 08:58:43 CEST
well, we should point to the migration notes anyway, since this is a version upgrade instead of just a minor update. more will have changed than just this...
Comment 15 Thierry Vignaud 2014-07-10 14:28:09 CEST
I commented on the package changelog then i was directed here:
Using %post is wrong.
Now that the job/ directory is owned by the package, permissions will be enforced by rpm.
This is the sane thing to do.

So rpm will create its on install/update, make sure the perms as those
of the %install's mkdir.
So ths %post is useless and just slow down install (spawning a shell that spawn
a mkdir for nothing)

Just kill the %post and keep the other bits (packaging the jobs
directory as this is enough

This is also why FC doesn't use a %post.

CC: (none) => thierry.vignaud

Comment 16 David Walser 2014-07-10 14:33:05 CEST
Thanks Thierry.  It didn't occur to me that rpm would change the directory's permissions if it already existed.  This turned out to be irrelevant anyway since upstream completely changed the way it uses that directory, so the %post will be going away for that reason as well.
Comment 17 David Walser 2014-08-23 15:46:53 CEST
Fixed in Cauldron in nagios-check_mk-1.2.4p5-2.mga5.

Version: Cauldron => 4
Whiteboard: MGA4TOO, MGA3TOO => MGA3TOO

Comment 18 David Walser 2014-09-03 00:26:43 CEST
Not sure which versions are affected, but 1.2.4p4 also fixed VE-2014-5338, CVE-2014-5339, CVE-2014-5340:
https://bugzilla.redhat.com/show_bug.cgi?id=1132337#c2
Comment 19 David Walser 2014-09-30 21:00:53 CEST
(In reply to David Walser from comment #18)
> Not sure which versions are affected, but 1.2.4p4 also fixed VE-2014-5338,
> CVE-2014-5339, CVE-2014-5340:
> https://bugzilla.redhat.com/show_bug.cgi?id=1132337#c2

Fedora has issued an advisory for this on September 19:
https://lists.fedoraproject.org/pipermail/package-announce/2014-September/139066.html

from http://lwn.net/Vulnerabilities/613807/
Comment 20 Nicolas Lécureuil 2015-05-10 23:00:58 CEST
what about this on mga4 ? We have check_mk-1.2.3i1 

do we update to a new upstream release like in f20 ?

CC: (none) => mageia

Comment 21 David Walser 2015-05-10 23:44:08 CEST
(In reply to Nicolas Lécureuil from comment #20)
> what about this on mga4 ? We have check_mk-1.2.3i1 

Still vulnerable.

> do we update to a new upstream release like in f20 ?

That appears to be the only solution.  IIRC, the migration from 1.2.3 to 1.2.4 is non-trivial.
Comment 22 Nicolas Lécureuil 2015-05-14 17:36:17 CEST
yes but if we don't have other solution...:)

what about a urpmi.README ( or README.urpmi i never recall the good one ).
Comment 23 David Walser 2015-09-02 17:36:17 CEST
With only a couple of weeks remaining in Mageia 4's lifetime, we don't have time to fix this and test it.  This package has been dropped and no longer exists in Mageia as of Mageia 5.  Closing this as OLD.

Status: NEW => RESOLVED
Resolution: (none) => OLD


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