Ruby 4.0 Universal RCE Deserialization Gadget Chain
pentestercrab
74 points
22 comments
August 14, 2026
Related Discussions
Found 5 related stories in 40.4ms across 4,128 title embeddings via pgvector HNSW
- Sandbox Escape Vulnerabilities Across 4 Coding Agent Vendors fogeltine · 11 pts · July 20, 2026 · 44% similar
- Malicious Rust crate Arrayref runs a build-time payload abhisek · 446 pts · August 20, 2026 · 44% similar
- Racket v9.3 privong · 59 pts · August 14, 2026 · 44% similar
- Unauthenticated RCE in Motorola's MR2600 Router MrBruh · 78 pts · July 12, 2026 · 43% similar
- Running Gemma 4 26B at 5 tokens/sec on a 13-year-old Xeon with no GPU neomindryan · 266 pts · July 15, 2026 · 43% similar
Discussion Highlights (8 comments)
Nextgrid
Doesn't this already require to be "on the other side of the airtight hatchway", or am I missing something? The Marshal.load docs explicitly have a warning that you should not pass it untrusted data: https://docs.ruby-lang.org/en/master/Marshal.html#module-mar...
sebiw
Which brings us to the old saying: Do not deserialize untrusted data. In the context of Rubygems and their specs this obviously is harder to manage but dependencies such as Rubygems are and will always be part of your app's Trusted Computing Base.
saadyousfi
the java ecosystem spent a decade on the same lesson. commons-collections was the first universal gadget library, and attempts to remove gadgets from the classpath were an endless game of catch-up. JEP 290 was the eventual solution: a filter mechanism that enforces which classes are even allowed to be deserialized, rather than trying to audit what classes exist. ruby doesn't have an equivalent. as long as marshal.load on untrusted input exists in the codebase, chasing individual gadgets isn't the fix.
mono442
Quoting the ruby documentation: > Marshal.load is not suitable as a general purpose serialization format and you should never unmarshal user supplied input or other untrusted data.
shevy-java
That's actually crafty. I wonder what the rationale was for the C function time_mload(). Anyone able to find out? How can we see which person created it first?
schwag09
I wrote one of the referenced posts describing the history here: https://blog.trailofbits.com/2025/08/20/marshal-madness-a-br... I was also part of the team that audited RubyGems.org: https://github.com/trailofbits/publications/blob/master/revi... Look at TOB-RGM-9 (an informational, largely out-of-scope finding) if you want to understand what could be done to mitigate some of these concerns. Nearly all of these gadget chains rely on Gem library functionality, which has this wonky .gemspec.rz metadata file that sits alongside the actual gem file. I understand that it'd be a challenging, backwards-incompatible change, but moving this file from Marshal to JSON would break a lot of these gadget chains. Perhaps there would be others, but it would raise the bar.
35129ab
Did the OpenAI "sandbox" have Ruby available or a "sandboxed Ruby", which is an idiotic idea that would be fully expected from slop companies? We are living in a post-fact society where we have to guess bits of information from YouTube videos and OpenAI slop statements. Maybe there should be a Senate hearing about the hack if that is what it takes.
jamesgeck0
So much for coordinated disclosure, I guess.