flash.media.SoundMixer: All your sound belong to us

Seems the SoundMixer class is a singleton. And a big one - it exists across multiple swfs and domains. Which leads to a bit of a problem.

For example, open the following urls in separate tabs in Firefox (allow the first to fully load before opening the second):

AFC Components: Reflection
Joe Satriani

That’s what I did, and (assuming you’ve got the Flash 9.0.115 player installed) you should see the same thing I did: a big security error stating that:

SoundMixer.computeSpectrum: http://www.satriani.com/2004/SatrianiPlayer4.swf cannot access http://www.afcomponents.com/flv/vid/sample.flv.

Seems to be a bit of a problem. Really, you would expect that SoundMixer would isolate itself to sound playing in the current .swf, or at least on the domain. Or, if it is going to grab the sound data from all swfs playing, it should do it without worrying about security and domain boundaries…

Incidentally, this security error doesn’t occur only when it’s cross-domain. I had the same problem when putting two swfs on a page that both attempted to grab computeSpectrum data.

Share me: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon
  • Technorati

Encryption != Protection

Something that should be obvious, yet isn't always.

We'll use a relatively concrete example, without naming names or giving out links. Because while Encryption does not equal Protection, Encryption not equaling Protection plus scandalous leaks can equal very bad things. ;)

In any case:

Let's say you want want to pass some sensitive data from one site to another (in particular I'm thinking about single-sign on solutions, where a login persists between sites). In order to keep the information "safe" over the wires, you encrypt it (on the server, of course). I'll pseudo-code this so it's language agnostic for y'all:

  1. function Encrypt data
  2.      return theData Encrypted
  3. end function
  4.  
  5. function WriteUserLink
  6.      Write( <a href="http://othersite.com/page/?user=bob&password={Encrypt( bobspassword )}&todo=update">Click here</a> )
  7. end function

Somewhere on your page, you call the "WriteUserLink" function which outputs a link to do something to the user, encrypting the password along the way*. Now, no-one will be able to see the plain text password if they happen to sniff the request or look over the users shoulder.

Hopefully you see the problem.

The scenario above is would be put in place where authentication on one site needs to carry through to another site (eg: a single sign on solution). When transferring a user between the two sites, the username/password combination is passed through, the password encrypted.

Well, my friends, you've just left the barn doors wide open.

Why? Because, in the scenario, anyone who grabs the url can now login as the user in question, simply by copy-and-pasting the url into their own browser. Depending upon the abilities given through the site, the nefarious agent may now be able to change the account password, and would then have complete control of the users account.

At the very least, use form (POST) variables - while they're visible in the request, they're not visible in the URL. A somewhat better approach would be to drop a cookie on the second domain from the initial site, with a fully encrypted payload. From there, the page on the second domain could read the cookie. Still not 100%, but way less transparent. Alternatively, if you have really sensitive data, a better idea might be to authenticate the user a second time on the other site - it's a slightly worse user experience, but virtually eliminates the possibility of the authentication data being picked up in between.

I'd love to offer more (and better) solutions - they're definitely out there (I am definitely not inventing the wheel on this one). I'll follow up on this post as I think/discover more about it...For the time being, just think carefully about how you implement things like this.

And keep your barn doors closed. Ahem.

* Please note: I am absolutely not advocating sending a username/password combination via querystring...this is just an example.

Share me: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon
  • Technorati