# GHSA-ghc8-5cgm-5rpf: Inventory fails to prohibit standard library access prior to initialization of Rust standard library runtime

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2023-09-10T12:00:00.000Z
- Modified: 2024-02-10T16:26:48.633Z
- Also known as: RUSTSEC-2023-0057

## Description

Affected versions allow arbitrary caller-provided code to execute before the lifetime of `main`.

If the caller-provided code accesses particular pieces of the standard library that require an initialized Rust runtime, such as `std::io` or `std::thread`, these may not behave as documented. Panics are likely; UB is possible.

The flaw was corrected by enforcing that only code written within the `inventory` crate, which is guaranteed not to access runtime-dependent parts of the standard library, runs before `main`. Caller-provided code is restricted to running at compile time.

(As written by GitHub Advisory Database.)

## Affected

- inventory (crates.io): before 0.2.0; from 0.0.0-0 before 0.2.0

## References

- <https://github.com/dtolnay/inventory/pull/43> (web)
- <https://github.com/dtolnay/inventory/commit/b853350a3800e38d2cb9950355b80bc8b8d3959c> (web)
- <https://github.com/dtolnay/inventory> (package)
- <https://rustsec.org/advisories/RUSTSEC-2023-0057.html> (advisory, web)
- <https://crates.io/crates/inventory> (package)

## Sources

- GitHub Advisory Database: [GHSA-ghc8-5cgm-5rpf](https://github.com/advisories/GHSA-ghc8-5cgm-5rpf), CC-BY-4.0, modified 2024-02-10
- RustSec Advisory Database: [RUSTSEC-2023-0057](https://rustsec.org/advisories/RUSTSEC-2023-0057.html), CC0-1.0, modified 2024-02-10

---

Page: https://cve.day/GHSA-ghc8-5cgm-5rpf · Whole record: https://cve.day/GHSA-ghc8-5cgm-5rpf.json · Rebuilt by cve.day 2026-11-25T22:56:43.154Z
