Negative-size-param in mrb_str_format in mruby

mruby Updated 02 Oct 2025

Summary

11/11/2022
N/A
Yes i
Unrated
Not published

OSV-2022-1163: Negative-size-param in mrb_str_format. Affects mruby versions >= 4e9773ae3db701ff284171f916d3cd144d6fcae4, < 6bcbfed8bb955a4412e0ca79da0244f97076ba18. Fixed in 6bcbfed8bb955a4412e0ca79da0244f97076ba18. 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 embeddable lightweight Ruby implementation written in C. It is designed to be easily integrated into other software projects and provides a minimalistic and efficient Ruby runtime environment. The mrb_str_format function in mruby is responsible for formatting strings. However, a vulnerability has been discovered in this function that allows an attacker to trigger a negative-size-param crash, leading to a denial-of-service condition or potential remote code execution.

Vulnerability Detail

The vulnerability in mrb_str_format arises from a negative-size-param crash. This crash occurs when the function is called with a negative size parameter, which can result in memory corruption or other undefined behavior. An attacker can exploit this vulnerability by crafting a malicious input that triggers the negative-size-param crash, potentially leading to a denial-of-service attack or remote code execution. The vulnerability was reported through the OSS-Fuzz project and has been assigned the identifier OSV-2022-1163.

How To Fix

Minimum fixed version

6bcbfed8bb955a4412e0ca79da0244f97076ba18

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

There is no known workaround for this vulnerability. It is recommended to update the mruby package to a fixed version as soon as possible.

Conclusion

The vulnerability in mrb_str_format in mruby can be exploited to trigger a negative-size-param crash, potentially leading to a denial-of-service attack or remote code execution. It is crucial to update the mruby package to a fixed version as soon as possible 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 an embeddable lightweight Ruby implementation written in C. It provides a minimalistic and efficient Ruby runtime environment that can be easily integrated into other software projects.

The mrb_str_format function in mruby is responsible for formatting strings. It takes a format string and a variable number of arguments and returns a formatted string.

A negative-size-param crash occurs when a function is called with a negative size parameter. This can lead to memory corruption or other undefined behavior.

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

To fix this vulnerability, update the mruby package to a version that includes the fix. The fix was implemented in commit 6bcbfed8bb955a4412e0ca79da0244f97076ba18 in the mruby GitHub repository.

Related vulnerabilities

Recent vulnerabilities recorded for mruby.

How To Fix

Minimum fixed version

6bcbfed8bb955a4412e0ca79da0244f97076ba18

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