Bug 808270 - kernel: sysctl: fix restrict write access to dmesg_restrict
Summary: kernel: sysctl: fix restrict write access to dmesg_restrict
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 808271 816233
Blocks: 808268
TreeView+ depends on / blocked
 
Reported: 2012-03-30 01:52 UTC by Eugene Teo (Security Response)
Modified: 2021-02-24 12:46 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-22 16:05:09 UTC
Embargoed:


Attachments (Terms of Use)

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.


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