Path Traversal in Golang Go
CVE-2022-41720
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.
Vulnerability class: Path Traversal (Directory Traversal)
Published · last modified .
CVSS v3 metric
CVSS v3 base score 7.5 (High). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
EPSS exploit prediction
EPSS 0.013, 71.0th percentile (last changed ); unchanged over 30 days. About EPSS.
Affected products
- Golang Go
- Go Standard Library Net/http — versions 0, 1.19.0-0
- Go Standard Library OS — versions 0, 1.19.0-0
Weakness classification (CWE)
Public exploits and proof-of-concept code
Also mentioned in 4 other repositories (8-cm/kube-dump, ARPSyndicate/cvemon, drewtwitchell/scancompare, …). These reference the CVE in a list, notes or a scanner and are not exploit code for it.
References
- go.dev/issue/56694 (Issue Tracking, Vendor Advisory)
- go.dev/cl/455716 (Patch, Vendor Advisory)
- groups.google.com/g/golang-announce/c/L_3rmdT0BMU/m/yZDrXjIiBQAJ (Patch, Third Party Advisory, Release Notes)
- pkg.go.dev/vuln/GO-2022-1143 (Patch, Vendor Advisory)