rand is vulnerable to Deserialization of Untrusted Data
37
CVE Score
Low
Deserialization of Untrusted Data
The UniformChar distribution in rand stores an inner UniformInt<u32> sampler and, when the serde feature is enabled, derives Deserialize for it. Deserializing a UniformChar from untrusted input bypasses the validating constructors, so the sampler can carry a range whose output exceeds the valid Unicode scalar range. Sampling such a distribution then reaches an unchecked char conversion that produces an invalid char, causing undefined behavior and a memory safety violation. The fix validates the sampler range during deserialization and rejects samplers whose maximum output exceeds the valid char range.
Upgrade the rand library to the patch version.
You are affected if you are using a version that falls within the vulnerable range and you deserialize a UniformChar distribution from untrusted input with the serde feature enabled.
0.8.0 - 0.10.1
Fixed in 0.10.2rand is vulnerable to Deserialization of Untrusted Data in versions 0.8.0 - 0.10.1.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.