lru is vulnerable to Use-After-Free
59
Medium Risk
The pop method on LruCache frees a cache node's heap allocation and runs the stored key's destructor before detaching the node from the internal doubly linked list. When a key type has a Drop implementation that panics, unwinding skips the detach step, so the neighboring list nodes keep raw pointers into the freed allocation. Later cache operations then dereference those dangling pointers, producing a use-after-free that is reachable from safe Rust. The fix detaches the node from the list before dropping the key so the list stays consistent even if the destructor panics.
You are affected if you are using a version that falls within the vulnerable range and you store keys whose Drop implementation can panic and keep using the cache after catching the unwind.
lru is vulnerable to Use-After-Free in versions 0.6.4 - 0.18.1.
Upgrade the lru library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant