CVE-2020-36066: Denial of service in github.com/tidwall/gjson

github.com/tidwall/gjson Updated 02 Oct 2025

Summary

25/08/2022
Yes i
High
7.5

CVE-2020-36066: Denial of service via maliciously crafted JSON in github.com/tidwall/gjson. Affects github.com/tidwall/gjson versions < 1.6.5. Fixed in 1.6.5. How to fix ↓

Also tracked for

The same CVE-2020-36066 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 package github.com/tidwall/gjson is a Go library that provides a fast and efficient way to parse and query JSON data. It offers functions like Get, GetBytes, GetMany, GetManyBytes, Result.Get, parseObject, and queryMatches to extract specific values from JSON documents. However, a vulnerability has been discovered in this package that can lead to a denial of service attack.

Vulnerability Detail

A maliciously crafted JSON input can trigger the vulnerability in github.com/tidwall/gjson, causing a denial of service attack. This vulnerability can be exploited by an attacker to consume excessive resources, leading to a system crash or unresponsiveness. The issue arises due to improper handling of certain JSON inputs, allowing an attacker to exploit this weakness and disrupt the normal functioning of the application.

How To Fix

Latest published version: v1.20.0 as of 23 Oct 2026

go get github.com/tidwall/gjson@v1.20.0

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

If you need the minimum change

1.6.5

This is the first release that contains the fix.

go get github.com/tidwall/gjson@v1.6.5

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, developers can implement input validation and sanitization mechanisms to filter out potentially malicious JSON inputs. By carefully validating and sanitizing the JSON data before passing it to the vulnerable functions, the risk of exploitation can be mitigated. Here's an example of how to validate and sanitize JSON inputs in Go:

import (
	"encoding/json"
	"github.com/tidwall/gjson"
)

func validateAndSanitizeJSON(input []byte) ([]byte, error) {
	var jsonData interface{}
	err := json.Unmarshal(input, &jsonData)
	if err != nil {
		return nil, err
	}

	// Perform additional validation and sanitization steps

	return json.Marshal(jsonData)
}

Conclusion

In conclusion, the package github.com/tidwall/gjson is vulnerable to a denial of service attack due to improper handling of certain JSON inputs. To mitigate this vulnerability, it is crucial to update the package to version 1.6.5 or later. Additionally, implementing input validation and sanitization mechanisms can provide temporary protection. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for github.com/tidwall/gjson →

Share this vulnerability

FAQ

This vulnerability can lead to a denial of service attack, causing the affected application to become unresponsive or crash. It can be exploited by an attacker to disrupt the normal functioning of the application.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. The playground allows you to analyze your application's dependencies without requiring any code or installation.

Yes, a fix is available for this vulnerability. It is recommended to update the affected package to version 1.6.5 or later to mitigate the risk. Updating the package ensures that proper validation and sanitization of JSON inputs are implemented.

Yes, a temporary workaround is to implement input validation and sanitization mechanisms to filter out potentially malicious JSON inputs. By carefully validating and sanitizing the JSON data before passing it to the vulnerable functions, the risk of exploitation can be reduced.

You can find more information about this vulnerability in the official vulnerability report at https://pkg.go.dev/vuln/GO-2022-0957.

Related vulnerabilities

Recent vulnerabilities recorded for github.com/tidwall/gjson.

How To Fix

Latest published version: v1.20.0 as of 23 Oct 2026

go get github.com/tidwall/gjson@v1.20.0

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

If you need the minimum change

1.6.5

This is the first release that contains the fix.

go get github.com/tidwall/gjson@v1.6.5

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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