Heap-buffer-overflow in fill_lines in Ruby

ruby Updated 02 Oct 2025

Summary

17/11/2023
MEDIUM
Yes i
Medium
Not published

OSV-2023-1173: Heap-buffer-overflow in fill_lines. Affects ruby versions >= bbfd735b887de71de48c7f862e6e3842bcc03241, < f5c3cda7d6e9053ae5ed66e36d13e568595ff1ec. Fixed in f5c3cda7d6e9053ae5ed66e36d13e568595ff1ec. 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Ruby is a dynamic, open-source programming language known for its simplicity and productivity. It is widely used for web development, scripting, and system administration tasks. The vulnerability in question affects the Ruby package and specifically the 'fill_lines' function. This function is responsible for filling lines in a buffer, but due to a heap-buffer-overflow issue, it can read beyond the allocated memory, leading to potential crashes or arbitrary code execution.

Vulnerability Detail

The vulnerability arises from a heap-buffer-overflow in the 'fill_lines' function of the Ruby package. This issue allows an attacker to read beyond the allocated memory, potentially leading to information disclosure or arbitrary code execution. The vulnerability was discovered through the OSS-Fuzz project, and a detailed report can be found at the provided link. The severity of this vulnerability is considered medium.

How To Fix

Minimum fixed version

f5c3cda7d6e9053ae5ed66e36d13e568595ff1ec

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 using the 'fill_lines' function or ensure that the input provided to the function is properly validated and does not exceed the allocated buffer size. Here is an example of how to validate the input:

def fill_lines(input)
  buffer_size = 100
  if input.length <= buffer_size
    # Proceed with filling lines
  else
    # Handle the input exceeding buffer size
  end
end

Conclusion

In conclusion, the 'fill_lines' function in the Ruby package is vulnerable to a heap-buffer-overflow issue. This vulnerability can lead to crashes, information disclosure, or arbitrary code execution. It is crucial to update Ruby to a version beyond f5c3cda7d6e9053ae5ed66e36d13e568595ff1ec or apply proper input validation to mitigate the risk. For further assistance or support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for ruby →

Share this vulnerability

FAQ

The vulnerability can potentially lead to crashes, information disclosure, or even arbitrary code execution. It is crucial to address this issue to prevent any potential security breaches.

This vulnerability was discovered through the OSS-Fuzz project, which focuses on fuzzing open-source software to uncover potential vulnerabilities.

The severity of this vulnerability is considered medium. While it has the potential for serious consequences, it may require specific conditions or user interaction to be exploited.

No, not all versions of Ruby are affected. The vulnerability was introduced in commit bbfd735b887de71de48c7f862e6e3842bcc03241 and fixed in commit f5c3cda7d6e9053ae5ed66e36d13e568595ff1ec. Therefore, versions beyond f5c3cda7d6e9053ae5ed66e36d13e568595ff1ec are not affected.

While updating Ruby to a fixed version is the recommended approach, developers can mitigate the vulnerability by avoiding the use of the 'fill_lines' function or implementing proper input validation to prevent buffer overflows.

Related vulnerabilities

Recent vulnerabilities recorded for ruby.

How To Fix

Minimum fixed version

f5c3cda7d6e9053ae5ed66e36d13e568595ff1ec

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