Created
July 22, 2016 16:38
-
-
Save igneus/8d93e097c6a31f092c29baf677215009 to your computer and use it in GitHub Desktop.
Safely watch an example exploit of a known Rails webconsole vulnerability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# having read | |
# https://benmmurphy.github.io/blog/2016/07/11/rails-webconsole-dns-rebinding/ | |
# I wanted to see what http://www.dnsrebinder.net/ would execute | |
# if I had an app with Rails webconsole running on localhost:3000 | |
# Usage: | |
# * run this application | |
# * visit http://www.dnsrebinder.net/ | |
# * watch console | |
require 'sinatra' | |
set :port, 3000 | |
path_regex = /\/(__web_)?console/ | |
get '/not_found' do | |
# the exploiting script expects a certain status code | |
# and a certain string in the response body: | |
status 404 | |
body "console/repl_sessions/123'" | |
end | |
get path_regex do | |
p params | |
'hello, kitty' | |
end | |
post path_regex do | |
p params | |
'hello, kitty' | |
end | |
put path_regex do | |
p params | |
'hello, kitty' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment