Wednesday 21 December 2011

Tackling Flash Player Security Issue

The flash player security settings is a headache for many developers who do not want users of their products to go through the ordeal of having to play with the security settings to allow a SWF object to ''communicate with an internet location'' especially when they are accessing the object locally (on hard drive, pendrive or a CD-ROM). The message will read like Flash is having to do some potentially unsafe operation and something is trying to connect to an internet location bla bla...

Users will then either have to edit the security settings to make the location from where they are accessing the SWF (hard drive, pendrive or a CD-ROM) a trusted location, or to access the adobe site and to change the settings from the panel provided on the Adobe site. If the security settings are not edited then buttons or actionsripts might not be able to run thereby creating usability problems in the applications.

(http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html)

  

 If the product that is developed will later be hosted on the web, then users will not have the issue of trusted file settings. However if the product is to be deployed on CDROM and accessed via a browser (offline browsing) then it may experience issues.

We have found a more elegant solution than having the user to manually change settings. However we need to admit it is not the best one and not necessarily acceptable to everyone. It is rather strange. 

After searching a lot on the computer, we have that the Flash player has a folder on the computer where trusted file settings can be stored. If you go through to the 
c:\windows\system32 folder, there is a folder called Macromed and inside it a folder called Flash. This is the folder where the Flash player is installed. Now to make a particular location 'trusted' manually, there is a folder called FlashPlayerTrust in the folder Flash. If the folder does not exist create a folder called FlashPlayerTrust. Then insert a text file in that folder with the locations that you want to be termed as trusted. Let us assume that the file you create is named myTrust.txt and the content you want to trust is the whole of the C: drive, the file will contain only one line of text and it is 'c:'. This means all folders and subfolders in the c: drive will become trusted. Of course you can also specify only specific locations rather than the whole of a drive. To add other locations just press enter and write in the path in your text file. 

Now the issue is how to automate this process if you are packaging your product on a CD. The solution is to include the text file on your CD and write a batch file that will copy the text file (through an xcopy command for instance) from the CD to the  
 c:\windows\system32\macromed\flash\flashplayertrust folder when the CD is autorun. If you have a 64-bit windows 7 OS, you need copy to sysWOW64 folder instead of the system32 folder.

The problem that your batch file will now face is that you will get an access denied message because of permissions to write to the system32 folder. To achieve this, you will need use a professional  autorun software like autorunpro.exe and it will work fine.

Your autorun.inf file will be as follows:
---------------------------------------------------------------------------------------------------------
[Autorun]
; /s parameter no longer needed for version 1.2
open=AutorunPro.exe
[AutorunPro]
; Here are some sample uses for Autorunpro. It keeps processing Them in Run1..RunN order until it doesnt find one.
Run1=install.bat
-----------------------------------------------------------------------------------------------------------

Now create your file supposedly called trustfile.txt 
The problem now with XCOPY is that if the directory FlashPlayerTrust does not exist, it will prompt the user whether it is a directory or a file. We do not want this to happen as we want the process to be as smooth as possible for the end user.

There is a trick to that. We use the parameter /I /Y but this will only work if there is more than 1 file being copied. 

So we create another file called trustfile2.txt.

When we use the XCOPY command, to specify both files we use the wildcard * after the word trust. So it will copy trustfile.txt and trustfile2.txt. In this way it will create the directory flashplayertrust without prompting the end-user to specify if its one or not.


Your batch file as follows (in this example we are using firefox portable):

install.bat 
----------------------------------------------------------------------------------------------------------
@echo off
xcopy /I /Y trust*.txt c:\windows\system32\macromed\flash\FlashPlayerTrust
xcopy /I /Y trust*.txt c:\windows\sysWOW64\macromed\flash\FlashPlayerTrust
cd firefoxportable
firefoxportable index.html
-----------------------------------------------------------------------------------------------------------

The solution has worked and the flash player security message does not appear.

1 comment:

  1. I find this blog post very interesting. It will help us to avoid any security breach. Security on the internet has become of major concern these days. I would thus like to contribute to it.

    Website has now started to use flash technologies to "track" users. From knowing their IP address (flash cookie) or even storing cookies (FLASH cookies). Flash cookies can't be deleted using the standard "delete cookies"/"delete privacy" options. So more and more effective ways are being developed to know ones personal identity.

    One way I found to delete those cookies i mentioned is to go to : http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html ...and delete all flash cookies.

    Regards,
    Fayyaaz

    ReplyDelete

Please abide by the netiquette of online commenting. Please be respectful and contribute to the debate through constructive criticism and intellectual arguments.

The polemic surrounding University Ranking of UniRank (4icu.org) : The case of UoM being 85th in the African Top 100

This is an interview I gave to the News on Sunday paper that appeared on 26th July 2020. 1. There is a controversy about the ranking of ...