linux-stable/net/bluetooth
Ruihan Li 73ddc58522 bluetooth: Perform careful capability checks in hci_sock_ioctl()
commit 25c150ac10 upstream.

Previously, capability was checked using capable(), which verified that the
caller of the ioctl system call had the required capability. In addition,
the result of the check would be stored in the HCI_SOCK_TRUSTED flag,
making it persistent for the socket.

However, malicious programs can abuse this approach by deliberately sharing
an HCI socket with a privileged task. The HCI socket will be marked as
trusted when the privileged task occasionally makes an ioctl call.

This problem can be solved by using sk_capable() to check capability, which
ensures that not only the current task but also the socket opener has the
specified capability, thus reducing the risk of privilege escalation
through the previously identified vulnerability.

Cc: stable@vger.kernel.org
Fixes: f81f5b2db8 ("Bluetooth: Send control open and close messages for HCI raw sockets")
Signed-off-by: Ruihan Li <lrh2000@pku.edu.cn>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-17 11:11:37 +02:00
..
bnep Bluetooth: bnep: fix possible might sleep error in bnep_session 2017-06-27 19:32:11 +02:00
cmtp Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails 2022-01-27 09:00:48 +01:00
hidp Bluetooth: Fix race condition in hidp_session_thread 2023-04-20 12:02:11 +02:00
rfcomm Bluetooth: RFCOMM: don't call kfree_skb() under spin_lock_irqsave() 2023-01-18 09:26:20 +01:00
6lowpan.c Bluetooth: 6LoWPAN: add missing hci_dev_put() in get_l2cap_conn() 2022-12-14 11:26:14 +01:00
a2mp.c Bluetooth: drop HCI device reference before return 2021-03-03 18:22:38 +01:00
a2mp.h
af_bluetooth.c net: use skb_queue_empty_lockless() in poll() handlers 2019-11-10 11:25:34 +01:00
amp.c Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data 2021-03-07 11:27:44 +01:00
amp.h
ecdh_helper.c Bluetooth: Delete error messages for failed memory allocations in two functions 2017-05-22 10:23:41 +02:00
ecdh_helper.h Bluetooth: convert smp and selftest to crypto kpp API 2017-04-25 04:53:42 +02:00
hci_conn.c Bluetooth: Disconnect if E0 is used for Level 4 2020-10-17 10:29:54 +02:00
hci_core.c Bluetooth: hci_sync: cancel cmd_timer if hci_open failed 2023-02-06 07:46:30 +01:00
hci_debugfs.c
hci_debugfs.h
hci_event.c Bluetooth: Fix use after free in hci_send_acl 2022-04-20 09:08:28 +02:00
hci_request.c bluetooth: eliminate the potential race condition when removing the HCI controller 2021-05-22 10:57:24 +02:00
hci_request.h Bluetooth: Fix append max 11 bytes of name to scan rsp data 2016-10-19 18:42:37 +02:00
hci_sock.c bluetooth: Perform careful capability checks in hci_sock_ioctl() 2023-05-17 11:11:37 +02:00
hci_sysfs.c Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times 2022-10-26 13:17:10 +02:00
Kconfig Revert "Bluetooth: Add option for disabling legacy ioctl interfaces" 2017-09-28 13:20:32 -07:00
l2cap_core.c Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp} 2023-04-20 12:02:11 +02:00
l2cap_sock.c Bluetooth: L2CAP: Fix potential user-after-free 2023-03-11 16:26:37 +01:00
leds.c Bluetooth: Add combined LED trigger for controller power 2016-09-19 20:19:34 +02:00
leds.h Bluetooth: Add combined LED trigger for controller power 2016-09-19 20:19:34 +02:00
lib.c Bluetooth: make baswap src const 2017-09-01 22:49:47 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mgmt.c Bluetooth: Fix the HCI to MGMT status conversion table 2021-07-20 16:17:45 +02:00
mgmt_util.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
mgmt_util.h
sco.c Bluetooth: SCO: Fix sco_send_frame returning skb->len 2022-07-29 17:06:52 +02:00
selftest.c Bluetooth: kfree tmp rather than an alias to it 2017-08-11 21:19:46 +02:00
selftest.h
smp.c Bluetooth: SMP: Fail if remote and local public keys are identical 2021-05-26 11:47:01 +02:00
smp.h Bluetooth: SMP: fix crash in unpairing 2018-11-04 14:52:39 +01:00