Skip to content
Memory corruption Disclosed report Advanced

DoS: type confusion in mrb_no_method_error

Overwriting the 'new' method of the NoMethodError singleton to return a non-exception object causes a type confusion, leading to memory corruption and a native crash. The reporter notes it could possibly allow arbitrary code execution.

raydot Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 43 hours
  • Fixed in 4 days
  • Paid in 3 months
  • Disclosed after 4 months

Overwriting the 'new' method of the NoMethodError singleton to not return an exception object leads to memory corruption and possibly arbitrary code execution.

Running the following code under the mruny-engine sandbox script results in a native crash: NoMethodError.define_singleton_method(:new) do "waat" end Object.q

Attached is a patch to mitigate the issue.

The original report as published on HackerOne, by raydot. 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 runtime assumes the result of calling NoMethodError.new is always a proper exception object and does not verify its type before using it, so a redefined method returning a different type causes a type confusion.

Impact

The issue causes memory corruption and a native crash, and could possibly lead to arbitrary code execution.

What the attacker needed

Ability to run code in the mruny-engine sandbox

The fix

A patch was attached to mitigate the issue, though the text does not state that it was applied.

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.

In this programming language, when you call a method that doesn't exist, the system creates a special error object to describe the problem. The report shows that if you replace the part responsible for creating that error object so it returns something else, the system gets confused about what type of object it is holding. That confusion can corrupt memory and crash the program, and in some cases might let an attacker run their own code.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by raydot

View all

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

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.