An attacker injects malicious JS into your website. (run his JS on the website)
Your website can post comments.
Someone post:
<script>
alert("I control this page");
</script>
Your website didnt block it.
This JS runs in your user’s browser under your website’s identity.
If attacker runs JS on your site, they can: