CVE-2022-41720Golang Go
High 7.5 No auth needed
Follow: this CVE · Golang · Golang Go We alert you by email or Slack (account required).
- Priority
- 60
- CVSS 3.1
- 7.5
- EPSS
- 1.3% probability of exploitation in 30 days · percentile 70
- Auth required
- No
- Published
- Dec 7, 2022
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-22
- SSVC (CISA)
- Exploitation: none · Automatable: yes · Technical impact: partial
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
What happens
On Windows, restricted files can be accessed via os.DirFS and http.Dir. The os.DirFS function and http.Dir type provide access to a tree of files rooted at a given directory. These functions permit access to Windows device files under that root. For example, os.DirFS("C:/tmp").Open("COM1") opens the COM1 device. Both os.DirFS and http.Dir only provide read-only filesystem access. In addition, on Windows, an os.DirFS for the directory (the root of the current drive) can permit a maliciously crafted path to escape from the drive and access any path on the system. With fix applied, the behavior of os.DirFS("") has changed. Previously, an empty root was treated equivalently to "/", so os.DirFS("").Open("tmp") would open the path "/tmp". This now returns an error.
What to do
- Apply the vendor's security update for Go.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| Go | stdlib |
< 1.18.9 |
1.18.9 |
go get stdlib@v1.18.9 |
| Go | stdlib |
≥ 1.19.0-0 < 1.19.4 |
1.19.4 |
go get stdlib@v1.19.4 |
Per OSV / GitHub Advisories (GO-2022-1143). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| golang | go | < 1.18.9 |
| golang | go | ≥ 1.19.0 < 1.19.4 |
Official sources
References
Links published by the sources. Open them with care.
- go.dev Patch Vendor Advisory
- go.dev Issue Tracking Vendor Advisory
- groups.google.com Patch Release Notes Third Party Advisory
- pkg.go.dev Patch Vendor Advisory