Platform Security
From Facebook Developer Wiki
Facebook Platform allows users to entrust their data on Facebook to your application so they can interact with their friends in new and interesting ways. By using Facebook Platform, you accept the Statement of Rights and Responsibilities, which include the responsibility to be a secure host for our users’ data. We provide the resources below to help you secure your application from attacks. If Facebook is notified of potential security risks in your application, we reserve the right to temporarily disable your application until the risk is mitigated to ensure that users are protected.
Facebook Platform Security Features
FBML
Facebook Markup Language (FBML) enables you to build full Facebook Platform applications that deeply integrate into a user's Facebook experience. You can hook into several Facebook integration points, including the profile, Facebook canvas, News Feed and Wall. FBML is an evolved subset of HTML with some dangerous elements removed, and others which have been added that are specific to Facebook.
FBJS
FBJS is Facebook's solution for developers who want to use JavaScript in their Facebook applications. We built FBJS to empower developers with all the functionality they need, and to protect our users' privacy at the same time.
Facebook Connect
Facebook Connect is a powerful set of APIs for developers that lets users bring their identity and connections everywhere around the Web. Applications that authenticate with Facebook Connect do not need to store passwords, and can develop with the social graph.
Phishing/Spam/Etc.
We fight spam, phishing, malware, and any other attacks aggressively on Facebook. Read the following Facebook blog posts for more information.
- Fighting the Battle Against Money Scams
- Protect Yourself Against Phishing
- Blocked Content and Facebook Security
- New Tools to Secure a Compromised Account
Common Vulnerabilities
As a minimum requirement, all developers working on a Facebook application should become intimately familiar with the OWASP Top Ten list. While not an exhaustive list, these vulnerabilities represent the most serious security issues that may impact your Facebook application.
Cross Site Scripting (XSS)
XSS flaws occur whenever an application takes user-supplied data and sends it to a Web browser without first validating or encoding that content. XSS allows attackers to execute scripts in the victim's browser, which can hijack user sessions, deface websites, possibly introduce worms, etc.
- OWASP Top 10 2007: Cross Site Scripting
- ha.ckers XSS (Cross Site Scripting) Cheat Sheet
- Cross-site scripting wikipedia article
- CGI Security XSS FAQ
Injection Flaws
Injection flaws, particularly SQL injection, are common in Web applications. Injection occurs when user-supplied data is sent to an interpreter as part of a command or query. The attacker's hostile data tricks the interpreter into executing unintended commands or changing data.
- OWASP Top 10 2007: Injection Flaws
- ha.ckers SQL Injection Cheat Sheet
- SQL Injection wikipedia article
- Code Injection wikipedia article
Malicious File Execution
Code vulnerable to remote file inclusion (RFI) allows attackers to include hostile code and data, resulting in devastating attacks, such as total server compromise. Malicious file execution attacks affect PHP, XML and any framework which accepts filenames or files from users.
- OWASP Top 10 2007: Malicious File Execution
- Code Injection wikipedia article
- Remote File Inclusion wikipedia article
Insecure Direct Object Reference
A direct object reference occurs when a developer exposes a reference to an internal implementation object, such as a file, directory, database record, or key, as a URL or form parameter. Attackers can manipulate those references to access other objects without authorization.
Cross Site Request Forgery (CSRF)
A CSRF attack forces a logged-on victim's browser to send a pre-authenticated request to a vulnerable web application, which then forces the victim's browser to perform a hostile action to the benefit of the attacker. CSRF can be as powerful as the web application that it attacks.
Information Leakage and Improper Error Handling
Applications can unintentionally leak information about their configuration, internal workings, or violate privacy through a variety of application problems. Attackers use this weakness to steal sensitive data, or conduct more serious attacks.
Broken Authentication and Session Management
Account credentials and session keys are often not properly protected. Attackers compromise passwords, keys, or authentication tokens to assume other users' identities.
Insecure Cryptographic Storage
Web applications rarely use cryptographic functions properly to protect data and credentials. Attackers use weakly protected data to conduct identity theft and other crimes, such as credit card fraud.
Insecure Communications
Applications frequently fail to encrypt network traffic when it is necessary to protect sensitive communications.
- OWASP Top 10 2007: Insecure Communications
- Managing Microsoft Certificate Services and SSL
- Apache SSL/TLS Encryption
Failure to Restrict URL Access
Frequently, an application only protects sensitive functionality by preventing the display of links or URLs to unauthorized users. Attackers can use this weakness to access and perform unauthorized operations by accessing those URLs directly.
Secure Development Resources and Guides
Facebook also strongly recommends that developers take the time to educate themselves further on secure Web applications. The following guides are excellent resources to get you started.
- OWASP Guide
- MSDN: Improving Web Application Security: Threats and Countermeasures
- Microsoft Security Development Lifecycle (SDL) - Version 4.1a
- MSDN: SDL Embraces The Web
- MSDN: Streamline Security Practices For Agile Development
Administration and Maintenance
Security is only as strong as the weakest link, and the weakest link in your application might be the software supporting it. Proper administration and maintenance of your server(s), network infrastructure, and third-party software programs is critical to the security of your application.
Change Default Passwords
Many software packages ship with default passwords that are easily discovered by attackers. Ensure that all passwords are changed immediately after installation.
Use Strong Passwords
- Passwords should include a combination of numbers, symbols, upper- and lowercase characters
- Passwords should be at least 10 characters in length
- Prohibit passwords based on dictionary words and repeated or sequential characters
Keep Software Up To Date
Security vulnerabilities are discovered in applications on a regular basis. As patches for these security vulnerabilities are released, it is critical that you install these patches in a timely manner. This includes everything running on the same server as your application: the Operating System (Windows, Linux, etc.), Web server (Apache, IIS, etc.), and any third-party software (blogging software, forum software, etc.).
Isolate Services
You can greatly minimize the attack surface of your application by isolating it from other services. For example, if you also also operate a website and a blog, it is recommended that you run your Facebook application on a separate physical server.
Remove or Disable Unnecessary Services
Many unnecessary services may be installed and enabled by default. You should disable any services that are not actively used. For example, if your Web server enables FTP by default and it is using it, you should disable the feature.
