Skip to content

XSS when embeding youtube video #98

Description

@agabhane

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

  1. Click on youtube toolbar button
  2. 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
  3. Click ok
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions