Skip to content
XSS Write-up Intermediate

Flash ExternalInterface.call() JavaScript Injection – can make the websites vulnerable to XSS

Flash's ExternalInterface.call() passes user input into a JavaScript function call without proper escaping, allowing an attacker to break out of the string and inject arbitrary JavaScript. This can lead to cross-site scripting (XSS) when a website uses this API with unvalidated input, or when a malicious SWF file is uploaded and opened.

soroush.me

Published on soroush.me

The other reason to beware ExternalInterface.call() (http://lcamtuf.blogspot.com/2011/03/other-reason-to-beware-of.html)

The author, on soroush.me

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the lack of input validation and proper escaping when passing user-supplied strings to ExternalInterface.call(), allowing an attacker to break out of the JavaScript string context.

What the attacker needed

Victim visits a page with vulnerable Flash; or attacker uploads a malicious SWF file

The fix

Developers should validate and properly escape user input before passing it to ExternalInterface.call().

How it was found

  1. Open the demo HTML page that uses ExternalInterface.call().
  2. Enter a backslash and double quote into the Flash input box and press the button.
  3. Observe an error in the browser's Error Console showing the escape character was bypassed.
  4. Enter a crafted payload that closes the function call, adds an alert, and comments out the rest.
  5. Press the button and see the alert box, confirming JavaScript injection.
  6. Alternatively, open the SWF file directly and enter a payload that places the alert inside a catch block to execute JavaScript without an HTML page.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Flash is a technology that lets web pages run interactive content. A Flash feature called ExternalInterface.call() lets Flash code call a JavaScript function on the page. If a website passes user input directly into this call without cleaning it, an attacker can craft input that breaks out of the intended string and runs their own JavaScript in the victim's browser. This is called cross-site scripting (XSS).

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.