CVE-2022-41720: On Windows, restricted files can be accessed via os.DirFS and http.Dir.
High CVSS 7.5
- CVE id
- CVE-2022-41720
- Published
- Last modified
Affected packages
| Package | Affected versions | Fixed in |
|---|---|---|
| Go Runtimes and servers |
< 1.18.9 >= 1.19.0, < 1.19.4 |
1.18.9, 1.19.4 |
How to fix it
Upgrade Go to the fixed release of the line you run: 1.18.9, 1.19.4.
go version
- Build with the patched Go release (set "toolchain" in go.mod, or the golang image tag) and redeploy: Go programs include the standard library, so they must be rebuilt.
A free AIssue account reads the runtime versions your repositories pin (version files, Dockerfiles, build files) and tells you when one is affected.
Details
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.
References
- CVE-2022-41720 on the NVD
- Advisory: https://nvd.nist.gov/vuln/detail/CVE-2022-41720
- Web: https://go.dev/cl/455716
- Web: https://go.dev/issue/56694
- Web: https://groups.google.com/g/golang-announce/c/L_3rmdT0BMU/m/yZDrXjIiBQAJ
- Web: https://pkg.go.dev/vuln/GO-2022-1143
- Web: https://go.dev/cl/455716
- Web: https://go.dev/issue/56694
- Web: https://groups.google.com/g/golang-announce/c/L_3rmdT0BMU/m/yZDrXjIiBQAJ
- Web: https://pkg.go.dev/vuln/GO-2022-1143
Am I affected?
Upload or paste your lockfile. We check every package version in it against OSV.dev, this advisory included, and email you the vulnerable ones with the version that fixes them. Free, and no account needed.
About this data
Source: National Vulnerability Database (NVD) (public domain). Severity comes from the advisory's own rating when it has one, else from its CVSS score.