Skip to content
DoS Disclosed report Intermediate

Segmentation fault - mrb_gc_mark

A segmentation fault occurs in mruby's garbage collector when running a script that produces syntax errors, causing the interpreter to crash. The crash happens because the garbage collector tries to mark an invalid object pointer.

alanbugz Follow

Originally disclosed on HackerOne

  • Triaged in 7 days
  • Fixed in 27 days
  • Paid in 33 days
  • Disclosed after 2 months
# gdb /root/mruby-engine/ext/mruby_engine/mruby/bin/mirb
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /root/mruby-engine/ext/mruby_engine/mruby/bin/mirb...done.
(gdb) run 3.rb
Starting program: /root/mruby-engine/ext/mruby_engine/mruby/bin/mirb 3.rb
mirb - Embeddable Interactive Ruby Shell

 => [300000, 8]
line 2: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
line 3: syntax error, unexpected tAMPER

Program received signal SIGSEGV, Segmentation fault.
mrb_gc_mark (mrb=0x6cf010, obj=0x305c3030325c3737) at /root/mruby-engine/ext/mruby_engine/mruby/src/gc.c:696
696       if (!is_white(obj)) return;
(gdb) x/1i $rip
=> 0x410f75 <mrb_gc_mark+5>:    movzbl 0x1(%rsi),%eax
(gdb) list *$rip
0x410f75 is in mrb_gc_mark (/root/mruby-engine/ext/mruby_engine/mruby/src/gc.c:696).
691
692     MRB_API void
693     mrb_gc_mark(mrb_state *mrb, struct RBasic *obj)
694     {
695       if (obj == 0) return;
696       if (!is_white(obj)) return;
697       mrb_assert((obj)->tt != MRB_TT_FREE);
698       add_gray_list(mrb, &mrb->gc, obj);
699     }
700
(gdb) bt

The original report as published on HackerOne, by alanbugz. 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 bug in mruby's garbage collector where it attempts to mark an object that is not a valid heap object, possibly due to a corrupted or uninitialised pointer after a syntax error.

Impact

The interpreter crashes when running this script.

What the attacker needed

Run mruby interpreter with a crafted script

How it was found

  1. Run the mruby interpreter (mirb) with a script file named 3.rb.
  2. The script contains syntax errors, which are reported.
  3. The interpreter then crashes with a segmentation fault in mrb_gc_mark.

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.

This is a crash in a small Ruby interpreter called mruby. When the interpreter tried to run a script with syntax errors, it crashed instead of showing an error message. The crash happened inside the part that cleans up memory (garbage collector), which tried to use a bad memory address.

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 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.