# GHSA-2wq5-g96f-mv3v: Segmentation fault due to use of uninitialized memory

> An attacker can cause a segmentation fault and denial of service by providing a crafted zip file to the ouch library.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 22 Sep 2024
- **Also known as:** RUSTSEC-2024-0374

## What is GHSA-2wq5-g96f-mv3v?

GHSA-2wq5-g96f-mv3v is a memory corruption vulnerability in ouch, published on 22 Sep 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

When trying to decompress a file using "ouch", we can reach the function "ouch::archive::zip::convert_zip_date_time".
In the function, there is a unsafe function, "transmute". Once the "transmute" function is called to convert the type of "month" object,
the address of the object is changed to the uninitialized memory region. 
After that, when other function tries to dereference "month", segmentation fault occurs.

## Which versions are affected by GHSA-2wq5-g96f-mv3v?

3 open source packages ship an affected version, including ouch.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `ouch` | crates.io | All versions | 0.3.1 |
| `ouch` | crates.io | All versions | 0.3.1 |
| `ouch` | crates.io | From 0.0.0-0 | 0.3.2-0 |

## How do I fix GHSA-2wq5-g96f-mv3v?

Upgrade ouch to a fixed version for your release line: 0.3.1 or 0.3.2-0.

## Is GHSA-2wq5-g96f-mv3v being exploited?

There is no known exploitation of GHSA-2wq5-g96f-mv3v in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-2wq5-g96f-mv3v and fix it if it is affected.

What it is: GHSA-2wq5-g96f-mv3v is a memory corruption vulnerability in ouch, published on 22 Sep 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-2wq5-g96f-mv3v in the wild and no public exploit code.

Affected packages and fixed versions:
- ouch (crates.io): affected all versions; fixed in 0.3.1
- ouch (crates.io): affected all versions; fixed in 0.3.1
- ouch (crates.io): affected from 0.0.0-0; fixed in 0.3.2-0

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/GHSA-2wq5-g96f-mv3v/ (Markdown: https://insights.sbomify.com/GHSA-2wq5-g96f-mv3v/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-2wq5-g96f-mv3v

---
From sbomify Insights: https://insights.sbomify.com/GHSA-2wq5-g96f-mv3v/
Summaries are generated and may contain mistakes; the official description above is the record.
