Skip to content

Back to the catalog

sgkdev/bad_garbage
github.comrepo

sgkdev/bad_garbage

GitHub repo (sgkdev/bad_garbage) containing a proof-of-concept exploit for CVE-2026-53361, an unprivileged, container-escapable use-after-free in the Linux AF_UNIX socket garbage collector. The bug stems from a race where a concurrent MSG_PEEK on an in-flight socket slips past the gc_in_progress check, letting the GC free a still-referenced socket; the same underlying race has been patched three separate times (CVE-2021-0920, CVE-2026-23394, CVE-2026-53361). The PoC targets systems with 2–7 CPUs and notes that most SLUB cache-armoring/shadowing code was stripped out, leaving occasional collisions in kmalloc-64/anon_vma caches that a user would need to re-armor for near-100% reliability.

TL;DR PoC exploit for CVE-2026-53361, a container-escapable use-after-free in Linux's AF_UNIX GC triggered via an MSG_PEEK race.
Document

What it is

This PoC repo is the single-vector variant of the CVE-2026-53361 exploit — using MSG_PEEK alone, rather than any multi-vector approach — to trigger the AF_UNIX garbage collector use-after-free.

How it works

An in-flight AF_UNIX socket (one holding an unreachable reference cycle) is targeted with a concurrent MSG_PEEK. The peek takes a reference on the socket that the GC's census doesn't count. The peek is meant to back off while a collection is running, by checking a gc_in_progress flag, but that flag can read false mid-run, letting the peek slip through. The GC then frees the socket while the peek's reference keeps it alive, leaving a dangling sk_buff.

Preconditions / Affected

  • "Vulnerable" (affected by the underlying bug) is broader than "targeted" (covered by this specific exploit): this PoC only targets the single MSG_PEEK vector.
  • Built for systems with 2–7 CPUs; the page states this is a deliberate design choice — the clean order-N strategy that would generalize to 8+ CPUs was deliberately left out, not worth exposing for what's characterized as a "-1 day bug."
  • 7.x kernels and the Ubuntu 6.8 GA kernel are described as vulnerable but explicitly out of scope for this PoC.

What to do

No patch or defensive action is given on the page itself (the fix landed upstream as commit d82ba05263c6, "af_unix: Set gc_in_progress to true in unix_gc()"). For reliability, the page says most SLUB cache-armoring/shadowing code was stripped from the PoC, and a user wanting near-100% reliability would need to add their own armoring — the SID-leak phase can otherwise collide with spurious low-order kmalloc() allocations or per-cache PCP reuse, specifically in anon_vma, kmalloc-64, and similar lower/dedicated caches. Higher buckets are stated to be safe.

Caveats

This is explicitly the single-vector (MSG_PEEK-only) version — the page implies without detail that other vectors exist but are out of scope here. The same race was patched three separate times (CVE-2021-0920, CVE-2026-23394, CVE-2026-53361), indicating prior fixes were incomplete; the page does not say whether this third fix is considered final.

CVEs named here

  • CVE-2026-53361
  • CVE-2021-0920
  • CVE-2026-23394

Technologies named here

Techniques named here

  • AF_UNIX garbage collector use-after-free via MSG_PEEK race
  • SID-leak phase / SLUB cache exploitation