Skip to content

iframe reflective XSS attack #2548

@hex0xf

Description

@hex0xf

Describe the bug

function Test () {
  let i = 'javascript:alert(1);'
  return (
    <iframe src={i} />
  )
}

When setting javascript:alert(1) on the iframe's src, an XSS attack will be triggered. This always happens on both the server and client sides.
React's setProp handles src and href separately, filtering out this potential risk.
I think this risk should be addressed at the framework level.

Your Example Website or App

https://playground.solidjs.com/anonymous/c9f1616a-47c3-4b50-870b-f4ab9c9d2b3f

Steps to Reproduce the Bug or Issue

View case

Expected behavior

no alert

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions