Summary
Adverserial use of make_bitflags! macro can cause undefined behavior
The macro relied on an expression of the form Enum::Variant always being a
variant of the enum. However, it may also be an associated integer constant, in
which case there's no guarantee that the value of said constant consists only of
bits valid for this bitflag type.
Thus, code like this could create an invalid BitFlags<Test>, which would cause
iterating over it to trigger undefined behavior. As the debug formatter
internally iterates over the value, it is also affected.
use enumflags2::{bitflags, make_bitflags};
#[bitflags]
#[repr(u8)]
#[derive(Copy, Clone, Debug)]
enum Test {
A = 1,
B = 2,
}
impl Test {
const C: u8 = 69;
}
fn main() {
let x = make_bitflags!(Test::{C});
// printing or iterating over x is UB
}
Impact
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is GHSA-QVC4-78GW-PV8P? GHSA-QVC4-78GW-PV8P is a medium-severity security vulnerability in enumflags2 (rust), affecting versions >= 0.7.0, < 0.7.7. It is fixed in 0.7.7.
- Which versions of enumflags2 are affected by GHSA-QVC4-78GW-PV8P? enumflags2 (rust) versions >= 0.7.0, < 0.7.7 is affected.
- Is there a fix for GHSA-QVC4-78GW-PV8P? Yes. GHSA-QVC4-78GW-PV8P is fixed in 0.7.7. Upgrade to this version or later.
- Is GHSA-QVC4-78GW-PV8P exploitable, and should I be worried? Whether GHSA-QVC4-78GW-PV8P is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-QVC4-78GW-PV8P is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-QVC4-78GW-PV8P? Upgrade
enumflags2to 0.7.7 or later.