Facebook Holi Greeting Cards - SQL Injection Vulnerability

Type vulnerlab
Reporter Vulnerability Research Laboratory - Benjamin Kunz Mejri (Rem0ve)
Modified 2011-11-01T00:00:00


                                            Document Title:
Facebook Holi Greeting Cards - SQL Injection Vulnerability

References (Source):
Facebook 3rd Party Application - Holi Greeting Cards 2011/Q2

Release Date:

Vulnerability Laboratory ID (VL-ID):

Product & Service Introduction:
The application is currently included and viewable by all facebook users.
The service is an external 3rd party application sponsored by the Facebook Holi Greeting Cards.

(Copy from the Vendors Homepage: http://apps.facebook.com/holigreetingcards/)

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:
A Vulnerability-Lab researcher discovered a remote SQL Injection vulnerability on the 3rd party web application - Holi Greeting Cards (apps.facebook.com).

Vulnerability Disclosure Timeline:
2011-09-21:	Vendor Notification
2011-09-21:	Vendor Response/Feedback
2011-10-31:	Public or Non-Public Disclosure

Discovery Status:

Affected Product(s):

Exploitation Technique:

Severity Level:

Technical Details & Description:
A SQL Injection vulnerability is detected on the Holi Greeting Cards 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): 
			                           [+] Holi Greeting Cards - Facebook 3rd Party Application

Vulnerable File(s): 
			                           [+] invite.php; sent.php; received.php

Affected Application: 
			                           [+] http://apps.facebook.com/holigreetingcards/

--- SQL Error Logs ---
Invalid query -- SELECT COUNT(*) FROM appusers WHERE userid = -- 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 `` at line 1
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /home/develope/public_html/holigreetingcards/code.php on line 12

Warning: file_get_contents(https://graph.facebook.com/oauth/access_token?client_id=117795584965727&redirect_uri=http%3A
[function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/develope/public_html/
holigreetingcards/code.php on line 12
Invalid query -- SELECT COUNT(*) FROM gifts_log WHERE giftto = -- 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 `` at line 1


Proof of Concept (PoC):
The vulnerability can be exploited be remote attackers. For demonstration or reproduce ...

URL:	apps.facebook.com
Path:	/holigreetingcards/
File:	invite.php



Solution - Fix & Patch:
Use the prepared statement class to fix the sql injection vulnerability & filter sql error requests.
Set error(0) to prevent against information disclosure via exceptions or error reports.

Security Risk:
The security risk of the application 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