# CVE-2023-53645: bpf: Make bpf\_refcount\_acquire fallible for non-owning refs

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.22% (percentile 8, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2025-10-07T15:19:43.738Z
- **Modified:** 2026-08-05T09:15:20.081Z

## Who should check

- Anyone running Linux \>= d2dcc67df910dd85253a701b6a5b747f955d28f5, \< d906d1b940b9dbf0a3e821d6b32a51c369273d91; \>= d2dcc67df910dd85253a701b6a5b747f955d28f5, \< 7793fc3babe9fea908e57f7c187ea819f9fd7e95
- Anyone running Linux 6.4

## Description

In the Linux kernel, the following vulnerability has been resolved:

bpf: Make bpf\_refcount\_acquire fallible for non-owning refs

This patch fixes an incorrect assumption made in the original
bpf\_refcount series \[0\], specifically that the BPF program calling
bpf\_refcount\_acquire on some node can always guarantee that the node is
alive. In that series, the patch adding failure behavior to rbtree\_add
and list\_push\_{front, back} breaks this assumption for non-owning
references.

Consider the following program:

  n = bpf\_kptr\_xchg(&mapval, NULL);
  /\* skip error checking \*/

  bpf\_spin\_lock(&l);
  if(bpf\_rbtree\_add(&t, &n-\>rb, less)) {
    bpf\_refcount\_acquire(n);
    /\* Failed to add, do something else with the node \*/
  }
  bpf\_spin\_unlock(&l);

It's incorrect to assume that bpf\_refcount\_acquire will always succeed in this
scenario. bpf\_refcount\_acquire is being called in a critical section
here, but the lock being held is associated with rbtree t, which isn't
necessarily the lock associated with the tree that the node is already
in. So after bpf\_rbtree\_add fails to add the node and calls bpf\_obj\_drop
in it, the program has no ownership of the node's lifetime. Therefore
the node's refcount can be decr'd to 0 at any time after the failing
rbtree\_add. If this happens before the refcount\_acquire above, the node
might be free'd, and regardless refcount\_acquire will be incrementing a
0 refcount.

Later patches in the series exercise this scenario, resulting in the
expected complaint from the kernel (without this patch's changes):

  refcount\_t: addition on 0; use-after-free.
  WARNING: CPU: 1 PID: 207 at lib/refcount.c:25 refcount\_warn\_saturate+0xbc/0x110
  Modules linked in: bpf\_testmod(O)
  CPU: 1 PID: 207 Comm: test\_progs Tainted: G           O       6.3.0-rc7-02231-g723de1a718a2-dirty \#371
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
  RIP: 0010:refcount\_warn\_saturate+0xbc/0x110
  Code: 6f 64 f6 02 01 e8 84 a3 5c ff 0f 0b eb 9d 80 3d 5e 64 f6 02 00 75 94 48 c7 c7 e0 13 d2 82 c6 05 4e 64 f6 02 01 e8 64 a3 5c ff \<0f\> 0b e9 7a ff ff ff 80 3d 38 64 f6 02 00 0f 85 6d ff ff ff 48 c7
  RSP: 0018:ffff88810b9179b0 EFLAGS: 00010082
  RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000
  RDX: 0000000000000202 RSI: 0000000000000008 RDI: ffffffff857c3680
  RBP: ffff88810027d3c0 R08: ffffffff8125f2a4 R09: ffff88810b9176e7
  R10: ffffed1021722edc R11: 746e756f63666572 R12: ffff88810027d388
  R13: ffff88810027d3c0 R14: ffffc900005fe030 R15: ffffc900005fe048
  FS:  00007fee0584a700(0000) GS:ffff88811b280000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00005634a96f6c58 CR3: 0000000108ce9002 CR4: 0000000000770ee0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  PKRU: 55555554
  Call Trace:
   \<TASK\>
   bpf\_refcount\_acquire\_impl+0xb5/0xc0

  (rest of output snipped)

The patch addresses this by changing bpf\_refcount\_acquire\_impl to use
refcount\_inc\_not\_zero instead of refcount\_inc and marking
bpf\_refcount\_acquire KF\_RET\_NULL.

For owning references, though, we know the above scenario is not possible
and thus that bpf\_refcount\_acquire will always succeed. Some verifier
bookkeeping is added to track "is input owning ref?" for bpf\_refcount\_acquire
calls and return false from is\_kfunc\_ret\_null for bpf\_refcount\_acquire on
owning refs despite it being marked KF\_RET\_NULL.

Existing selftests using bpf\_refcount\_acquire are modified where
necessary to NULL-check its return value.

  \[0\]: https://lore.kernel.org/bpf/20230415201811.343116-1-davemarchevsky@fb.com/

## Affected and fixed versions

- Linux: \>= d2dcc67df910dd85253a701b6a5b747f955d28f5, \< d906d1b940b9dbf0a3e821d6b32a51c369273d91; \>= d2dcc67df910dd85253a701b6a5b747f955d28f5, \< 7793fc3babe9fea908e57f7c187ea819f9fd7e95 (cvelist)
- Linux: 6.4 (cvelist)

## Mitigation

- Upgrade Linux to 7793fc3babe9fea908e57f7c187ea819f9fd7e95 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-53645. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-53645.md
Affected: Linux >= d2dcc67df910dd85253a701b6a5b747f955d28f5, < d906d1b940b9dbf0a3e821d6b32a51c369273d91; >= d2dcc67df910dd85253a701b6a5b747f955d28f5, < 7793fc3babe9fea908e57f7c187ea819f9fd7e95; Linux 6.4
Fixed in: Linux 7793fc3babe9fea908e57f7c187ea819f9fd7e95

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-53645 being exploited?

There is no confirmed exploitation: CVE-2023-53645 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.22% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-53645?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2023-53645?

Linux \>= d2dcc67df910dd85253a701b6a5b747f955d28f5, \< d906d1b940b9dbf0a3e821d6b32a51c369273d91; \>= d2dcc67df910dd85253a701b6a5b747f955d28f5, \< 7793fc3babe9fea908e57f7c187ea819f9fd7e95; Linux 6.4.

### Is there a fix for CVE-2023-53645?

Yes. Fixed in Linux 7793fc3babe9fea908e57f7c187ea819f9fd7e95. Upgrade Linux to 7793fc3babe9fea908e57f7c187ea819f9fd7e95 or later.

### How do I check if I'm affected by CVE-2023-53645?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/d906d1b940b9dbf0a3e821d6b32a51c369273d91>
- patch: <https://git.kernel.org/stable/c/7793fc3babe9fea908e57f7c187ea819f9fd7e95>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-53645>

HTML: <https://flawdb.com/CVE-2023-53645> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-53645>
