CVE-2016-3072: SQL Injection
Description of problem:
The foreman & Katello projects received an upstream notification about the discovery of an authenticated sql injection vulnerability within katello:
Dear Katello/Foreman Team,
During an internal test it was discovered that the scoped search parameters sortby and sortorder are vulnerable to an authenticated SQL injection.
If we access: https://x.x.x.x/katello/api/v2/organizations/1/syncplans/1/products?availablefor=syncplan&fullresult=true&page=1&search=&sortby=name&sortorder=ASC'
we will see the following error:
{"displayMessage":"PG::Error: ERROR: unterminated quoted string at or near \"', katelloproducts.id <http://katelloproducts.id> DESC\"\nLINE 1: ...nid IS NULL)) ORDER BY katelloproducts.name <http://katelloproducts.name> ASC', katello...\n ^\n: SELECT \"katelloproducts\". FROM \"katelloproducts\" WHERE \"katelloproducts\".\"id\" IN (SELECT DISTINCT \"katelloproducts\".\"id\" FROM \"katelloproducts\" WHERE \"katelloproducts\".\"organizationid\" = 1 AND (katelloproducts.id <http://katelloproducts.id> in (NULL) or katelloproducts.id <http://katelloproducts.id> in (6,5,4,2,3,1)) AND (syncplanid != '1' OR syncplanid IS NULL)) ORDER BY katelloproducts.name <http://katelloproducts.name> ASC', katelloproducts.id <http://katelloproducts.id> DESC","errors":["PG::Error: ERROR: unterminated quoted string at or near \"', katelloproducts.id <http://katelloproducts.id> DESC\"\nLINE 1: ...nid IS NULL)) ORDER BY katelloproducts.name <http://katelloproducts.name> ASC', katello...\n
The injection can be exploited as a blind time based injection.
Best Regards Oliver
External reference: The line of code in question here is: https://github.com/Katello/katello/blob/KATELLO-3.0/app/controllers/katello/api/v2/apicontroller.rb#L67
Other sources
Multiple SQL injection vulnerabilities in the scopedsearch function in app/controllers/katello/api/v2/apicontroller.rb in Katello allow remote authenticated users to execute arbitrary SQL commands via the (1) sortby or (2) sortorder parameter.
— MITRE
Affected Software
Remediation
Patch Available
Event History
Frequently Asked Questions
What is the severity of CVE-2016-3072?
CVE-2016-3072 is classified with a high severity due to the potential for unauthorized SQL command execution.
How do I fix CVE-2016-3072?
To fix CVE-2016-3072, update Katello to the latest version that addresses this vulnerability.
Who is affected by CVE-2016-3072?
CVE-2016-3072 affects remote authenticated users of the Katello system that utilize the scoped_search function.
What components are involved in CVE-2016-3072?
CVE-2016-3072 impacts the app/controllers/katello/api/v2/api_controller.rb file within the Katello application.
What types of injection does CVE-2016-3072 involve?
CVE-2016-3072 involves multiple SQL injection vulnerabilities through the sort_by and sort_order parameters.