Heap-use-after-free in jsmn_parse in fluent-bit

fluent-bit Updated 02 Oct 2025

Summary

13/07/2022
HIGH
Yes i
High
Not published

OSV-2022-577: Heap-use-after-free in jsmn_parse. Affects fluent-bit across 2 version ranges.

< 2afab38dbfe3cff32c14d0a1ce7e4935bef02729 >= 16567ddbbeee9f2b728876c6790c928176c7f4ce, < 53f2e45291bb798e3bc942d039f9b1596aed50f4

Fixed in 53f2e45291bb798e3bc942d039f9b1596aed50f4. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Fluent Bit is an open-source and multi-platform log processor and forwarder that allows you to collect data/logs from different sources, unify them, and send them to multiple destinations. It is designed to be lightweight and efficient, making it suitable for various use cases. However, a vulnerability has been discovered in the jsmn_parse function of fluent-bit, which can lead to a heap-use-after-free issue.

Vulnerability Detail

The vulnerability in fluent-bit arises from a heap-use-after-free issue in the jsmn_parse function. This issue can be triggered when parsing JSON data, potentially leading to a crash or arbitrary code execution. An attacker could exploit this vulnerability by crafting malicious JSON data to trigger the use-after-free condition. The impact of this vulnerability can range from denial-of-service attacks to potential remote code execution.

How To Fix

Minimum fixed version

53f2e45291bb798e3bc942d039f9b1596aed50f4

This is the first release that contains the fix.

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

Workaround

As a temporary workaround, you can consider implementing input validation and sanitization for JSON data before passing it to fluent-bit. This can help mitigate the risk of exploitation by preventing the triggering of the use-after-free condition. Here is an example of input validation in Python:

import json

def validate_json(data):
    try:
        json.loads(data)
        return True
    except json.JSONDecodeError:
        return False

Conclusion

In conclusion, fluent-bit is vulnerable to a heap-use-after-free issue in the jsmn_parse function. This vulnerability can be exploited by crafting malicious JSON data, potentially leading to crashes or arbitrary code execution. It is crucial to update fluent-bit to a version that includes the fix or implement input validation and sanitization as a temporary workaround. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for fluent-bit →

Share this vulnerability

FAQ

Fluent Bit is an open-source log processor and forwarder that allows you to collect, unify, and send logs from various sources to multiple destinations.

A heap-use-after-free vulnerability occurs when a program continues to use a memory region after it has been freed. This can lead to crashes, memory corruption, and potentially, arbitrary code execution.

An attacker can exploit this vulnerability by crafting malicious JSON data that triggers the use-after-free condition in the jsmn_parse function of fluent-bit. This can potentially lead to a crash or arbitrary code execution.

Yes, this vulnerability has been fixed in fluent-bit. It is recommended to update to a version that includes the fix to ensure the security of your system.

As a temporary workaround, you can implement input validation and sanitization for JSON data before passing it to fluent-bit. This can help mitigate the risk of exploitation by preventing the triggering of the use-after-free condition.

Related vulnerabilities

Recent vulnerabilities recorded for fluent-bit.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

53f2e45291bb798e3bc942d039f9b1596aed50f4

This is the first release that contains the fix.

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