A use-after-free flaw was discovered in the Linux kernel's tty subsystem, which allows for the disclosure of uncontrolled memory location and possible kernel panic. The information leak is caused by a race condition when attempting to set and read the tty line discipline. A local attacker could use the TIOCSETD (via tty_set_ldisc ) to switch to a new line discipline; a concurrent call to a TIOCGETD ioctl performing a read on a given tty could then access previously allocated memory. Up to 4 bytes could be leaked when querying the line discipline or the kernel could panic with a NULL-pointer dereference.
A flaw was discovered in the linux kernel tty subsystem which allows for disclosure of uncontrolled memory location and possible kernel panic. The information leak is caused by a race condition when attempting to set and read the tty line discipline. An attacker can use the TIOCSETD (via tty_set_ldisc ) to switch to a new line discipline, a concurrent call to with a TIOCGETD ioctl performs a read on a given tty may be able to access memory previously allocated. Up to 4 bytes may leaked when querying the line discipline.
The problematic code:
return put_user(tty->ldisc->ops->num, (int __user *)p);
The flaw is triggered when ldisc's address is loaded before the new address is set and the access is performed after the old is freed, which results to crash due to the kernel accessing an invalid address. If an attacker prepares the kernel slab by setting up the ldisc struct at the correct offset they can effectively read 4 bytes from any kernel memory.
Invalid data at the ldisc address may also panic the machine if it is not pointing to valid mappable memory.
Original proposed fix:
Created attachment 1112221 [details]
This issue was discovered by Milos Vyletel of Red Hat.
Created kernel tracking bugs for this issue:
Affects: fedora-all [bug 1300224]
This issue went public via this correspondence:
kernel-4.3.4-300.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
kernel-4.3.4-200.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
This issue affects kernels in Red Hat Enterprise Linux 5, 6 and 7. This has been rated as having Moderate security impact and is not currently
planned to be addressed in future updates. For additional information, refer
to the Red Hat Enterprise Linux Life Cycle: