CVE-2022-41720

Restricted file access on Windows in os and net/http

Description

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.

Category

7.5
CVSS
Severity: High
CVSS 3.1 •
EPSS 0.04%
Vendor Advisory go.dev Vendor Advisory go.dev Vendor Advisory go.dev
Affected: Go standard library os
Affected: Go standard library net/http
Published at:
Updated at:

References

Link Tags
https://go.dev/issue/56694 issue tracking vendor advisory
https://go.dev/cl/455716 patch vendor advisory
https://groups.google.com/g/golang-announce/c/L_3rmdT0BMU/m/yZDrXjIiBQAJ release notes third party advisory patch
https://pkg.go.dev/vuln/GO-2022-1143 patch vendor advisory

Frequently Asked Questions

What is the severity of CVE-2022-41720?
CVE-2022-41720 has been scored as a high severity vulnerability.
How to fix CVE-2022-41720?
To fix CVE-2022-41720, make sure you are using an up-to-date version of the affected component(s) by checking the vendor release notes. As for now, there are no other specific guidelines available.
Is CVE-2022-41720 being actively exploited in the wild?
As for now, there are no information to confirm that CVE-2022-41720 is being actively exploited. According to its EPSS score, there is a ~0% probability that this vulnerability will be exploited by malicious actors in the next 30 days.
What software or system is affected by CVE-2022-41720?
CVE-2022-41720 affects Go standard library os, Go standard library net/http.
This platform uses data from the NIST NVD, MITRE CVE, MITRE CWE, First.org and CISA KEV but is not endorsed or certified by these entities. CVE is a registred trademark of the MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. CWE is a registred trademark of the MITRE Corporation and the authoritative source of CWE content is MITRE's CWE web site.
© 2025 Under My Watch. All Rights Reserved.