# CVE-2022-30636: Limited directory traversal vulnerability on Windows in golang.org/x/crypto

> An attacker can read arbitrary files on Windows systems if they end with the specific suffix +http-01 due to path traversal in the ACME autocert cache.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 2 Jul 2024
- **Updated:** 7 Aug 2024
- **Also known as:** CLEANSTART-2026-GE07592, CLEANSTART-2026-QN19137, DEBIAN-CVE-2022-30636, GO-2024-2961, MINI-hm94-v333-g5qh

## What is CVE-2022-30636?

CVE-2022-30636 is a high-severity path traversal vulnerability in golang.org/x/crypto/acme/autocert, published on 2 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

httpTokenCacheKey uses path.Base to extract the expected HTTP-01 token value to lookup in the DirCache implementation. On Windows, path.Base acts differently to filepath.Base, since Windows uses a different path separator (\ vs. /), allowing a user to provide a relative path, i.e. .well-known/acme-challenge/..\..\asd becomes ..\..\asd. The extracted path is then suffixed with +http-01, joined with the cache directory, and opened. Since the controlled path is suffixed with +http-01 before opening, the impact of this is significantly limited, since it only allows reading arbitrary files on the system if and only if they have this suffix.

## Which versions are affected by CVE-2022-30636?

1 open source package ship an affected version, including golang.org/x/crypto.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `golang.org/x/crypto` | Go | All versions | 0.0.0-20220525230936-793ad666bf5e |

## How do I fix CVE-2022-30636?

Upgrade golang.org/x/crypto to 0.0.0-20220525230936-793ad666bf5e or later.

## Is CVE-2022-30636 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-30636 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-30636 and fix it if it is affected.

What it is: CVE-2022-30636 is a high-severity path traversal vulnerability in golang.org/x/crypto/acme/autocert, published on 2 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-30636 exists.

Affected packages and fixed versions:
- golang.org/x/crypto (Go): affected all versions; fixed in 0.0.0-20220525230936-793ad666bf5e

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-2022-30636/ (Markdown: https://insights.sbomify.com/CVE-2022-30636/index.md)
```

## Sources

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

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