CVE-2022-30632: Stack exhaustion on crafted paths in path/filepath

stdlib Updated 02 Oct 2025

Summary

20/07/2022
Yes i
Unrated
Not published

CVE-2022-30632: Stack exhaustion on crafted paths in path/filepath. Affects stdlib across 2 version ranges.

< 1.17.12 >= 1.18.0-0, < 1.18.4

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

Also tracked for

The same CVE-2022-30632 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

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The stdlib package in Go provides a collection of standard libraries for the Go programming language. The path/filepath package is part of the stdlib and offers functions for manipulating file paths. It is commonly used for tasks such as joining and splitting file paths. However, a vulnerability has been discovered in the Glob function of the path/filepath package.

Vulnerability Detail

Calling Glob on a path that contains a large number of path separators can lead to a panic due to stack exhaustion. This vulnerability allows an attacker to craft a malicious path that triggers the panic, potentially causing a denial-of-service (DoS) condition. The panic occurs when the stack size limit is reached, which can result in the termination of the affected application.

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.12 1.17.12
    go get stdlib@v1.17.12
  • >= 1.18.0-0, < 1.18.4 1.18.4
    go get stdlib@v1.18.4

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

Workaround

As a workaround, developers can manually limit the number of path separators in the input path before calling the Glob function. This can be achieved by validating and sanitizing user input, ensuring that the path does not contain an excessive number of separators. Here is an example of how to implement this workaround in Go:

import (
    "path/filepath"
    "strings"
)

func globWithSeparatorLimit(path string) ([]string, error) {
    separatorLimit := 100 // Set the maximum number of separators allowed
    separatorCount := strings.Count(path, string(filepath.Separator))
    if separatorCount > separatorLimit {
        return nil, fmt.Errorf("Excessive number of separators in path")
    }
    return filepath.Glob(path)
}

Conclusion

In conclusion, the path/filepath package in the Go stdlib is vulnerable to a stack exhaustion issue when processing crafted paths. This vulnerability can lead to a denial-of-service condition in affected applications. To mitigate the issue, it is recommended to update the stdlib package to the patched versions and implement the provided workaround. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for stdlib →

Share this vulnerability

FAQ

This vulnerability can lead to a denial-of-service (DoS) condition in applications that use the affected versions of the stdlib package. An attacker can exploit this vulnerability by providing a crafted path to the Glob function, causing the application to panic and potentially crash.

Versions 0.0.0 to 1.17.11 and 1.18.0-0 to 1.18.3 of the stdlib package are affected by this vulnerability. It is recommended to update to version 1.17.12 or 1.18.4 to mitigate the issue.

Yes, updating the stdlib package to the patched versions is the recommended mitigation for this vulnerability. Additionally, developers can implement the provided workaround to limit the number of path separators in the input path.

There is no evidence of active exploits targeting this vulnerability at the moment. However, it is crucial to apply the necessary updates and mitigations to protect against potential attacks.

For more information about this vulnerability, you can visit the official Go vulnerability database at https://pkg.go.dev/vuln/GO-2022-0522.

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.12 1.17.12
    go get stdlib@v1.17.12
  • >= 1.18.0-0, < 1.18.4 1.18.4
    go get stdlib@v1.18.4

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