Email me

Rust advisories / spl-token-swap

Unsound MediumRUSTSEC-2024-0426 · spl-token-swap

RUSTSEC-2024-0426: Unsound usages of `u8` type casting

Short answerspl-token-swap has an API that can cause undefined behaviour from safe code: Unsound usages of `u8` type casting. No fixed version yet.

Cratespl-token-swap
TypeUnsound
Affected versionsEvery version.
Fixed innone
SeverityMedium (GitHub rating)
Published2024-12-19
Last changed2025-10-28
Also known asGHSA-h6xm-c6r4-vmwf
Affected functionsspl_token_swap::instruction::unpack

What to do

  1. Find who pulls it in: cargo tree -i spl-token-swap.
  2. Avoid the affected API (spl_token_swap::instruction::unpack), or replace the crate.

Details from the advisory

The library provides a safe public API unpack to cast u8 array to arbitrary types, which can cause to undefined behaviors. The length check of array can only prevent out-of-bound access on the return type. However, it can't prevent misaligned pointer when casting u8 pointer to a type aligned to larger bytes. For example, if we assign u16 to T, **misaligned raw pointer dereference** could happen and cause to panic. Even if we pass the type aligned to same byte as u8 (e.g., bool), it could construct a illegal type since bool can only have 0 or 1 as bit patterns, which is also an undefined behavior. The further exploits of the bug here are still not clear, so we would report this issue as unsound.

The details of PoC to reproduce undefined behavior are provided in the issue.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Up next

Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ