Intel

AIKIDO-2026-381234

zerocopy-derive is vulnerable to Incorrect Type Conversion

Incorrect Type Conversion Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published 2 days ago

55

Medium Risk

This Affects:

RUSTzerocopy-derive
0.8.0 - 0.8.57
Fixed in 0.8.58
Are you affected? Scan for Free

TL;DR

The zerocopy-derive macros parse #[repr(...)] attributes and field invariants to decide whether a type's FromBytes, FromZeros, and related trait implementations are sound. A representation attribute written with a raw identifier, such as #[r#repr(...)], fails that comparison, so the macros record the wrong layout and emit an unsafe trait implementation. Downstream code can then build or read a value from a byte buffer that does not match the type's real layout or validity rules, which is undefined behavior when that value is used. The fix matches raw identifiers and ordinary spellings as the same name before those representation checks.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you derive FromBytes, IntoBytes, TryFromBytes, or KnownLayout on a type whose #[repr(...)] attribute uses a raw identifier.

Background info

zerocopy-derive is vulnerable to Incorrect Type Conversion in versions 0.8.0 - 0.8.57.

How to fix this

Upgrade the zerocopy-derive library to the patch version.

Are You Affected?

Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.

Free. No credit card required.

Aikido Platform