Struct type confusion RCE
A type confusion vulnerability in mruby allows an attacker to control the instruction pointer, leading to a crash at an attacker-chosen address. The reporter suggests that with additional primitives, full remote code execution could be achieved.
- Triaged in 40 hours
- Fixed in 6 days
- Paid in 34 days
- Disclosed after 34 days
Heya!
I've been poking at mruby a bit more and I've found a vulnerability that allows an attacker to take control of the instruction pointer.
I've attached a proof of concept script that when run in mruby will jump to 0x0000133713371337 and segfault.
While the proof of concept script just jumps to an attacker controlled address and crashes, it would almost certainly be possible to achieve full remote code execution, especially given an arbitrary read/write primitive (which is easily created using the same techniques as in the proof of concept)
The proof of concept script has detailed annotations throughout about how it works, but I'm also happy to clarify anything if need be :)
Cheers,
███████
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
Impact
An attacker could take control of the instruction pointer, causing a crash, and potentially achieve full remote code execution.
What the attacker needed
Ability to run mruby script
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 lightweight version of the Ruby programming language. A type confusion bug means the program misinterprets what kind of data it is handling, which can let an attacker trick it into running their own code. Here, the attacker can make the program jump to a memory address they choose, which usually crashes it but could be used to run malicious 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.