CVE-2023-24537: Infinite loop in parsing in go/scanner

stdlib Updated 02 Oct 2025

Summary

05/04/2023
Yes i
Unrated
Not published

CVE-2023-24537: Infinite loop in parsing in go/scanner. Affects stdlib across 2 version ranges.

< 1.19.8 >= 1.20.0-0, < 1.20.3

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

Also tracked for

The same CVE-2023-24537 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 is a collection of standard libraries that provide functionality for various tasks. The gohttps://vulert.com/scanner package is part of the stdlib and is responsible for parsing Go source code. It includes functions like Scanner.Scan and Scanner.updateLineInfo. This vulnerability affects versions 0 through 1.19.8 and versions 1.20.0-0 through 1.20.3 of the stdlib package.

Vulnerability Detail

The vulnerability arises when any of the Parse functions are called on Go source code that contains //line directives with very large line numbers. This triggers an infinite loop due to integer overflow. The impact of this vulnerability is that it can cause the affected application to enter an infinite loop, leading to denial of service and potential resource exhaustion.

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.19.8 1.19.8
    go get stdlib@v1.19.8
  • >= 1.20.0-0, < 1.20.3 1.20.3
    go get stdlib@v1.20.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 stdlib package is not immediately feasible, a possible workaround is to avoid using //line directives with very large line numbers in the Go source code. By keeping the line numbers within a reasonable range, the vulnerability can be mitigated. Here is an example of how to avoid using large line numbers:

// Instead of:
//line myfile.go:1000000000

// Use:
//line myfile.go:1000

Conclusion

In summary, the stdlib package in Go is vulnerable to an infinite loop in parsing when encountering //line directives with very large line numbers. This can lead to denial of service and potential resource exhaustion. It is recommended to update the stdlib package to version 1.19.8 or apply the fix included in versions 1.20.0-0 through 1.20.3 to mitigate this vulnerability. If you have further questions or need assistance with vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for stdlib →

Share this vulnerability

FAQ

The vulnerability can cause the affected application to enter an infinite loop, leading to denial of service and potential resource exhaustion.

Versions 0 through 1.19.8 and versions 1.20.0-0 through 1.20.3 of the stdlib package are affected.

To fix this vulnerability, update the stdlib package to version 1.19.8 or apply the fix included in versions 1.20.0-0 through 1.20.3.

Yes, you can avoid using //line directives with very large line numbers in the Go source code to mitigate the vulnerability.

You can find more information about this vulnerability in the Go vulnerability database at https://pkg.go.dev/vuln/GO-2023-1702.

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.19.8 1.19.8
    go get stdlib@v1.19.8
  • >= 1.20.0-0, < 1.20.3 1.20.3
    go get stdlib@v1.20.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