Bug 808270

Summary: kernel: sysctl: fix restrict write access to dmesg_restrict
Product: [Other] Security Response Reporter: Eugene Teo (Security Response) <eteo>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: bhu, jkacur, lgoncalv, plougher, rt-maint, security-response-team, williams
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-22 16:05:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 808271, 816233    
Bug Blocks: 808268    

Description Eugene Teo (Security Response) 2012-03-30 01:52:55 UTC
dmesg_restrict sysctl is missing the "if (write && !capable(CAP_SYS_ADMIN))" check due to upstream commit bfdc0b4 (v2.6.39-rc1~118).

Commit bfdc0b4 adds code to restrict access to dmesg_restrict, however, it incorrectly alters kptr_restrict rather than dmesg_restrict.  

The original patch from Richard Weinberger (https://lkml.org/lkml/2011/3/14/362) alters dmesg_restrict as expected, and so the patch seems to have been misapplied.

$ ls -laF /proc/sys/kernel/dmesg_restrict 
-rw-r--r-- 1 root root 0 Mar 29 21:47 /proc/sys/kernel/dmesg_restrict

Comment 3 Eugene Teo (Security Response) 2012-04-05 00:01:38 UTC
Proposed patch:
https://lkml.org/lkml/2012/4/4/252

Comment 4 Eugene Teo (Security Response) 2012-04-10 00:54:04 UTC
Upstream commit:
http://git.kernel.org/linus/620f6e8e855d6d447688a5f67a4e176944a084e8

Commit bfdc0b4 adds code to restrict access to dmesg_restrict, however, it incorrectly alters kptr_restrict rather than dmesg_restrict.

The original patch from Richard Weinberger (https://lkml.org/lkml/2011/3/14/362) alters dmesg_restrict as expected, and so the patch seems to have been misapplied.

This adds the CAP_SYS_ADMIN check to both dmesg_restrict and kptr_restrict, since both are sensitive.

Reported-by: Phillip Lougher <plougher>
Signed-off-by: Kees Cook <keescook>
Acked-by: Serge Hallyn <serge.hallyn>
Acked-by: Richard Weinberger <richard>
Cc: stable.org
Signed-off-by: James Morris <james.l.morris>

Comment 7 Vincent Danen 2015-08-22 16:05:09 UTC
Statement:

This issue did not affect the Linux kernel as shipped with Red Hat Enterprise Linux 4, 5, and 6.  This was fixed in Red Hat Enterprise MRG 2.2.