Heap-buffer-overflow in mrb_funcall_with_block in mruby

mruby Updated 02 Oct 2025

Summary

15/10/2021
HIGH
Yes i
High
Not published

OSV-2021-1453: Heap-buffer-overflow in mrb_funcall_with_block. Affects mruby versions >= dccd66f9efecd0a974b735c62836fe566015cf37, < 7010ed0f0a414b1367e4620a504f106759341cc2. Fixed in 7010ed0f0a414b1367e4620a504f106759341cc2. 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

mruby is an open-source lightweight implementation of the Ruby programming language. It is designed to be embedded in other applications and provides a minimalistic and efficient runtime environment. The mrb_funcall_with_block function in mruby is responsible for calling a Ruby method with a block. This vulnerability, identified as OSV-2021-1453, is a heap-buffer-overflow issue that can lead to a crash or potentially allow an attacker to execute arbitrary code.

Vulnerability Detail

The vulnerability occurs when mrb_funcall_with_block is called with certain parameters, resulting in a heap-buffer-overflow write of 8 bytes. This can lead to memory corruption and potentially allow an attacker to control the execution flow of the program. The crash state indicates that the issue is triggered during the execution of mrb_funcall_id and mrb_equal functions. The severity of this vulnerability is considered HIGH.

How To Fix

Minimum fixed version

7010ed0f0a414b1367e4620a504f106759341cc2

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 workaround, developers can avoid calling mrb_funcall_with_block with the specific parameters that trigger the vulnerability. It is important to carefully review the code and ensure that the function is not used in a way that could lead to the heap-buffer-overflow. Here is an example of how to avoid the vulnerable usage:

def safe_method_call(mrb, receiver, method, block)
  # Check if the method and block are valid
  if method && block
    # Call the method with the block
    mrb.funcall_with_block(receiver, method, block)
  else
    # Handle the case where the method or block is missing
    # ... (alternative code)
  end
end

Conclusion

The heap-buffer-overflow vulnerability in mrb_funcall_with_block in mruby can lead to crashes or potential code execution. It is crucial to update the mruby package to a fixed version and review the usage of mrb_funcall_with_block to prevent the vulnerability. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for mruby →

Share this vulnerability

FAQ

mruby is an open-source lightweight implementation of the Ruby programming language. It is designed to be embedded in other applications and provides a minimalistic and efficient runtime environment.

mrb_funcall_with_block is a function in mruby that is used to call a Ruby method with a block.

A heap-buffer-overflow is a type of memory corruption vulnerability where a program writes data beyond the bounds of a heap-allocated buffer. This can lead to crashes, memory corruption, and potentially allow an attacker to execute arbitrary code.

To fix this vulnerability, you should update the mruby package to a version that includes the fix. Make sure to review the release notes and changelog of the mruby project to identify the version that addresses this specific issue.

Yes, as a workaround, you can avoid calling mrb_funcall_with_block with the specific parameters that trigger the vulnerability. Review your code and ensure that the function is used in a safe manner to prevent the heap-buffer-overflow.

Related vulnerabilities

Recent vulnerabilities recorded for mruby.

How To Fix

Minimum fixed version

7010ed0f0a414b1367e4620a504f106759341cc2

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