If you're interested in the inner workings of unsafe deserialization in Ruby I got you covered with a blog post that explains in detail how a concrete gadget chain works:
From JSON to command execution!
I've also created a repository containing proof of concept exploits that work up to Ruby 3.3 for Oj (JSON), Ox (XML) and Psych (YAML):
https://github.com/GitHubSecurityLab/ruby-unsafe-deserialization
Execute commands by sending JSON? Learn how unsafe deserialization vulnerabilities work in Ruby projects
Can an attacker execute arbitrary commands on a remote server just by sending JSON? Yes, if the running code contains unsafe deserialization vulnerabilities. But how is that possible? In this blog post, we’ll describe how unsafe deserialization vulnerabilities work and how you can detect them in Ruby projects.


