Skip to content
DoS Disclosed report Intermediate

Garbage collector crash

A short mruby program that creates a Fiber, yields a Proc from it, and then triggers garbage collection causes the interpreter to abort on a failed assertion in the garbage collector. An attacker able to run Ruby code could crash the interpreter process.

dgaletic Follow

Originally disclosed on HackerOne

Bounty$300 Low View original
  • Triaged in 3 days
  • Fixed in 18 days
  • Paid in 18 days
  • Disclosed after 22 days

This github [issue](https://github.com/mruby/mruby/issues/3063] seems to have been reintroduced.

f = Fiber.new do
    m = Fiber.current
    Fiber.yield Proc.new {}
end

f = f.resume
GC.start

It causes mruby to abort due to a failed assertion.

$ mruby poc
mruby: /home/user/repos/mruby/src/gc.c:698: mrb_gc_mark: Assertion `(obj)->tt != MRB_TT_FREE' failed.
Aborted

The issue was reintroduced in ecee8c51b0ad8cddd9e422a3e5105f902d7e2781 and is still present in 051e40c0493f2de332f5439e3230c9fe6958bf1a.

The issue is fixed by reverting ecee8c51b0ad8cddd9e422a3e5105f902d7e2781.

Thank you, Dinko Galetic Denis Kasak

The original report as published on HackerOne, by dgaletic. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a regression in the garbage collector's handling of objects reachable from a suspended Fiber, reintroduced by a specific commit, causing it to mark an already-freed object.

What the attacker needed

Ability to run Ruby code in mruby

The fix

The issue was fixed by reverting the commit that reintroduced it.

How it was found

  1. Create a Fiber whose body captures the current Fiber and yields a new Proc.
  2. Resume the Fiber so it pauses at the yield and returns the Proc.
  3. Start garbage collection, which triggers the failed assertion and aborts the interpreter.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

mruby is a small implementation of the Ruby programming language. A Fiber is a lightweight unit of execution that can pause and resume, and the garbage collector is the part that frees memory no longer in use. Here, a particular combination of a paused Fiber and a Proc object confuses the garbage collector, which then hits an internal safety check and stops the whole program.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by dgaletic

View all

13 more disclosed reports, best first.

More from shopify-scripts

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.