Pairs lovely with CVE-2019-5418!
This repository contains a proof-of-concept (PoC) exploit demonstrating remote code execution (RCE) in Ruby on Rails applications via ActiveSupport::MessageVerifier abuse. Use responsibly!
This script exploits ActiveSupport deserialization vulnerabilities by leveraging a crafted ERB object wrapped in DeprecatedInstanceVariableProxy. When the signed payload is deserialized by a vulnerable Rails application, arbitrary Ruby code execution occurs.
This project is for educational and research purposes only. Unauthorized use against systems you do not own is illegal and may result in severe legal consequences.
- The script derives a `` from a known Rails application name using MD5 hashing.
- Uses
ActiveSupport::KeyGeneratorto generate a signing key.
- Constructs an uninitialized `` object with attacker-controlled code.
- Hides the malicious object within an innocuous-looking wrapper.
- Uses
ActiveSupport::MessageVerifierto sign the payload, making it appear legitimate.
- When deserialized, Rails executes the attacker's payload, allowing arbitrary command execution.
ruby POC.rbThe script will generate a signed exploit token, which can be used against a vulnerable Rails application.
- **Rotate and secure **`` to prevent attackers from generating signed payloads.
- Upgrade Rails to the latest version (Rails 7+ has stricter serialization mechanisms).
- Use JSON serialization instead of Marshal serialization to avoid arbitrary object loading.
- Audit application deserialization to ensure untrusted user input is not being deserialized.
This project is intended for educational purposes only. The author is not responsible for any misuse or damages caused by this code.
