CVE-2022-30632: Uncontrolled Recursion in Glob in golang

golang Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

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

< 1.17.12 >= 1.18.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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The golang package is a popular open-source programming language that provides a robust set of tools and libraries for building scalable and efficient applications. It is widely used for its simplicity, performance, and extensive standard library. However, a vulnerability has been discovered in the Glob function of the path/filepath package in versions before Go 1.17.12 and Go 1.18.4. This vulnerability allows an attacker to cause a panic due to stack exhaustion by providing a path containing a large number of path separators.

Vulnerability Detail

The vulnerability in the Glob function arises from uncontrolled recursion. When a path with a significant number of path separators is passed to the Glob function, it triggers an excessive number of recursive calls, leading to stack exhaustion. This can result in a panic, causing the application to crash. An attacker can exploit this vulnerability by crafting a malicious path and passing it to the Glob function, potentially leading to denial of service or other unexpected behavior.

How To Fix

Fixed versions by release line

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

  • < 1.17.12 1.17.12
  • >= 1.18.0, < 1.18.4 1.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

There is no known workaround for this vulnerability. It is essential to update to the fixed versions of the golang package to address the issue.

Conclusion

The vulnerability in the Glob function of the golang package can be exploited by an attacker to cause a panic due to stack exhaustion. To mitigate this risk, it is recommended to update to the fixed versions (1.17.12 or 1.18.4) of the golang package. For further assistance with vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for golang →

Share this vulnerability

FAQ

This vulnerability can lead to a denial of service (DoS) condition or unexpected application behavior due to a panic caused by stack exhaustion.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your package-lock.json file, and Vulert will analyze it for any open-source vulnerabilities, including this one.

No, only versions before Go 1.17.12 and Go 1.18.4 are vulnerable to this issue. It is crucial to update to the fixed versions to mitigate the risk.

While a specific exploit has not been disclosed, an attacker can craft a malicious path and pass it to the Glob function to trigger a panic and potentially disrupt the application's normal operation.

There is no evidence of active exploitation of this vulnerability at the time of this report. However, it is crucial to update to the fixed versions to prevent potential exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for golang.

How To Fix

Fixed versions by release line

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

  • < 1.17.12 1.17.12
  • >= 1.18.0, < 1.18.4 1.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