GHSA-qvc4-78gw-pv8p: Enumflags2 Adverserial Use Of `make_bitflags!` Macro Vulnerability
MODERATEGHSA-qvc4-78gw-pv8p is a MODERATE adverserial use of `make_bitflags!` macro vulnerability (General Security Weakness) affecting Enumflags2 libraries in the crates.io ecosystem. The issue involves adverserial use of `make_bitflags!` macro can cause undefined behavior. Remediation is available by upgrading affected packages to version 0.7.7.
GHSA-qvc4-78gw-pv8p at a Glance
How to Fix GHSA-qvc4-78gw-pv8p
To remediate this vulnerability, upgrade all affected Enumflags2 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 enumflags2 to 0.7.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for enumflags2
How to Check if You Are Affected
To determine whether your application is affected by GHSA-qvc4-78gw-pv8p, inspect your project dependencies for Enumflags2:
inspect dependencies for enumflags2
Analyze the terminal output to locate any version of Enumflags2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.7.7), 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 Enumflags2, 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-qvc4-78gw-pv8p Affected Enumflags2 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
enumflags2
|
crates.io |
≥ 0.7.0
< 0.7.7
|
0.7.7
|
References
Frequently Asked Questions
What is GHSA-qvc4-78gw-pv8p?
Which Enumflags2 versions are affected?
What version fixes GHSA-qvc4-78gw-pv8p?
Is enumflags2 affected?
What CWE is associated with GHSA-qvc4-78gw-pv8p?
How can I check crates.io dependencies for GHSA-qvc4-78gw-pv8p?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qvc4-78gw-pv8p",
"modified" : "2023-04-24T16:47:24Z",
"published" : "2023-04-24T16:47:24Z",
"aliases" : [ ],
"summary" : "Adverserial use of `make_bitflags!` macro can cause undefined behavior",
"details" : "The macro relied on an expression of the form `Enum::Variant` always being a\nvariant of the enum. However, it may also be an associated integer constant, in\nwhich case there's no guarantee that the value of said constant consists only of\nbits valid for this bitflag type.\n\nThus, code like this could create an invalid `BitFlags<Test>`, which would cause\niterating over it to trigger undefined behavior. As the debug formatter\ninternally iterates over the value, it is also affected.\n\n```rust\nuse enumflags2::{bitflags, make_bitflags};\n\n#[bitflags]\n#[repr(u8)]\n#[derive(Copy, Clone, Debug)]\nenum Test {\n A = 1,\n B = 2,\n}\n\nimpl Test {\n const C: u8 = 69;\n}\n\nfn main() {\n let x = make_bitflags!(Test::{C});\n // printing or iterating over x is UB\n}\n```\n",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "enumflags2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.7.0"
}, {
"fixed" : "0.7.7"
} ]
} ]
} ],
"references" : [ {
"type" : "PACKAGE",
"url" : "https://github.com/meithecatte/enumflags2"
}, {
"type" : "WEB",
"url" : "https://github.com/meithecatte/enumflags2/releases/tag/v0.7.7"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2023-0035.html"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-04-24T16:47:24Z",
"nvd_published_at" : null
}
}