Skip to content
Info disclosure Write-up Advanced

Use-after-free in CAN BCM subsystem leading to information disclosure (CVE-2023

A use-after-free in the Linux kernel's CAN BCM subsystem allows an unprivileged user to read freed kernel memory via the /proc/net/can-bcm proc entry, leaking encoded freelist pointers and other kernel data. This information disclosure could be used to bypass security mitigations and, when chained with another vulnerability, ease system compromise.

allelesecurity.com

Published on allelesecurity.com

Para acessar esta postagem em português, clique aqui.

The author, on allelesecurity.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, bcm_release() frees the bcm_op objects before removing the proc entry, so bcm_proc_show() can still access those freed objects.

What the attacker needed

Unprivileged user and net namespaces; CAN network interface (e.g., vxcan); ability to read /proc/net/can-bcm entries

The fix

The vulnerability was fixed in the Linux kernel upstream and the fix was backported to Red Hat Enterprise Linux 9.

How it was found

  1. Create unprivileged user and network namespaces to obtain a CAN interface.
  2. Create a CAN BCM socket, connect it, and send a message to create the proc entry and populate the operation lists.
  3. Concurrently read the proc entry and close the socket to trigger the use-after-free.
  4. Observe leaked kernel data, such as encoded freelist pointers, in the proc output.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When a program closes a CAN BCM socket, the kernel frees some internal objects but leaves a proc file readable for a short time. If another thread reads that proc file during this window, it can see data from the freed memory. This is called a use-after-free because the kernel uses memory after it has been freed.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.