XSF could be used in the presence of Flash HTML Injection or external SWF files when loadMovie*

XSF could be used in the presence of Flash HTML Injection or external SWF files when loadMovie*

methods are used.

methods are used.

+

+

=== Open redirectors ===

+

+

SWFs have the capability to navigate the browser. If the SWF takes the destination in as a FlashVar, then the SWF may be used as an open redirector. An open redirector is any piece of website functionality on a trusted website that an attacker can use to redirect the end-user to a malicious website. These are frequently used within phishing attacks. Similar to cross-site scripting, the attack involves a user clicking on a malicious link. In the Flash case, the malicious URL might look like:

In the above example, an end-user might see the URL begins with their favorite trusted website and click on it. The link would load the trusted SWF which takes the getURLValue and provides it to an ActionScript browser navigation call:

+

+

<pre>

+

getURL(_root.getURLValue,"_self");

+

</pre>

+

+

This would navigate the browser to the malicious URL provided by the attacker. At this point, the phisher has successfully leveraged the trusted the user has in trusted.example.org to trick the user into their malicious website. From their, they could launch a 0-day, conduct spoofing of the original website, or any other type of attack. SWFs may unintentionally be acting as an open-redirector on the website.

+

+

Developers should avoid taking full URLs as FlashVars. If they only plan to navigate within their own website, then they should use relative URLs or verify that the URL begins with a trusted domain and protocol.

Brief Summary

ActionScript is the language, based on ECMAScript, used by Flash applications when dealing with
interactive needs. There are three versions of the ActionScript language. ActionScript 1.0 and ActionScript 2.0 are very similar with ActionScript 2.0 being an extension of ActionScript 1.0. ActionScript 3.0, introduced with Flash Player 9, is a rewrite of the language to support object orientated design.

ActionScript, like every other language, has some implementation patterns which could lead to security issues.

In particular, since Flash applications are often embedded in browsers, vulnerabilities like DOM based Cross Site Scripting could be present in flawed Flash applications.

Description of the Issue

Since the first publication of "Testing Flash Applications" [1], new versions of Flash player
were released in order to mitigate some of the attacks which will be described.
Nevertheless, some issues still remain exploitable because they are the result of insecure
programming practices.

Gray Box testing and example

Decompilation

Since SWF files are interpreted by a virtual machine embedded in the player itself,
they can be potentially decompiled and analysed.
The most known and free ActionScript 2.0 decompiler is flare.

To decompile a SWF file with flare just type:

$ flare hello.swf

it will result in a new file called hello.flr.

Decompilation helps testers because it allows for source code assisted, or white-box, testing of the Flash applications.

In ActionScript 2.0, any uninitialized global variable is assumed to be a FlashVar. Global variables are
those variables that are prepended by _root, _global or _level0. This means that if an attribute like:

_root.varname

is undefined throughout the code flow, it could be overwritten by setting

http://victim/file.swf?varname=value

Regardless of whether you are looking at ActionScript 2.0 or ActionScript 3.0, FlashVars can be a vector
of attack. Let's look at some ActionScript 2.0 code that is vulnerable:

The Test

In order to exploit a vulnerability, the swf file should be hosted on the victim's host, and
the techniques of reflected XSS must be used.
That is forcing the browser to load a pure swf file directly in the location bar
(by redirection or social engineering) or by loading it through an iframe from an evil page:

Note: since release Flash Player 9.0.124.0 of Flash player XSS is no longer exploitable, but GUI modification could still
be accomplished.

Cross Site Flashing

Cross Site Flashing (XSF) is a vulnerability which has a similar impact as XSS.

XSF Occurs when from different domains:

One Movie loads another Movie with loadMovie* functions or other hacks and has access to the same sandbox or part of it

XSF could also occurs when an HTML page uses JavaScript to command an Adobe Flash movie, for example, by calling:

GetVariable: access to flash public and static object from JavaScript as a string.

SetVariable: set a static or public flash object to a new string value from JavaScript.

Unexpected Browser to SWF communication could result in stealing data from the SWF application.

It could be performed by forcing a flawed SWF to load an external evil flash file.

This attack could result in XSS or in the modification of the GUI in order to fool a user to
insert credentials on a fake flash form.

XSF could be used in the presence of Flash HTML Injection or external SWF files when loadMovie*
methods are used.

Open redirectors

SWFs have the capability to navigate the browser. If the SWF takes the destination in as a FlashVar, then the SWF may be used as an open redirector. An open redirector is any piece of website functionality on a trusted website that an attacker can use to redirect the end-user to a malicious website. These are frequently used within phishing attacks. Similar to cross-site scripting, the attack involves a user clicking on a malicious link. In the Flash case, the malicious URL might look like:

In the above example, an end-user might see the URL begins with their favorite trusted website and click on it. The link would load the trusted SWF which takes the getURLValue and provides it to an ActionScript browser navigation call:

getURL(_root.getURLValue,"_self");

This would navigate the browser to the malicious URL provided by the attacker. At this point, the phisher has successfully leveraged the trusted the user has in trusted.example.org to trick the user into their malicious website. From their, they could launch a 0-day, conduct spoofing of the original website, or any other type of attack. SWFs may unintentionally be acting as an open-redirector on the website.

Developers should avoid taking full URLs as FlashVars. If they only plan to navigate within their own website, then they should use relative URLs or verify that the URL begins with a trusted domain and protocol.

Attacks and Flash Player Version

Since May 2007, three new versions of Flash player were released by Adobe.
Every new version restricts some of the attacks previously described.