When we try to embed youtube video using below iframe syntax, javascript code gets executed.
<iframe width="560" height="315" src="https://www.youtube.com/embed/ADS742xsoTw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen onmouseover=alert(document.domain)></iframe>
Steps to reproduce
- Click on youtube toolbar button
- Paste
<iframe width="560" height="315" src="https://www.youtube.com/embed/ADS742xsoTw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen onmouseover=alert(document.domain)></iframe> in embed code box
- Click ok
- Observe alert
Actual result
Alert is shown with domain name
Expected result
Pasted code should be sanitized and js should not be exeucted to display alert.
When we try to embed youtube video using below iframe syntax, javascript code gets executed.
<iframe width="560" height="315" src="https://www.youtube.com/embed/ADS742xsoTw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen onmouseover=alert(document.domain)></iframe>Steps to reproduce
<iframe width="560" height="315" src="https://www.youtube.com/embed/ADS742xsoTw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen onmouseover=alert(document.domain)></iframe>in embed code boxActual result
Alert is shown with domain name
Expected result
Pasted code should be sanitized and js should not be exeucted to display alert.