Skip to content

Add advisory for unbounded-spsc: Sender::send transmute UAF under tx/rx race#2884

Closed
berkant-koc wants to merge 1 commit into
rustsec:mainfrom
berkant-koc:berkoc/unbounded-spsc-transmute-uaf-2026-05-14
Closed

Add advisory for unbounded-spsc: Sender::send transmute UAF under tx/rx race#2884
berkant-koc wants to merge 1 commit into
rustsec:mainfrom
berkant-koc:berkoc/unbounded-spsc-transmute-uaf-2026-05-14

Conversation

@berkant-koc
Copy link
Copy Markdown
Contributor

Resubmission of the unbounded-spsc half of #2882, split per @djc's review and trimmed.

Sender::send (single-file crate, src/lib.rs:379-405 in 0.2.0 / commit 23a9ce7) transmutes *mut Producer<T> (a pointer, 8 bytes on 64-bit) into the bytes of a value-level Consumer<T>. The resulting Consumer::buffer.ptr is the address of a field on the Sender, not the real ArcInner<Buffer<T>>. consumer.try_pop() then reads Buffer<T> offsets that lie inside the Sender<T> frame (OOB), and Drop for the fake Arc calls dealloc on a non-allocated address.

Branch is only reachable single-threaded if the receiver-drop / connected = false guard is bypassed; the trigger is a TOCTOU race between Sender::send's connected.load() and Receiver::drop's compare_exchange(_, DISCONNECTED, ...). The author's own test suite carries a TODO at src/lib.rs:975 referencing the same assert that fires in the buggy path — the symptom was observed but misclassified.

The companion oneringbuf advisory is filed separately as a sibling PR.

Closes prior #2882 (superseded by this + the oneringbuf PR).

…rx race

The DISCONNECTED arm of Sender::send transmutes *mut Producer<T> as
a value-level Consumer<T>, yielding OOB read inside the Sender frame
and a fake-Arc drop on a non-allocated address. Reachable via TOCTOU
race between Receiver::drop and Sender::send.
@djc
Copy link
Copy Markdown
Member

djc commented May 14, 2026

Do you have approval from the maintainer to publish this?

@berkant-koc
Copy link
Copy Markdown
Contributor Author

Same — closing per your point on #2883. The private channel here bounced (spearman@gitlab.com is a dead address), so I opened spearman/unbounded-spsc#4 asking the maintainer to enable private vulnerability reporting or supply an alternate contact. Will reopen this advisory PR once the maintainer has engaged, or after a 30-day attempt window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants