Security software firm Symantec made a stunning revelation on Tuesday when they said third parties like advertisers had access to sensitive data of millions of Facebook users for years. It said Facebook, which was notified about this issue, has confirmed this leakage.

Certain app security flaws had accidentally given access to third parties to user data including account profiles, photographs and chat. The flaws also allowed third parties to post messages and mine personal information, the security firm said in a report.

The report says these third parties may not have cashed in on this access as they were unaware of it. Fortunately, these third-parties may not have realized their ability to access this information. We have reported this issue to Facebook, who has taken corrective action to help eliminate this issue, says the report.

According to the report, Facebook IFRAME applications inadvertently leaked access tokens to third parties like advertisers or analytic platforms. We estimate that as of April 2011, close to 100,000 applications were enabling this leakage. We estimate that over the years, hundreds of thousands of applications may have inadvertently leaked millions of access tokens to third parties, says the report.

It says access tokens are used by apps to perform certain actions on behalf of the user or to access the user’s profile. Each token or ‘spare key’ is associated with a select set of permissions, like reading your wall, accessing your friend’s profile, posting to your wall, etc.

According to the report, users can make sure they are not affected by access token leakage by changing passwords. Concerned Facebook users can change their Facebook passwords to invalidate leaked access tokens. Changing the password invalidates these tokens and is equivalent to “changing the lock” on your Facebook profile.