IPS Community Suite <= 4.5.4 (Downloads REST API) SQL Injection Vulnerability

https://invisioncommunity.com

• Affected Versions:

Version 4.5.4 and prior versions.

• Vulnerability Description:

The vulnerability is located within the /applications/downloads/api/files.php script, specifically into the GETindex() method:

48public function GETindex()
49{
50    /* Where clause */
51    $where = array();
52    $sortBy = NULL;
53 
54    /* Sort by popular files */
55    if( \IPS\Request::i()->sortBy == 'popular' )
56    {
57        \IPS\Request::i()->sortDir = \IPS\Request::i()->sortDir ?: 'ASC';
58        $sortBy = 'file_rating ' . \IPS\Request::i()->sortDir . ', file_reviews';
59        $where = array( array( 'file_rating>?', 0 ) );
60    }
61 
62    /* Return */
63    return $this->_list( $where, 'categories', FALSE, $sortBy );
64}

User input passed through the “sortDir” GET parameter (when “sortBy” is set to “popular”) is not properly sanitized before being used to construct an SQL query at line 58. This can be exploited by remote attackers to e.g. read sensitive data from the database through error-based SQL Injection attacks. Successful exploitation of this vulnerability requires an API key with permissions to access the Downloads Files API.

• Proof of Concept:

https://karmainsecurity.com/pocs/CVE-2021-3025

• Solution:

Apply the vendor patch or upgrade to version 4.5.4.2 or later.

• Disclosure Timeline:

[19/12/2020] – Vendor notified through HackerOne

[27/12/2020] – Vendor released a targeted patch

[05/01/2021] – Vendor released version 4.5.4.2

[05/01/2021] – CVE number assigned

[06/01/2021] – Public disclosure

• CVE Reference:

The Common Vulnerabilities and Exposures project (cve.mitre.org) has assigned the name CVE-2021-3025 to this vulnerability.

• Credits:

Vulnerability discovered by Egidio Romano.