CVE-2023-45283: The filepath package does not recognize paths with a \??\ prefix as special.
High CVSS 7.5
- CVE id
- CVE-2023-45283
- Published
- Last modified
Affected packages
| Package | Affected versions | Fixed in |
|---|---|---|
| Go Runtimes and servers |
< 1.20.11 >= 1.21.0-0, < 1.21.4 |
1.20.11, 1.21.4 |
How to fix it
Upgrade Go to the fixed release of the line you run: 1.20.11, 1.21.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
The filepath package does not recognize paths with a \??\ prefix as special. On Windows, a path beginning with \??\ is a Root Local Device path equivalent to a path beginning with \?. Paths with a \??\ prefix may be used to access arbitrary locations on the system. For example, the path \??\c:\x is equivalent to the more common path c:\x. Before fix, Clean could convert a rooted path such as \a..\??\b into the root local device path \??\b. Clean will now convert this to .\??\b. Similarly, Join(\, ??, b) could convert a seemingly innocent sequence of path elements into the root local device path \??\b. Join will now convert this to .\??\b. In addition, with fix, IsAbs now correctly reports paths beginning with \??\ as absolute, and VolumeName correctly reports the \??\ prefix as a volume name. UPDATE: Go 1.20.11 and Go 1.21.4 inadvertently changed the definition of the volume name in Windows paths starting with \?, resulting in filepath.Clean(\?\c:) returning \?\c: rather than \?\c:\ (among other effects). The previous behavior has been restored.
References
- CVE-2023-45283 on the NVD
- Advisory: https://nvd.nist.gov/vuln/detail/CVE-2023-45283
- Web: https://go.dev/cl/540277
- Web: https://go.dev/cl/541175
- Web: https://go.dev/issue/63713
- Web: https://go.dev/issue/64028
- Web: https://groups.google.com/g/golang-announce/c/4tU8LZfBFkY
- Web: https://groups.google.com/g/golang-dev/c/6ypN5EjibjM/m/KmLVYH_uAgAJ
- Web: https://pkg.go.dev/vuln/GO-2023-2185
- Web: https://security.netapp.com/advisory/ntap-20231214-0008/
- Web: https://go.dev/cl/540277
- Web: https://go.dev/cl/541175
- Web: https://go.dev/issue/63713
- Web: https://go.dev/issue/64028
- Web: https://groups.google.com/g/golang-announce/c/4tU8LZfBFkY
- Web: https://groups.google.com/g/golang-dev/c/6ypN5EjibjM/m/KmLVYH_uAgAJ
- Web: https://pkg.go.dev/vuln/GO-2023-2185
- Web: https://security.netapp.com/advisory/ntap-20231214-0008/
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.