Bug 1214175

Summary: abrt: does not honor dmesg_restrict
Product: Red Hat Enterprise Linux 7 Reporter: Florian Weimer <fweimer>
Component: abrtAssignee: abrt <abrt-devel-list>
Status: CLOSED ERRATA QA Contact: Martin Kyral <mkyral>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: jfilak, mkyral
Target Milestone: rcKeywords: Security
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: abrt-2.1.11-22.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1128400 Environment:
Last Closed: 2015-11-19 14:32:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1128400    
Bug Blocks: 1211224, 1214172    

Description Florian Weimer 2015-04-22 07:31:36 UTC
+++ This bug was initially created as a clone of Bug #1128400 +++

Description of problem:
Kerneloops handlers can be called by any user by communicating directly with the journal unix socket and setting the analyzer as Kerneloops. When this analyzer is set then dmesg is called and dumped to the output dump directory. The dump file is given the permissions of the calling user, which allows any user to read dmesg.

The problem is that no appropriate checks or privilege dropping is done before calling dmesg.

How reproducible:
As long as bug is not duplicate (change type), always when the script is ran from any user.


Steps to Reproduce:
1. Set dmesg_restrict
2. Run attached Python script
3. Navigate to dump directory
4. View dmesg

Actual results:
$ cat /proc/sys/kernel/dmesg_restrict 
1

$ dmesg 
dmesg: read kernel buffer failed: Operation not permitted

$ cat /dev/kmsg 
cat: /dev/kmsg: Operation not permitted

$ python kerneloops.py

$ stat /var/tmp/abrt/dumpit-2014-08-09-23\:02\:36-1/dmesg 
..
Access: (0660/-rw-rw----)  Uid: ( 1001/ test)   Gid: (  173/    abrt)
...

Expected results:
Don't dump dmesg if calling user is restricted.

--- Additional comment from Murray McAllister on 2014-08-12 07:24:23 CEST ---

Hello,

Thank you for the report! I am going to get one of our kernel people to check this, whether it should be treated as a security flaw or just hardening.

Thanks,

--
Murray McAllister / Red Hat Product Security

--- Additional comment from Jakub Filak on 2014-11-11 10:29:53 CET ---

(In reply to Murray McAllister from comment #1)
Murray, any update on this bug report?

Should ABRT stop saving dmesg in the problem directories? Or should ABRT make the problem data accessible to root only if /proc/sys/kernel/dmesg_restrict is 1?

I prefer the latter option.

--- Additional comment from Murray McAllister on 2014-12-18 03:45:46 CET ---

Apologies for missing this and the long delay. From our kernel person:

"this could be treated more as a hardening issue than a security one. More so, it needs to be fixed on the abrtd side, as it provides the journal socket access to user applications to write log messages. without it, the reproducer does not work."

--- Additional comment from Murray McAllister on 2014-12-18 03:47:51 CET ---

I have asked someone to provide guidance on the question.

--- Additional comment from Josh Bressers on 2015-03-31 19:50:12 CEST ---

I'm removing the security flag from this bug. Fedora should not have embargoed issues and this should be opened up so it can be fixed.

--- Additional comment from  on 2015-04-17 18:08:50 CEST ---

With all of the new abrt issues going on around and other 'information disclosure' ones coming out, I figured I should update this ticket so it's in the list.

Comment 2 Jakub Filak 2015-07-09 10:41:06 UTC
The problem directories are accessible only to root users and users authorized via polkit.

distgit commit 5050e2a0eb82c167150af65e712a775bf9a1f447
Author: Jakub Filak <jfilak>
Date:   Tue May 5 15:42:37 2015 +0200

    Fix symlink, race-conditions and other security flaws
    
    Resolves: #1211969, #1212819, #1212863, #1212869
    Resolves: #1214453, #1214610, #1216973, #1218583

Comment 6 errata-xmlrpc 2015-11-19 14:32:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2097.html