// For flags

CVE-2022-41720

Restricted file access on Windows in os and net/http

Severity Score

7.5
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

0
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

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.

En Windows, se puede acceder a archivos restringidos a través de os.DirFS y http.Dir. La función os.DirFS y el tipo http.Dir brindan acceso a un árbol de archivos ubicados en un directorio determinado. Estas funciones permiten el acceso a archivos de dispositivos Windows bajo esa raíz. Por ejemplo, os.DirFS("C:/tmp").Open("COM1") abre el dispositivo COM1. Tanto os.DirFS como http.Dir solo brindan acceso al sistema de archivos de solo lectura. Además, en Windows, un os.DirFS para el directorio (la raíz de la unidad actual) puede permitir que una ruta creada con fines malintencionados escape de la unidad y acceda a cualquier ruta del sistema. Con la corrección aplicada, el comportamiento de os.DirFS("") ha cambiado. Anteriormente, una raíz vacía se trataba de manera equivalente a "/", por lo que os.DirFS("").Open("tmp") abriría la ruta "/tmp". Esto ahora devuelve un error.

*Credits: N/A
CVSS Scores
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2022-09-28 CVE Reserved
  • 2022-12-07 CVE Published
  • 2024-06-29 EPSS Updated
  • 2024-08-03 CVE Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
  • ---------- First Exploit
CWE
  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Golang
Search vendor "Golang"
Go
Search vendor "Golang" for product "Go"
< 1.18.9
Search vendor "Golang" for product "Go" and version " < 1.18.9"
-
Affected
in Microsoft
Search vendor "Microsoft"
Windows
Search vendor "Microsoft" for product "Windows"
--
Safe
Golang
Search vendor "Golang"
Go
Search vendor "Golang" for product "Go"
>= 1.19.0 < 1.19.4
Search vendor "Golang" for product "Go" and version " >= 1.19.0 < 1.19.4"
-
Affected
in Microsoft
Search vendor "Microsoft"
Windows
Search vendor "Microsoft" for product "Windows"
--
Safe