Bug 1902724 (CVE-2020-35508) - CVE-2020-35508 kernel: fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent
Summary: CVE-2020-35508 kernel: fork: fix copy_process(CLONE_PARENT) race with the exi...
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2020-35508
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1895892 1904784 1904785 1908311 1950760 1962333 1962334
Blocks: 1896156 1939994
TreeView+ depends on / blocked
 
Reported: 2020-11-30 14:01 UTC by Guilherme de Almeida Suckevicz
Modified: 2021-11-04 11:48 UTC (History)
52 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
A flaw possibility of race condition and incorrect initialization of the process id was found in the Linux kernel child/parent process identification handling while filtering signal handlers. A local attacker is able to abuse this flaw to bypass checks to send any signal to a privileged process.
Clone Of:
Environment:
Last Closed: 2021-05-18 20:37:35 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:2538 0 None None None 2021-06-23 18:06:14 UTC
Red Hat Product Errata RHBA-2021:2541 0 None None None 2021-06-24 11:51:30 UTC
Red Hat Product Errata RHSA-2021:2718 0 None None None 2021-07-20 22:10:33 UTC
Red Hat Product Errata RHSA-2021:2719 0 None None None 2021-07-20 21:27:38 UTC

Description Guilherme de Almeida Suckevicz 2020-11-30 14:01:40 UTC
A flaw was found in the Red Hat Linux kernel. It's possible to send arbitrary signals to a privileged (suidroot) parent process.

Comment 1 Alex 2020-12-06 11:29:18 UTC
Mitigation:

Mitigation for this issue is either not available or the currently available options don't meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.

Comment 2 Alex 2020-12-06 11:35:04 UTC
The "incorrect initialization of the process id" of the flaw is actual only for Red Hat Enterprise Linux (starting from 8.3), and non-actual for other (upstream) Linux distributions.

More details about this:

In fork.c:dup_task_struct(), after task->task_struct_rh allocated by kmalloc_node(), task_struct_rh->self_exec_id and
task_struct_rh->vtime_cpu are not initialized, which upstream do initialize them in arch_dup_task_struct(). 

Steps to Reproduce:
1. Compile this module

int init_module(void)
{
	printk(KERN_INFO "[parent ] parent_exec_id: %llu, self_exec_id: %llu\n",
               current->real_parent->task_struct_rh->parent_exec_id, current->real_parent->task_struct_rh->self_exec_id);
	printk(KERN_INFO "[current] parent_exec_id: %llu, self_exec_id: %llu\n",
               current->task_struct_rh->parent_exec_id, current->task_struct_rh->self_exec_id);
	return 0;
}

2. Load it and check dmesg output

Actual results:
[264937.255323] [parent ] parent_exec_id: 64, self_exec_id: 481036337297 <-- seems it is some random value from slab
[264937.255324] [current] parent_exec_id: 481036337297, self_exec_id: 481036337297

Expected results:
[264937.255323] [parent ] parent_exec_id: 64, self_exec_id: 65
[264937.255324] [current] parent_exec_id: 65, self_exec_id: 65

Comment 20 Alex 2021-01-07 16:59:56 UTC
Additional information about the possibility of the integer overflow for the value tsk->parent->self_exec_id:
https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl/

Comment 26 Alex 2021-01-07 18:34:52 UTC
Statement:

The incorrect initialization of the process id affects Red Hat Enterprise Linux only.

Comment 28 Alex 2021-01-11 09:33:49 UTC
The description of the flaw:
"A flaw possibility of race condition and incorrect initialization of the process id was found in the Linux kernel child/parent process identification handling while filtering signal handlers.  A local attacker is able to abuse this flaw to bypass checks to send any signal to a privileged process."

The patch from the reference is for the "race condition" only:
https://github.com/torvalds/linux/commit/b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948

The other patch for the "incorrect initialization of the process id" is internal and for the Red Hat Enterprise Linux only:
https://mailman-eng.corp.redhat.com/archives/rhkernel-list/2020-December/498644.html

Comment 29 Alex 2021-01-14 12:00:24 UTC
Acknowledgments:

Name: Eddy Wu (trendmicro.com)

Comment 35 errata-xmlrpc 2021-05-18 13:20:37 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:1578 https://access.redhat.com/errata/RHSA-2021:1578

Comment 36 errata-xmlrpc 2021-05-18 14:41:03 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:1739 https://access.redhat.com/errata/RHSA-2021:1739

Comment 37 Product Security DevOps Team 2021-05-18 20:37:35 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2020-35508

Comment 39 Michael Hebenstreit 2021-05-20 13:42:23 UTC
the code changes from https://github.com/torvalds/linux/commit/b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948 are not in the RH8.4 kernel just released

could you attach the info from https://mailman-eng.corp.redhat.com/archives/rhkernel-list/2020-December/498644.html here as that address is RedHat internal?

Comment 40 errata-xmlrpc 2021-07-20 21:27:38 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.2 Extended Update Support

Via RHSA-2021:2719 https://access.redhat.com/errata/RHSA-2021:2719

Comment 41 errata-xmlrpc 2021-07-20 22:10:30 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.2 Extended Update Support

Via RHSA-2021:2718 https://access.redhat.com/errata/RHSA-2021:2718


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