Heap-buffer-overflow in mrb_memsearch in mruby

mruby Updated 02 Oct 2025

Summary

15/02/2024
MEDIUM
Yes i
Medium
Not published

OSV-2024-104: Heap-buffer-overflow in mrb_memsearch. Affects mruby versions >= abcad36bae43f2c7cb8c2b1753dc94ab4cf25366, < 9c840a68e212fb54136b67711daff331435c1ce7. Fixed in 9c840a68e212fb54136b67711daff331435c1ce7. 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

mruby is an open-source lightweight implementation of the Ruby programming language. It is designed to be embedded in other software and provides a minimalistic and efficient runtime environment. The mrb_memsearch function in mruby is responsible for searching memory buffers. However, a vulnerability has been discovered in this function that can lead to a heap-buffer-overflow when reading data. This vulnerability has been reported by OSS-Fuzz and affects the mruby package.

Vulnerability Detail

The vulnerability in mrb_memsearch can be triggered by performing a specific search operation on a memory buffer. This can result in a heap-buffer-overflow, where more data is read from the buffer than its allocated size allows. The crash state indicates that the issue occurs during the mrb_memsearch function, specifically in the str_convert_range and mrb_str_aref functions. This vulnerability can potentially be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition. The severity of this vulnerability is considered medium.

How To Fix

Minimum fixed version

9c840a68e212fb54136b67711daff331435c1ce7

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

At the moment, no specific workaround has been provided for this vulnerability. It is advisable to follow the recommended fix and update the mruby package to a patched version.

Conclusion

In conclusion, a heap-buffer-overflow vulnerability has been discovered in the mrb_memsearch function of the mruby package. This vulnerability can potentially be exploited to execute arbitrary code or cause a denial-of-service condition. It is crucial to update the mruby package to a version that includes the necessary patch to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for mruby →

Share this vulnerability

FAQ

mruby is a lightweight implementation of the Ruby programming language designed for embedding in other software.

A heap-buffer-overflow occurs when more data is read from a memory buffer than its allocated size allows, potentially leading to memory corruption and security vulnerabilities.

This vulnerability can potentially be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition.

The severity of this vulnerability is considered medium.

At the moment, no specific workaround has been provided. It is recommended to update the mruby package to a patched version.

Related vulnerabilities

Recent vulnerabilities recorded for mruby.

How To Fix

Minimum fixed version

9c840a68e212fb54136b67711daff331435c1ce7

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