Segmentation fault in Rust time crate
Description
In Rust time crate from version 0.2.7 and before version 0.2.23, unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires the user to set any environment variable in a different thread than the affected functions. The affected functions are time::UtcOffset::local_offset_at, time::UtcOffset::try_local_offset_at, time::UtcOffset::current_local_offset, time::UtcOffset::try_current_local_offset, time::OffsetDateTime::now_local and time::OffsetDateTime::try_now_local. Non-Unix targets are unaffected. This includes Windows and wasm. The issue was introduced in version 0.2.7 and fixed in version 0.2.23.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A dangling pointer in Rust's time crate (0.2.7–0.2.22) causes segfaults on Unix when an environment variable is set in another thread.
Vulnerability
The Rust time crate versions 0.2.7 through 0.2.22 contain a memory safety bug that can lead to a segfault on Unix-like operating systems. The issue arises from dereferencing a dangling pointer when the affected functions — time::UtcOffset::local_offset_at, time::UtcOffset::try_local_offset_at, time::UtcOffset::current_local_offset, time::UtcOffset::try_current_local_offset, time::OffsetDateTime::now_local, and time::OffsetDateTime::try_now_local — are called. Internally, these functions access environment variables, and if an environment variable is set by a different thread concurrently, the internal pointer may become invalid [1][2].
Exploitation
Exploitation requires the attacker or a third-party library to set any environment variable in a thread separate from the one calling an affected function. No special privileges or user interaction are needed beyond the presence of multi-threaded execution. The attack vector is local, meaning the attacker must already have code execution capability within the process [2][3]. Non-Unix targets, including Windows and WebAssembly, are unaffected because they do not implement the same internal mechanism [3].
Impact
Successful exploitation results in a segfault, causing a denial of service (availability impact). There is no confidentiality or integrity impact. The CVSS v3.1 score is 6.2 (Medium) with vector AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H [2].
Mitigation
The vulnerability is fixed in time version 0.2.23 and later. Users of time 0.1 must upgrade to 0.2.23 or the 0.3 series, as no patch exists for 0.1. The recommended action is to run cargo update to pull in the patched version. A workaround is to ensure that only one thread runs when calling the affected functions and that no other thread modifies environment variables concurrently [3].
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
timecrates.io | >= 0.1.0, < 0.2.23 | 0.2.23 |
timecrates.io | >= 0.2.7, < 0.2.23 | 0.2.23 |
Affected products
14- osv-coords13 versionspkg:apk/chainguard/bergpkg:apk/chainguard/pulumi-watchpkg:apk/chainguard/zellijpkg:apk/chainguard/zellij-bash-completionpkg:apk/chainguard/zellij-fish-completionpkg:apk/chainguard/zellij-zsh-completionpkg:apk/wolfi/bergpkg:apk/wolfi/pulumi-watchpkg:apk/wolfi/zellijpkg:apk/wolfi/zellij-bash-completionpkg:apk/wolfi/zellij-fish-completionpkg:apk/wolfi/zellij-zsh-completionpkg:cargo/time
< 0.4.7-r0+ 12 more
- (no CPE)range: < 0.4.7-r0
- (no CPE)range: < 0.1.5-r5
- (no CPE)range: < 0.41.2-r2
- (no CPE)range: < 0.41.2-r2
- (no CPE)range: < 0.41.2-r2
- (no CPE)range: < 0.41.2-r2
- (no CPE)range: < 0.4.7-r0
- (no CPE)range: < 0.1.5-r5
- (no CPE)range: < 0.41.2-r2
- (no CPE)range: < 0.41.2-r2
- (no CPE)range: < 0.41.2-r2
- (no CPE)range: < 0.41.2-r2
- (no CPE)range: >= 0.1.0, < 0.2.23
- time-rs/timev5Range: >= 0.2.7, <0.2.23
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
6- github.com/advisories/GHSA-wcg3-cvx6-7396ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2020-26235ghsaADVISORY
- crates.io/crates/time/0.2.23ghsax_refsource_MISCWEB
- github.com/time-rs/time/issues/293ghsax_refsource_MISCWEB
- github.com/time-rs/time/security/advisories/GHSA-wcg3-cvx6-7396ghsax_refsource_CONFIRMWEB
- rustsec.org/advisories/RUSTSEC-2020-0071.htmlghsaWEB
News mentions
0No linked articles in our index yet.