CVE-2022-0010: enum-map Macro Uninitialized Type Arbitrary Code Execution

enum-map Updated 02 Oct 2025

Summary

17/02/2022
N/A
Yes i
Unrated
Not published

RUSTSEC-2022-0010: enum_map macro can cause UB when Enum trait is incorrectly implemented. Affects enum-map versions >= 2.0.0-2, < 2.0.2. Fixed in 2.0.2. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The enum-map crate is a library for creating and manipulating maps with enum keys in Rust. It provides a macro called enum_map! that allows users to create enum maps easily. Enum maps are arrays where each index corresponds to a variant of the enum, and the value at that index is associated with that variant. This vulnerability affects versions of the enum-map crate prior to 2.0.2.

Vulnerability Detail

The vulnerability arises from a lack of proper length checking in the enum_map! macro. When the LENGTH property in the Enum trait does not match the array length in the EnumArray trait, the enum map can be initialized with uninitialized types. This can lead to arbitrary code execution if an attacker can control the uninitialized types. The vulnerability only affects manual implementations of the Enum trait and not enums that use the #[derive(Enum)] attribute.

How To Fix

Latest published version: 3.1.0 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.0.2

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. Updating to the fixed version of the enum-map crate is the recommended solution.

Conclusion

The enum-map crate prior to version 2.0.2 is vulnerable to arbitrary code execution due to uninitialized types in the enum map. Users should update to version 2.0.2 or later to fix this vulnerability. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for enum-map →

Share this vulnerability

FAQ

Versions prior to 2.0.2 are affected.

Yes, if an attacker can control the uninitialized types in the enum map.

No, this vulnerability only affects manual implementations of the Enum trait.

No, updating to the fixed version of the enum-map crate is the recommended solution.

The vulnerability was fixed in version 2.0.2 of the enum-map crate by adding proper length checking in the enum_map! macro.

Related vulnerabilities

Recent vulnerabilities recorded for enum-map.

How To Fix

Latest published version: 3.1.0 as of 23 Oct 2026

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.0.2

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback