linux/net/bluetooth
Ruihan Li 47e6893a5b 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-01 08:26:27 +09:00
..
bnep
cmtp
hidp Bluetooth: Fix race condition in hidp_session_thread 2023-04-20 12:35:06 +02:00
rfcomm
6lowpan.c
a2mp.c
a2mp.h
af_bluetooth.c
amp.c
amp.h
aosp.c
aosp.h
ecdh_helper.c
ecdh_helper.h
eir.c
eir.h
hci_codec.c
hci_codec.h
hci_conn.c Bluetooth: Fix printing errors if LE Connection times out 2023-04-20 12:35:09 +02:00
hci_core.c
hci_debugfs.c
hci_debugfs.h
hci_event.c Bluetooth: Set ISO Data Path on broadcast sink 2023-04-20 12:35:09 +02:00
hci_request.c
hci_request.h
hci_sock.c bluetooth: Perform careful capability checks in hci_sock_ioctl() 2023-05-01 08:26:27 +09:00
hci_sync.c Bluetooth: Fix printing errors if LE Connection times out 2023-04-20 12:35:09 +02:00
hci_sysfs.c
iso.c Bluetooth: ISO: fix timestamped HCI ISO data packet parsing 2023-03-30 12:49:10 +02:00
Kconfig
l2cap_core.c Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp} 2023-04-20 12:35:06 +02:00
l2cap_sock.c
leds.c
leds.h
lib.c
Makefile
mgmt_config.c
mgmt_config.h
mgmt_util.c
mgmt_util.h
mgmt.c Bluetooth: mgmt: Fix MGMT add advmon with RSSI command 2023-03-30 12:49:12 +02:00
msft.c
msft.h
sco.c Bluetooth: SCO: Fix possible circular locking dependency sco_sock_getsockopt 2023-04-20 12:35:09 +02:00
selftest.c
selftest.h
smp.c
smp.h