Skip to content
DoS Disclosed report Advanced

Segmentation fault when a Ruby method is invoked by a C method via Object#send

A crash bug in mruby: aliasing Object#send over initialize lets a C function (Class#new) invoke a Ruby method through send with arbitrary arguments, and doing so causes a segmentation fault. An attacker who can run Ruby code on the interpreter could crash the process.

h72 Follow

Originally disclosed on HackerOne

Bounty$8,000 High View original
  • Triaged in 2 days
  • Fixed in 4 months
  • Paid in 4 months
  • Disclosed after 5 months

We can arrange for C to call Object#send by aliasing it over initialize. This will cause Class#new (a C function) to call #initialize (which is actually Object#send) with arbitrary arguments.

If we invoke a Ruby method through Object#send, mruby segfaults:

def foo
end

class X
  alias_method :initialize, :send
end

X.new.send(:foo)

The original report as published on HackerOne, by h72. 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 the interpreter does not correctly handle Object#send being invoked as the initialiser from C code, leading to invalid memory access.

Impact

Invoking a Ruby method through Object#send in this arrangement crashes the interpreter with a segmentation fault.

What the attacker needed

Ability to run Ruby code in mruby

How it was found

  1. Define a Ruby method to call.
  2. Reopen a class and alias send over initialize.
  3. Create a new instance of that class and call send on it with the method name.

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 version of the Ruby programming language. A segmentation fault is a crash where the program tries to use memory it is not allowed to touch, so the whole process dies. Here, a particular way of calling a method makes the interpreter crash instead of running normally.

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 h72

View all

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