maxdamage
02-24-2007, 12:37 PM
Hello everybody!
I want to discuss in this topic about: "How to build a secure flash application on web". I've been touched recently by this issue and I think that we should have a little talk about it.
I'm talking here about the flash applications that use php server-side scripts and mySQL databases.
We all know that SWF files are open format, so anybody can decompile them and see the AS code. Seeing the AS code leads immediately to knowing the directory structure of the php scripts that reside on the web server. So, if I have an php script that is accessed by using the sendAndLoad() method of the LoadVariable class, then anybody who decompiles the swf file, will know the precise location of the php script on the web server. A person who can access this php script, can also insert data in your database, by sending variables from a form, located on a different web server.
Now, how can we restrict access to this file, so it can be accessed only by other files that resides on the same domain. "By using the HTTP referer" should say some of us. Well, no! The HTTP referer can be faked by tampering the HTTP header data that is sent to the script (POST or GET). Tampering the data allows you to change the value of the variables that are sent through the HTTP header.
I've created a flash game and there were a few users that tampered the HTTP headers sent by the game, so their final score was way over the best players of the game. This was not a nice sensation at all, especially because the game had some prizes. So now I've decided to look for help here.
Thanks to those who will participate!
I want to discuss in this topic about: "How to build a secure flash application on web". I've been touched recently by this issue and I think that we should have a little talk about it.
I'm talking here about the flash applications that use php server-side scripts and mySQL databases.
We all know that SWF files are open format, so anybody can decompile them and see the AS code. Seeing the AS code leads immediately to knowing the directory structure of the php scripts that reside on the web server. So, if I have an php script that is accessed by using the sendAndLoad() method of the LoadVariable class, then anybody who decompiles the swf file, will know the precise location of the php script on the web server. A person who can access this php script, can also insert data in your database, by sending variables from a form, located on a different web server.
Now, how can we restrict access to this file, so it can be accessed only by other files that resides on the same domain. "By using the HTTP referer" should say some of us. Well, no! The HTTP referer can be faked by tampering the HTTP header data that is sent to the script (POST or GET). Tampering the data allows you to change the value of the variables that are sent through the HTTP header.
I've created a flash game and there were a few users that tampered the HTTP headers sent by the game, so their final score was way over the best players of the game. This was not a nice sensation at all, especially because the game had some prizes. So now I've decided to look for help here.
Thanks to those who will participate!