CVE-2022-29804: Path Traversal Vulnerability in stdlib package

stdlib Updated 02 Oct 2025

Summary

28/07/2022
Yes i
Unrated
Not published

CVE-2022-29804: Path traversal via Clean on Windows in path/filepath. Affects stdlib across 2 version ranges.

< 1.17.11 >= 1.18.0-0, < 1.18.3

Fixed in 1.17.11 or 1.18.3, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2022-29804 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The stdlib package is a part of the Go ecosystem and provides a collection of standard libraries for various functionalities. It includes the path/filepath package, which offers functions for manipulating file paths. This vulnerability specifically affects the Clean function in the path/filepath package on Windows operating systems.

Vulnerability Detail

The Clean function in the path/filepath package on Windows can convert certain invalid paths to valid, absolute paths. This behavior can potentially be exploited by an attacker to perform a directory traversal attack. For example, the Clean(.\c:) function call returns c:, which is a valid absolute path. This vulnerability can lead to unauthorized access to sensitive files or directories outside the intended scope.

How To Fix

Latest published version: go1.25.5 as of 22 Oct 2026

go get stdlib@vgo1.25.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 1.17.11 1.17.11
    go get stdlib@v1.17.11
  • >= 1.18.0-0, < 1.18.3 1.18.3
    go get stdlib@v1.18.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If updating the package is not immediately feasible, a temporary workaround can be implemented by manually validating and sanitizing user-provided file paths. This can be done by ensuring that the file paths only contain allowed characters and do not include any directory traversal sequences. Here's an example of how to perform basic path validation in Go:

import (
    "path/filepath"
    "strings"
)

func validatePath(path string) bool {
    // Check if the path contains any directory traversal sequences
    if strings.Contains(path, "..") {
        return false
    }

    // Additional validation logic can be added as per requirements

    return true
}

Conclusion

In conclusion, the stdlib package in Go is vulnerable to a path traversal attack on Windows systems. It is crucial to update the affected package to the recommended versions or apply the provided workaround to mitigate the risk. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for stdlib →

Share this vulnerability

FAQ

This vulnerability can allow an attacker to traverse directories and potentially access sensitive files or directories outside the intended scope. It can lead to unauthorized information disclosure or even remote code execution depending on the specific context of the application.

The vulnerability affects versions 0.0.0 to 1.17.10 and 1.18.0-0 to 1.18.2 of the stdlib package.

No, this vulnerability specifically affects the Clean function in the path/filepath package on Windows operating systems. Linux and macOS systems are not impacted.

At the time of this report, there are no known public exploits specifically targeting this vulnerability. However, it is important to promptly update the affected package to mitigate any potential risks.

Yes, you can use Vulert's online playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using only Gopkg.lock file without requiring access to the code or installation.

Related vulnerabilities

Recent vulnerabilities recorded for stdlib.

How To Fix

Latest published version: go1.25.5 as of 22 Oct 2026

go get stdlib@vgo1.25.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 1.17.11 1.17.11
    go get stdlib@v1.17.11
  • >= 1.18.0-0, < 1.18.3 1.18.3
    go get stdlib@v1.18.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback