Expand file tree
The authors found a new deserialisation gadget chain in Ruby on Rails that allows remote code execution on recent versions. They achieved this by combining a file write primitive with a file execution primitive, and later developed a more direct chain using Rack, Sprockets, and other classes.
github.com
Published on github.com
History
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application deserialises untrusted data using Ruby's Marshal.load, allowing attackers to instantiate arbitrary objects and trigger dangerous methods.
What the attacker needed
Application deserialises untrusted data; attacker can supply serialised object
The fix
The vulnerabilities in the gadget classes were fixed in Ruby and Rails, but the underlying issue is that applications should not deserialise untrusted data.
How it was found
- Identify that the application uses Marshal.load on user-controlled data.
- Find a gadget chain that can write a file with controlled content.
- Find a gadget chain that can execute a file.
- Combine the two to achieve remote code execution.
- Alternatively, use the new gadget chain that directly calls ERB processing with controlled input.
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 write-up has not been written yet. The Original tab links to the source.
This report describes a way to turn a deserialisation bug into remote code execution. Deserialisation is when an application turns stored data back into objects; if an attacker can control that data, they may be able to make the application run their code. The authors found a series of classes in Ruby on Rails that, when deserialised, lead to code execution.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.