Last active
January 7, 2020 07:38
-
-
Save asanso/c68182d7c1e97db2f5c2b7c80c59fd54 to your computer and use it in GitHub Desktop.
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
<script> | |
window.crypto.subtle.generateKey( | |
{ | |
name: "AES-GCM", | |
length: 256, //can be 128, 192, or 256 | |
}, | |
false, //whether the key is extractable (i.e. can be used in exportKey) | |
["encrypt", "decrypt"] //can "encrypt", "decrypt", "wrapKey", or "unwrapKey" | |
) | |
.then(function(key){ | |
//returns a key object | |
console.log(key); | |
}) | |
.catch(function(err){ | |
console.error(err); | |
}); | |
</script> | |
<script> | |
//XSS here | |
window.crypto.subtle.exportKey( | |
"jwk", //can be "jwk" or "raw" | |
key //extractable must be true | |
) | |
.then(function(keydata){ | |
//returns the exported key data | |
console.log(keydata); | |
}) | |
.catch(function(err){ | |
console.error(err); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment