Code
Advisories

MSA110615-3

Concrete5 <= 5.7.3.1 SQL Injection

Tested Versions:

Concrete5 version 5.7.3.1.

Minded Security ReferenceID:

MSA110615-3

CVE ID:

CVE-2015-4724

Credits:

Discovered by
Egidio Romano of Minded Security
egidio.romano [_at_] mindedsecurity.com

Severity:

Medium

Solution:

Update to version 5.7.4.1 or later.

Other references:

https://hackerone.com/reports/59664
http://www.slideshare.net/mindedsecurity/concrete5-sql-injection-advisory

Summary

Minded Security Consultants discovered during a Secure Code Review activity that Concrete5 <= 5.7.3.1 is vulnerable to a SQL Injection.

Description

The vulnerable code is located within the Access::buildAssignmentFilterString() method, which uses its $accessType parameter to construct a SQL query without a proper validation:

File: /concrete/src/Permission/Access/Access.php (lines 168-183):

protected function buildAssignmentFilterString($accessType, $filterEntities)
{
$peIDs = '';
$filters = array();
if (count($filterEntities) > 0) {
foreach ($filterEntities as $ent) {
$filters[] = $ent->getAccessEntityID();
}
$peIDs .= 'and peID in (' . implode($filters, ',') . ')';
}
if ($accessType == 0) {
$accessType = '';
} else {
$accessType = ' and accessType = ' . $accessType;
}
return $peIDs . ' ' . $accessType . ' order by accessType desc'; // we order desc
so that excludes come last (-1)
}

 

This method is being called by the Access::getAccessListItems(), and this one is called by the following script passing input coming from the “listItem” request parameter as the $accessType parameter to that method:

File: /concrete/tools/permissions/categories/page.php (lines 192-212):

if ($_REQUEST['task'] == 'bulk_remove_access' && Loader::helper('validation/token')-
>validate('bulk_remove_access')) {
$pkID = $_REQUEST['pkID'];
$pk = PermissionKey::getByID($pkID);
$u = new User();
$deferred = false;
foreach($pages as $c) {
$pk->setPermissionObject($c);
$pa = $pk->getPermissionAccessObject();
$matches = array();
if (is_object($pa)) {
foreach($_REQUEST['listItem'] as $li) {
$lii = explode(':', $li);
$peID = $lii[0];
$accessType = $lii[1];
$pdID = $lii[2];
$listItems = $pa->getAccessListItems($accessType);

 

When the “task” request parameter is set to “bulk_remove_access”, input coming from the “listItem” request parameter is passed directly to the Access::getAccessListItems() method without a proper validation. This can be exploited to inject and execute arbitrary SQL commands.

Disclosure Timeline

[05/05/2015] – Vulnerability details sent through HackerOne
[05/08/2015] – Vendor said a patch has been committed and will be available in the next version
[05/12/2015] – Version 5.7.4.1 released along with the patch for this vulnerability
[06/11/2015] – Vulnerability publicly disclosed on HackerOne
[06/11/2015] – CVE number requested
[06/23/2015] – CVE number assigned

Disclaimer

The information within this paper may change without notice. Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties with regard to this information.

In no event shall the author be liable for any damages whatsoever arising out of or in connection with the use or spread of this information.

Any use of this information is at the user’s own risk. Permission is hereby granted for the redistribution of this Alert electronically. It is not to be edited in any way without express consent of Minded Security Research Lab. If you wish to reprint the whole or any part of this Alert in any other medium excluding electronic medium, please e-mail research_at_mindedsecurity.com for permission.

Automation

Implement the right DevSecOps automation and Continuous Web Application Scanning for your needs.

consulting minded security

Consulting

We are a Consultancy Company focused in supporting Companies to develop secure products.

testing minded security

Testing

We performs software security analysis in white box mode and black box mode.

training minded security

Training

Training and awareness in software security is critical for information security.