Recently a client was concerned that their SWF was "insecure" because the XML path was coming from Flashvars. This seems to me to be something that isn't really a concern as the SWF is only displaying images / text and a few button links. I can understand how someone could path to the swf and add a remote XML path in to add javascript to the button url targets, but really what damage could this do?
Eg.
they could change
http://mysite.com/theflash.swf?xmlpath=xml/thedata.xml
to this
http://mysite.com/theflash.swf?xmlpath=http://dodgysite.com/thechangeddata.xml
Obviously they could build a fake wrapper html file around this but I still don't see how they could do anything harmful with this. Am I missing something?
My next question is what is the best way to go about preventing this from happening?
So far I have in my XSS checking class:
- unescape the string and remove any spaces or linebreaks (\t, \n, \r)
- check the string for any of the following (asfunction:, javascript:, event:, vbscript:)
- check for absolute or relative path by looking for (http or https)
- if absolute, check that the domain is the same as the main movie.
Most of this process I found in this article: http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps_02.html
Is there a better way than this?
What else could be done to prevent XSS in flash?