CVE-2023-42276: hutool Buffer Overflow vulnerability

cn.hutool:hutool-core Updated 02 Oct 2025

Summary

09/09/2023
No i
Critical
9.8

CVE-2023-42276: hutool Buffer Overflow vulnerability. Affects cn.hutool:hutool-core versions < 5.8.21. No fix is published. 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The hutool package is a collection of Java utility classes that provide various functionalities for developers. It includes modules like hutool-core and hutool-json. The hutool-core module offers general utility methods, while the hutool-json module provides JSON parsing and manipulation capabilities. The vulnerability affects hutool versions up to and including 5.8.21.

Vulnerability Detail

The hutool v5.8.21 version contains a buffer overflow vulnerability in the jsonArray component. This vulnerability can be exploited by an attacker to execute arbitrary code or cause a denial of service (DoS) attack. The buffer overflow occurs when processing JSON arrays, allowing an attacker to overwrite adjacent memory locations and potentially execute malicious code.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, developers can sanitize and validate JSON input before processing it with hutool. By implementing strict input validation and ensuring that the JSON data adheres to the expected structure, the risk of triggering the buffer overflow vulnerability can be mitigated. Here's an example of input validation code:

import cn.hutool.json.JSONArray;

public class JsonValidation {
    public static void main(String[] args) {
        String json = "[1, 2, 3]";
        JSONArray jsonArray = new JSONArray(json);
        // Perform additional validation and processing
    }
}

Conclusion

The hutool package, specifically versions up to and including 5.8.21, contains a buffer overflow vulnerability in the jsonArray component. This vulnerability can be exploited to execute arbitrary code or cause a denial of service attack. To mitigate the risk, it is crucial to upgrade to a patched version of hutool beyond 5.8.21. Additionally, implementing strict input validation and sanitization of JSON data can provide a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for cn.hutool:hutool-core →

Share this vulnerability

FAQ

The buffer overflow vulnerability in hutool can lead to arbitrary code execution or denial of service attacks. Attackers can exploit this vulnerability to execute malicious code on the affected system or crash the application, potentially leading to a complete system compromise.

No, only hutool versions up to and including 5.8.21 are affected by this buffer overflow vulnerability. It is recommended to upgrade to a patched version beyond 5.8.21 to mitigate the risk.

Yes, developers can implement strict input validation and sanitize JSON data before processing it with hutool. By ensuring that the JSON input adheres to the expected structure, the risk of triggering the buffer overflow vulnerability can be reduced.

To update hutool in your project, you need to modify your project's dependency configuration file (e.g., pom.xml for Maven projects or build.gradle for Gradle projects) and specify a patched version of hutool that addresses the buffer overflow vulnerability. After making the necessary changes, rebuild your project to include the updated hutool version.

You can find more information about this vulnerability in the official GitHub Advisory Database. Visit the following link for detailed information: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/09/GHSA-rxgf-r843-g53h/GHSA-rxgf-r843-g53h.json

Related vulnerabilities

Recent vulnerabilities recorded for cn.hutool:hutool-core.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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