# CVE-2020-26235: Segmentation fault in Rust time crate

> A dangling pointer dereference in the Rust time crate causes segmentation faults on Unix systems when environment variables are modified concurrently.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 24 Nov 2020
- **Updated:** 4 Aug 2024
- **Also known as:** GHSA-wcg3-cvx6-7396, RUSTSEC-2020-0071, RUSTSEC-2020-0159, UBUNTU-CVE-2020-26235, openSUSE-SU-2024:12746-1

## What is CVE-2020-26235?

CVE-2020-26235 is a medium-severity vulnerability in time-rs time, published on 24 Nov 2020. Any signed-in user can exploit it over the network, with no action from the victim.

### Official 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.

Weakness: CWE-476 (NULL Pointer Dereference)

## Which versions are affected by CVE-2020-26235?

6 open source packages ship an affected version, including time and chrono. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `time` | crates.io | From 0.0.0-0 | 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.23 |
| `time` | crates.io | From 0.1.0 | 0.2.23 |
| `time` | crates.io | From 0.1.0 | 0.2.23 |
| `time` | crates.io | From 0.2.7 | 0.2.23 |
| `time` | crates.io | From 0.2.7 | 0.2.23 |
| `chrono` | crates.io | From 0.0.0-0 | 0.4.20 |

Products: Time Project Time.

## How do I fix CVE-2020-26235?

Upgrade time to a fixed version for your release line: 0.2.0, 0.2.1, 0.2.2 or 0.2.3.

## Is CVE-2020-26235 being exploited?

There is no known exploitation of CVE-2020-26235 in the wild and no public exploit code.

## Other vulnerabilities in time-rs time

- [CVE-2026-25727](https://insights.sbomify.com/CVE-2026-25727/): time affected by a stack exhaustion denial of service attack (medium 6.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-26235 and fix it if it is affected.

What it is: CVE-2020-26235 is a medium-severity vulnerability in time-rs time, published on 24 Nov 2020. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2020-26235 in the wild and no public exploit code.

Affected packages and fixed versions:
- time (crates.io): affected from 0.0.0-0; fixed in 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.23
- time (crates.io): affected from 0.1.0; fixed in 0.2.23
- time (crates.io): affected from 0.1.0; fixed in 0.2.23
- time (crates.io): affected from 0.2.7; fixed in 0.2.23
- time (crates.io): affected from 0.2.7; fixed in 0.2.23
- chrono (crates.io): affected from 0.0.0-0; fixed in 0.4.20

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2020-26235/ (Markdown: https://insights.sbomify.com/CVE-2020-26235/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2020-26235
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2020-26235
- OSV: https://osv.dev/vulnerability/CVE-2020-26235

---
From sbomify Insights: https://insights.sbomify.com/CVE-2020-26235/
Summaries are generated and may contain mistakes; the official description above is the record.
