The vulnerability is a use-after-free in the wasmtime crate, version 43.0.0. The root cause lies in the try_clone implementation for the internal StringPool structure, located in crates/environ/src/string_pool.rs. The vulnerable try_clone function performed a shallow copy of a map containing string keys that were pointers into the original object's string storage.
When a user clones a wasmtime::Linker instance, this vulnerable try_clone method is called internally. If the original Linker instance is then dropped, the memory holding the strings is freed, but the cloned Linker still holds pointers to this freed memory. Any subsequent operation on the cloned Linker that accesses these strings, such as module instantiation, will result in a use-after-free, typically causing a segmentation fault.
The patch, found in commit 82581af77d1c465ce49fb8e6ca042bc274bf3ca2, corrects this by changing the StringPool::try_clone implementation to create a new string allocation for the clone and re-intern all the strings, ensuring the clone has its own valid string storage.
Therefore, the primary vulnerable function is wasmtime::environ::string_pool::StringPool::try_clone, and the user-triggered vulnerable function that would appear in a runtime profile is wasmtime::linker::Linker<T>::clone.