GHSA-h6xm-c6r4-vmwf: Spl token swap Unsound Usages Of `u8` Type Vulnerability
MODERATEGHSA-h6xm-c6r4-vmwf is a MODERATE unsound usages of `u8` type vulnerability (General Security Weakness) affecting Spl token swap libraries in the crates.io ecosystem. The issue involves unsound usages of `u8` type casting in spl-token-swap. Remediation is available in the latest vendor maintenance releases.
GHSA-h6xm-c6r4-vmwf at a Glance
How to Fix GHSA-h6xm-c6r4-vmwf
To remediate this vulnerability, upgrade all affected Spl token swap dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade spl-token-swap to Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for spl-token-swap
How to Check if You Are Affected
To determine whether your application is affected by GHSA-h6xm-c6r4-vmwf, inspect your project dependencies for Spl token swap:
inspect dependencies for spl-token-swap
Analyze the terminal output to locate any version of Spl token swap in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under General Security Weakness. In Spl token swap, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-h6xm-c6r4-vmwf Affected Spl token swap Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
spl-token-swap
|
crates.io |
≤ 3.0.0
|
|
References
Frequently Asked Questions
What is GHSA-h6xm-c6r4-vmwf?
Which Spl token swap versions are affected?
What version fixes GHSA-h6xm-c6r4-vmwf?
Is spl-token-swap affected?
What CWE is associated with GHSA-h6xm-c6r4-vmwf?
How can I check crates.io dependencies for GHSA-h6xm-c6r4-vmwf?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-h6xm-c6r4-vmwf",
"modified" : "2024-12-23T19:29:44Z",
"published" : "2024-12-23T19:29:44Z",
"aliases" : [ ],
"summary" : "Unsound usages of `u8` type casting in spl-token-swap",
"details" : "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. \n\nThe details of PoC to reproduce undefined behavior are provided in the [issue](https://github.com/solana-labs/solana-program-library/issues/5243). \n",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "spl-token-swap"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "3.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/solana-labs/solana-program-library/issues/5243"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/solana-labs/solana-program-library"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2024-0426.html"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-23T19:29:44Z",
"nvd_published_at" : null
}
}