Re:GetElementById vs. QuerySelector
by ducharmdev on Thursday November 25, 2021 @11:54PM
(#29347574)
Woah, no way. Although I could see this being abused, it's amazing that this even works.
[ Parent
| on HN ]
It has been abused to allow remote code execution in LastPass, a password manager.
https://bugs.chromium.org/p/project-zero/issues/detail?id=12...
You could also crash Internet Explorer 6 simply by including an element with id="tags" on the page. When the user chose to print the page out, the browser would try to access window.tags, find the element instead of what it was expecting to find, and give up.
This was the standard way of DOM touching in the early days, e.g.
FormName.FieldName.value = "foo";There are XSS attacks abusing this behaviour named DOM Clobbering
https://portswigger.net/research/dom-clobbering-strikes-back