Ruby 4.0 Universal RCE Deserialization Gadget Chain - #2704
Open
carlospolop wants to merge 4 commits into
Open
Conversation
Collaborator
Author
🔗 Additional ContextOriginal Blog Post: https://elttam.com/blog/ruby-4-0-universal-rce-deserialization-gadget-chain Content Categories: Based on the analysis, this content was categorized under "Pentesting Web > Deserialization > Ruby Marshal Deserialization Gadget Chains". Repository Maintenance:
Review Notes:
Bot Version: HackTricks News Bot v1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Automated Content Update
This PR was automatically generated by the HackTricks News Bot based on a technical blog post.
📝 Source Information
🎯 Content Summary
Overview
The post presents a universal Ruby deserialization gadget chain that turns one attacker-controlled
Marshal.loadoperation into arbitrary Ruby code execution and operating-system command execution. The author demonstrated it on Ruby4.0.6and states that it works unchanged on Ruby3.3through4.0.6. It requires no application-specific classes, third-party gems, or preexisting attacker files: the chain uses RubyGems components...🔧 Technical Details
Autoload-assisted gadget expansion: Reference an autoloaded constant early in a serialized graph to force the deserializer to load additional library files. In Ruby, resolving
Gem::SpecFetcherduringMarshal.loadexposes RubyGems classes required by later gadgets, allowing a chain to function in a minimal process without application-specific dependencies.Hash-key deserialization trigger: Place an attacker-configured object with a side-effectful
hashimplementation in a serializedHashkey position. Reconstructing the hash automatically invokeshash. Here, aGem::StubSpecificationwith attacker-controlled@loaded_fromreachesGem::Specification.load. This general technique is comparable to Java deserialization chains that exploitHashMap.readObjectinvokinghashCode.File-to-eval sink: Identif...
🤖 Agent Actions
Updated
src/pentesting-web/deserialization/README.md.Added concise coverage of:
Timetrigger.to_str→to_sbridging and failure-tolerant file writes.Gem::Specification.loadevaluation.Validation passed with
git diff --checkand custom Markdown/reference checks.mdbook buildwas unavailable becausemdbookis not installed.This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.