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