Company
Date Published
Author
Peter Stöckli
Word count
4099
Language
English
Hacker News points
None

Summary

Unsafe deserialization vulnerabilities, which allow attackers to execute arbitrary commands on remote servers, occur when deserialization libraries can instantiate arbitrary classes from serialized data, a feature originally intended for flexibility rather than execution. The blog post provides an in-depth exploration of how these vulnerabilities manifest in Ruby projects, specifically using the Oj JSON library, and discusses detection and exploitation techniques. It explains the construction of detection gadgets and gadget chains that leverage weaknesses in deserialization processes to execute code, emphasizing the importance of understanding these vulnerabilities to prevent them. The post also highlights the use of CodeQL for detecting unsafe deserialization when source code is available, and provides examples of vulnerable sinks in several Ruby deserialization libraries. It concludes by showcasing how a universal remote code execution gadget chain can be constructed, stressing that such techniques should be used responsibly, ideally in controlled environments.