How NOT To Restrict Cross-Domain Flash Content

Written on:January 8, 2014
Add One


Insufficient input validation is a problem I encounter practically every time I test an application. I’ve talked about relying on input validation as a prevention mechanism before (see here and item #8 here) but since it’s such a prevalent problem I figured I’d take the time to write about it once again. 

While a good supplemental control, by itself input validation is usually woefully inadequate. Quite frankly, it often requires much more effort to try and develop an input validation function that is considered comprehensive enough to use as a stand-alone control vs. using it in conjunction with other, more effective controls (such as output encoding, parameterized queries, etc). I’ve seen some really creative input validation approaches, including very complex regex or other “clever” filtering approaches, most of which are designed to “outsmart” the attacker. The problem with this blacklist-style approach is it must consider every possible permutation of input, and not surprisingly, usually falls short. [I’d love to publish some of my favorites but unfortunately can’t publicly disclose most of my test results]. 

The real-world example I am able to give today is a simple cross-domain validation flaw I found in one of Paypal’s hosted flash files*. Although the resulting exploit was nothing to write home about, I think it once again highlights why input validation (especially client-side) is never a sufficient stand-alone control, especially when it comes to restricting cross-domain access of flash content.  

Finding the Vulnerability

In this particular case, I was conducting a little experiment on bug bounty programs and had shifted my attention to Paypal. I knew it was a big user of flash content so I figured I’d start by seeing what type of hosted .swf objects I could find via Google:


One of the files I came across was pp_demo_player.swf which played a demonstration video on some features of their Mastercard. 


The full path to the file was as follows (it has since been removed):

Notice the relative path to the *_config.xml file (more on this shortly). This definitely sparked my interest enough to warrant further investigation. 

I downloaded the .swf file and opened it in my flash decompiler of choice ( 


While browsing the “scripts folder” I came across the “ApplicationFacade” script:


One of the nice features of JPEXS is the “Traits” window which provides a quick glimpse into the variables declared within a given script. The one that caught my eye was public static const ALLOWED_DOMAINS, an array of regular expressions intended to limit the domains from which flash media content can be loaded. 


The array has multiple regular expressions (each for a different, authorized domain) but all of them suffer from the same validation problem, so I’ll only list one of them below. 

The intention of this regex is to limit the playable content to only that which resides on an authorized domain. While it does a good job of blocking domains such as hxxp://, it is ineffective at preventing the use of a malicious domain that has a subdomain of For example, the following domain would pass the regex test: hxxp://

Also, the very fact that this regex array contains multiple domains (listed below) is an indicator that the site supports cross-domain content, another “red flag”:


If you’re familiar with the Flash Player security model, cross-domain loading of data is prevented by default. However if required, the restriction can be relaxed by listing the authorized domains within a crossdomain.xml policy file (hosted on the web server). There are several reasons as to why this might be required, but if not implemented properly, it may allow for too broad (or even completely unrestricted — *.*) access.

My plan was to prove I could exploit this client-side validation flaw and the site’s use of cross-domain content and force the Paypal site to host any video of my choosing. 

Exploiting the Validation Flaw

The regex array is passed to a function within pp_demo_player.swf file called validateUrl:

Pretty straightforward: loop through the ALLOWED_DOMAINS array elements and if the URL passes the regex, accept it. This function is called as follows:

But where is this “XML config” file that dictates which video will be loaded (and which URL will be passed to the validation function)? For that we have to return to the *_config.xml file referenced in the original URL:

The downloaded config file contained the following:

Note the chapter file attribute identifies the .flv video that is supposed to be loaded which I’ll change to another video of my choosing. Since PayPal was the target, I decided to go with a video advertising a “PayPal Money Hack” hosted on an arbitrary, external media site:

I updated the file attribute in the *_config.xml file to point to this new video:

Now I just needed to host this *_config.xml file on a server under my control with a path that could pass the flawed regex filter.

I set up a server (for the purposes of the demo I’ll call it localhost) with a sub-domain of, where I hosted the above *_config.xml file in the document root along with the following unrestricted crossdomain.xml file:

Now I could force to load the “paypal_money_hack” video (or any other of my choosing) by using the following URL:



Hopefully, this simple demo illustrated the potential problems that can arise from poorly configured cross-domain policies and the reliance on client-side input validation. 

Of course, poorly configured cross-domain policies can lead to many other security issues more serious than what I’ve illustrated here ( and cross domain security extends well beyond a properly configured crossdomain.xml file ( so I definitely recommend researching this topic further, if you’re so inclined.

Until next time… 

*This was one of two vulnerabilities I reported to PayPal mid-2013 that did not qualify for a bounty because they stated it had already been reported (the third time was the charm: 

5 Comments add one

  1. Rohitesh says:

    Can you say me how much did Paypal pay you for finding such bug?

    • Mike Czumak says:

      Thanks for reading Rohitesh. Actually this bug didn’t pay me anything. When I submitted this bug, Paypal stated it had already been found by another researcher and were therefore not eligible for a bounty payment (see * footnote in the post body). – Mike

  2. Hello,
    I have a problem with a swf file that will work correctly across the web but fails when accessed locally from my LAN. would this be a cross domain problem.
    this the program in question

Leave a Comment

Your email address will not be published. Required fields are marked *