CVE-2018-14632: Out-of-bounds write in github.com/evanphx/json-patch

Summary

14/04/2021
Yes i
High
7.7

CVE-2018-14632: Out-of-bounds write in github.com/evanphx/json-patch. Affects github.com/evanphx/json-patch across 2 version ranges.

< 0.5.2 >= 3.0.0+incompatible, < 3.0.1-0.20180525145409-4c9aadca8f89+incompatible

Fixed in 0.5.2 or 3.0.1-0.20180525145409-4c9aadca8f89+incompatible, depending on the release line you run. How to fix ↓

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 package 'github.com/evanphx/json-patch' is a Go library that provides functionality for applying JSON patches. It allows users to modify JSON documents by specifying a sequence of operations to be applied. The library is widely used in Go applications for handling JSON data manipulation.

Vulnerability Detail

A malicious JSON patch can trigger an out-of-bounds write attempt in the 'github.com/evanphx/json-patch' package. This vulnerability can be exploited by an attacker to cause a panic, leading to a denial of service (DoS) if the library is exposed to arbitrary user input. The issue originates from improper bounds checking during the patch application process.

How To Fix

Fixed versions by release line

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

  • < 0.5.2 0.5.2
    go get github.com/evanphx/json-patch@v0.5.2
  • >= 3.0.0+incompatible, < 3.0.1-0.20180525145409-4c9aadca8f89+incompatible 3.0.1-0.20180525145409-4c9aadca8f89+incompatible
    go get github.com/evanphx/json-patch@v3.0.1-0.20180525145409-4c9aadca8f89+incompatible

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 is to sanitize and validate user input before applying JSON patches. This can be done by implementing input validation routines that ensure the JSON patch is within the expected bounds and adheres to the intended modifications. Here's an example of input validation code:

func validateJSONPatch(patch []byte) error {
    // Perform validation checks on the patch
    // Return an error if the patch is deemed malicious or out-of-bounds
}

Conclusion

The 'github.com/evanphx/json-patch' package is vulnerable to an out-of-bounds write issue that can be exploited for denial of service attacks. To address this vulnerability, it is recommended to update the package to the fixed versions mentioned above. If immediate update is not possible, implementing input validation can serve as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for github.com/evanphx/json-patch →

Share this vulnerability

FAQ

The vulnerability allows an attacker to trigger a panic in the 'github.com/evanphx/json-patch' package, leading to a denial of service (DoS) if the library is exposed to untrusted user input. This can disrupt the availability of affected applications.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. The playground analyzes your Gopkg.lock file and alerts you in real-time for any open-source vulnerabilities, including this one.

While there are no publicly known exploits specific to this vulnerability, it is important to address it promptly to prevent potential denial of service attacks. Keeping the 'github.com/evanphx/json-patch' package up to date and implementing input validation can mitigate the risk.

Yes, this vulnerability can be exploited remotely if the affected application exposes the 'github.com/evanphx/json-patch' package to untrusted user input. Attackers can send malicious JSON patches to trigger the out-of-bounds write and cause a panic, resulting in a denial of service.

Yes, the vulnerability has been patched in version 0.5.2 of the 'github.com/evanphx/json-patch' package for Go 1.x projects, and version 3.0.1-0.20180525145409-4c9aadca8f89+incompatible for Go 3.x projects. It is crucial to update to these fixed versions to mitigate the risk.

How To Fix

Fixed versions by release line

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

  • < 0.5.2 0.5.2
    go get github.com/evanphx/json-patch@v0.5.2
  • >= 3.0.0+incompatible, < 3.0.1-0.20180525145409-4c9aadca8f89+incompatible 3.0.1-0.20180525145409-4c9aadca8f89+incompatible
    go get github.com/evanphx/json-patch@v3.0.1-0.20180525145409-4c9aadca8f89+incompatible

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