Bug 1568477 (CVE-2018-1000199)

Summary: CVE-2018-1000199 kernel: ptrace() incorrect error handling leads to corruption and DoS
Product: [Other] Security Response Reporter: Pedro Sampaio <psampaio>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: airlied, aquini, asavkov, bhu, blc, bskeggs, carnil, dhoward, dvlasenk, esammons, esyr, ewk, fhrbata, gadgetfu128, hdegoede, hkrzesin, hwkernel-mgr, iboverma, ichavero, itamar, jarodwilson, jbastian, jforbes, jglisse, jkacur, joe.lawrence, john.j5live, jonathan, josef, jpoimboe, jross, jstancek, jwboyer, kernel-maint, kernel-mgr, labbott, lgoncalv, linville, lwang, matt, mchehab, mcressma, mguzik, mjg59, mlangsdo, nmurray, plougher, ppandit, rt-maint, rvrbovsk, security-response-team, skozina, slawomir, steved, williams, yozone
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: impact=important,public=20180501,reported=20180417,source=distros,cvss3=7.8/CVSS:3.0/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H,cwe=CWE-460,rhel-5/kernel=notaffected,rhel-6/kernel=notaffected,rhel-7/kernel=affected,rhel-7/kernel-rt=affected,mrg-2/realtime-kernel=affected,rhel-alt-7/kernel-alt=affected,fedora-all/kernel=notaffected,rhel-8/kernel=affected
Fixed In Version: Doc Type: Bug Fix
Doc Text:
An address corruption flaw was discovered in the Linux kernel built with hardware breakpoint (CONFIG_HAVE_HW_BREAKPOINT) support. While modifying a h/w breakpoint via 'modify_user_hw_breakpoint' routine, an unprivileged user/process could use this flaw to crash the system kernel resulting in DoS OR to potentially escalate privileges on a the system.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-28 14:11:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 1573536, 1569874, 1569875, 1569876, 1569877, 1569878, 1569879, 1569897, 1569935, 1569936, 1569937, 1569938, 1569939, 1569940, 1571203    
Bug Blocks: 1568479    

Description Pedro Sampaio 2018-04-17 15:13:55 UTC
Linux kernel built with the hardware breakpoint(CONFIG_HAVE_HW_BREAKPOINT) support is vulnerable to a breakpoint address corruption issue. It could occur while modifying a h/w breakpoint via 'modify_user_hw_breakpoint' routine.

An unprivileged user/process could use this flaw to crash the system kernel resulting in DoS OR to potentially escalate privileges on a the system.

Upstream patches:
-----------------
  -> https://git.kernel.org/linus/f67b15037a7a50c57f72e69a6d59941ad90a0f0f
  -> https://git.kernel.org/linus/18ff57b220610a699947f20b156a8245ca7eee98
  -> https://git.kernel.org/linus/705feaf321c37e4dca3637fd5cb3b275f17a06c9

Reference:
----------
  -> http://www.openwall.com/lists/oss-security/2018/05/01/3

Comment 1 Adam Mariš 2018-04-18 07:37:08 UTC
Acknowledgments:

Name: Andy Lutomirski

Comment 7 Prasad J Pandit 2018-04-30 20:47:34 UTC
Mitigation:

To mitigate this issue:
1) Save the following script in a 'CVE-2018-1000199.stp' file.
---
probe kernel.function("ptrace_set_debugreg") {
        if ($n < 4)
            $n = 4; /* set invalid debug register #, returns -EIO */
}
probe begin {
        printk(0, "CVE-2018-1000199 mitigation loaded")
}
probe end {
        printk(0, "CVE-2018-1000199 mitigation unloaded")
}
---
2)  Install systemtap package and its dependencies
     # yum install -y systemtap systemtap-runtime
     # yum install -y kernel-devel kernel-debuginfo  kernel-debuginfo-common

3) Build the mitigation kernel module as root.
    # stap -r `uname -r` -m cve_2018_1000199.ko -g CVE-2018-1000199.stp -p4

4) Load the mitigation module as root
    # staprun -L cve_2018_1000199.ko

Comment 9 Eric Christensen 2018-05-01 19:53:43 UTC
Statement:

This issue does not affect the versions of Linux kernel as shipped with Red Hat Enterprise Linux 5 and Red Hat Enterprise Linux 6.

This issue affects the version of the kernel package as shipped with Red Hat Enterprise Linux 7 and Red Hat Enterprise MRG 2. Future kernel updates for Red Hat Enterprise Linux 7 and Red Hat Enterprise MRG 2 may address this issue.

Comment 11 errata-xmlrpc 2018-05-08 18:25:50 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2018:1318 https://access.redhat.com/errata/RHSA-2018:1318

Comment 12 errata-xmlrpc 2018-05-08 19:49:02 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7.4 Extended Update Support

Via RHSA-2018:1345 https://access.redhat.com/errata/RHSA-2018:1345

Comment 13 errata-xmlrpc 2018-05-08 21:37:59 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7.2 Advanced Update Support
  Red Hat Enterprise Linux 7.2 Update Services for SAP Solutions
  Red Hat Enterprise Linux 7.2 Telco Extended Update Support

Via RHSA-2018:1347 https://access.redhat.com/errata/RHSA-2018:1347

Comment 14 errata-xmlrpc 2018-05-08 21:53:55 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7.3 Extended Update Support

Via RHSA-2018:1348 https://access.redhat.com/errata/RHSA-2018:1348

Comment 15 errata-xmlrpc 2018-05-08 22:24:56 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2018:1355 https://access.redhat.com/errata/RHSA-2018:1355

Comment 16 errata-xmlrpc 2018-05-08 22:26:04 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise MRG 2

Via RHSA-2018:1354 https://access.redhat.com/errata/RHSA-2018:1354

Comment 17 errata-xmlrpc 2018-05-14 13:08:38 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2018:1374 https://access.redhat.com/errata/RHSA-2018:1374

Comment 18 Gadget 2018-06-07 01:20:58 UTC
How can you validate that the patch made it on? I see the script and the articles, but can you validate with a version of the kernel?  if I run uname -r and it comes back with 

3.10.0-862.2.3.e17.x86_64

does that mean the system is not vulnerable anymore?

Comment 19 Prasad J Pandit 2018-06-07 10:04:48 UTC
(In reply to Gadget from comment #18)
> if I run uname -r and it comes back with 
> 
> 3.10.0-862.2.3.e17.x86_64
> does that mean the system is not vulnerable anymore?

Yes, it does include the fix. Please note, Bugzilla is not for support queries. 
Please use proper support channel for future questions:

  -> https://access.redhat.com/ 

Thank you.