CVE-2020-36204: Data races in im crate for Rust
Summary
CVE-2020-36204: TreeFocus lacks bounds on its Send and Sync traits. Affects im versions >= 12.0.0, < 15.1.0. Fixed in 15.1.0. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
The im crate is a library for Rust that provides immutable data structures. It is commonly used for efficient manipulation of collections and trees. The crate offers various data structures such as vectors, hash maps, and trees. These data structures are designed to be immutable, meaning they cannot be modified once created. However, a vulnerability has been discovered in the im crate that can lead to data races.
Vulnerability Detail
The vulnerability in the im crate is due to the lack of bounds on the Send trait or Sync trait for the TreeFocus struct. This means that multiple threads can access and modify the TreeFocus struct simultaneously, leading to data races. Data races occur when two or more threads access shared data concurrently, and at least one of the threads modifies the data. This can result in unpredictable behavior and incorrect program execution. In the case of the im crate, a data race can lead to incorrect manipulation of the tree structure and potentially cause crashes or other unexpected outcomes.
How To Fix
Latest published version: 15.1.0 as of 23 Oct 2026
The newest release already contains this fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If updating the im crate is not feasible or immediate, a possible workaround is to avoid concurrent access to the TreeFocus struct. This can be achieved by synchronizing access to the struct using synchronization primitives such as locks or mutexes. By ensuring that only one thread can access the struct at a time, data races can be prevented. Here is an example of using a mutex to synchronize access to the TreeFocus struct:
use std::sync::Mutex;
fn main() {
let tree_focus = Mutex::new(TreeFocus::new());
// Access and modify the tree_focus struct within a synchronized block
{
let mut guard = tree_focus.lock().unwrap();
// Perform operations on the tree_focus struct
}
}
Conclusion
The im crate for Rust has been found to have a vulnerability that can lead to data races. To mitigate this vulnerability, it is recommended to update the crate to version 15.1.0 or later. If immediate update is not possible, using synchronization primitives like locks or mutexes can provide a temporary workaround. For further assistance and support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for im →
FAQ
The im crate is a library for Rust that provides immutable data structures. It is commonly used for efficient manipulation of collections and trees.
A data race occurs when two or more threads access shared data concurrently, and at least one of the threads modifies the data. This can lead to unpredictable behavior and incorrect program execution.
The data races in the im crate can result in incorrect manipulation of the tree structure and potentially cause crashes or other unexpected outcomes.
To fix the vulnerability, it is recommended to update the im crate to version 15.1.0 or later. This version includes the necessary bounds on the Send trait and Sync trait for the TreeFocus struct, preventing data races from occurring.
If updating the im crate is not feasible or immediate, a possible workaround is to avoid concurrent access to the TreeFocus struct by synchronizing access using locks or mutexes.
References
Related vulnerabilities
Recent vulnerabilities recorded for im.