what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

SugarCRM Community Edition 6.5.26 SQL Injection

SugarCRM Community Edition 6.5.26 SQL Injection
Posted Jan 24, 2018
Authored by Leon Juranic, DefenseCode

SugarCRM Community Edition versions 6.5.26 and below suffer from multiple remote SQL injection vulnerabilities.

tags | exploit, remote, vulnerability, sql injection
SHA-256 | bc4cc7bf63d53a27a1eb576d08fe29628ea8da32f5518c5c866e31065558a8a7

SugarCRM Community Edition 6.5.26 SQL Injection

Change Mirror Download

DefenseCode ThunderScan SAST Advisory
SugarCRM Community Edition Multiple SQL Injection Vulnerabilities


Advisory ID: DC-2018-01-011
Advisory Title: SugarCRM Community Edition Multiple SQL Injection
Vulnerabilities
Advisory URL: http://www.defensecode.com/advisories.php
Software: SugarCRM Community Edition
Language: PHP
Version: 6.5.26 and below
Vendor Status: Vendor contacted, fix expected
Release Date: 2018/01/23
Risk: Medium



1. General Overview
===================
During the security audit of SugarCRM Community Edition, multiple
SQL injection vulnerabilities were discovered using DefenseCode
ThunderScan application source code security analysis platform.

More information about ThunderScan is available at URL:
http://www.defensecode.com


2. Software Overview
====================
According to its developers, Sugar offers commercially licensed
software built using open source components. This provides users with
greater control, ultimate flexibility, and lower lifetime costs.
SugarCRM's open source Community Edition allows developers a free and
easy entry into learning how to customize and build upon the core
Sugar platform, but is not recommended for production use.

Homepage:
https://www.sugarcrm.com


3. Vulnerability Description
============================
During the security analysis, ThunderScan discovered multiple SQL
injection vulnerabilities in SugarCRM Community Edition.

3.1 SQL injection in parameter $_REQUEST['track']
Vulnerable Function: $db->query()
Vulnerable Variable: $_REQUEST['track']
File: SugarCE-Full-6.5.26\modules\Campaigns\Tracker.php
---------
if(empty($_REQUEST['track'])) {
$track = "";
} else {
$track = $_REQUEST['track'];
}
if(!empty($_REQUEST['identifier'])) {

$keys=log_campaign_activity($_REQUEST['identifier'],'link',true,$track);

}else{
//if this has no identifier, then this is a web/banner campaign
//pass in with id set to string 'BANNER'
$keys=log_campaign_activity('BANNER','link',true,$track);

}

$track = $db->quote($track);

if(preg_match('/^[0-9A-Za-z\-]*$/', $track))
{
$query = "SELECT tracker_url FROM campaign_trkrs WHERE id='$track'";
$res = $db->query($query);
---------
File: SugarCE-Full-6.5.26\modules\Campaigns\utils.php
---------
function log_campaign_activity($identifier, $activity, $update=true,
$clicked_url_key=null) {

$return_array = array();

$db = DBManagerFactory::getInstance();

//check to see if the identifier has been replaced with Banner string
if($identifier == 'BANNER' && isset($clicked_url_key) &&
!empty($clicked_url_key))
{
// create md5 encrypted string using the client ip, this will
be used for tracker id purposes
$enc_id = 'BNR'.md5($_SERVER['REMOTE_ADDR']);

//default the identifier to ip address
$identifier = $enc_id;

//if user has chosen to not use this mode of id generation,
then replace identifier with plain guid.
//difference is that guid will generate a new campaign log for
EACH CLICK!!
//encrypted generation will generate 1 campaign log and update
the hit counter for each click
if(isset($sugar_config['campaign_banner_id_generation']) &&
$sugar_config['campaign_banner_id_generation'] != 'md5'){
$identifier = create_guid();
}

//retrieve campaign log.
$trkr_query = "select * from campaign_log where
target_tracker_key='$identifier' and related_id = '$clicked_url_key'";
$current_trkr=$db->query($trkr_query);
$row=$db->fetchByAssoc($current_trkr);
---------

3.2 SQL injection in parameter $_REQUEST['default_currency_name']
Vulnerable Function: $this->db->query()
Vulnerable Variable: $_REQUEST['default_currency_name']
File:
SugarCE-Full-6.5.26\modules\Configurator\controller.php
---------
$currency = new Currency;

$currency->retrieve($currency->retrieve_id_by_name($_REQUEST['default_currency_name']));
---------
File: SugarCE-Full-6.5.26\modules\Currencies\Currency.php
---------
function retrieve_id_by_name($name) {
$query = "select id from currencies where name='$name' and
deleted=0;";
$result = $this->db->query($query);
if($result){
---------

3.3 SQL injection in parameter $_POST['duplicate']
Vulnerable Function: $db->query()
Vulnerable Variable: $_POST['duplicate']
File:
SugarCE-Full-6.5.26\modules\Contacts\ShowDuplicates.php
---------
$duplicates = $_POST['duplicate'];
$count = count($duplicates);
if ($count > 0)
{
$query .= "and (";
$first = true;
foreach ($duplicates as $duplicate_id)
{
if (!$first) $query .= ' OR ';
$first = false;
$query .= "id='$duplicate_id' ";
}
$query .= ')';
}

$duplicateContacts = array();

$db = DBManagerFactory::getInstance();
$result = $db->query($query);
---------

3.4 SQL injection in parameter $_REQUEST['mergecur']
Vulnerable Function: $this->db->query()
Vulnerable Variable: $_REQUEST['mergecur']
File: SugarCE-Full-6.5.26\modules\Currencies\index.php
---------
$currencies = $_REQUEST['mergecur'];

$opp = new Opportunity();
$opp->update_currency_id($currencies, $_REQUEST['mergeTo'] );
---------
File:
SugarCE-Full-6.5.26\modules\Opportunities\Opportunity.php
---------
function update_currency_id($fromid, $toid){
$idequals = '';

$currency = new Currency();
$currency->retrieve($toid);
foreach($fromid as $f){
if(!empty($idequals)){
$idequals .=' or ';
}
$idequals .= "currency_id='$f'";
}

if(!empty($idequals)){
$query = "select amount, id from opportunities where (".
$idequals. ") and deleted=0 and opportunities.sales_stage <> 'Closed
Won' AND opportunities.sales_stage <> 'Closed Lost';";
$result = $this->db->query($query);
while($row = $this->db->fetchByAssoc($result)){
---------

3.5 SQL injection in parameter $_POST['load_signed_id']
Vulnerable Function: $this->db->query()
Vulnerable Variable: $_POST['load_signed_id']
File: SugarCE-Full-6.5.26\modules\Documents\Document.php
---------
if ((isset($_POST['load_signed_id']) and
!empty($_POST['load_signed_id']))) {
$query="update linked_documents set deleted=1 where
id='".$_POST['load_signed_id']."'";
$this->db->query($query);
}
---------

4. Solution
===========
Vendor should resolve the security issues in next release. All users
are strongly advised to update SugarCRM Community Edition to the
latest available version as soon as the vendor releases an update that
fixes the vulnerability.


5. Credits
==========
Discovered by Leon Juranic using DefenseCode ThunderScan source code
security analyzer.


6. Disclosure Timeline
======================
2017/09/25 Vendor contacted
2017/09/26 Vendor contacted on more addresses
2017/09/28 Vendor responded. Fix expected.
2017/10/10 Vendor contacted
2018/01/23 Advisory released to the public


7. About DefenseCode
====================
DefenseCode L.L.C. delivers products and services designed to analyze
and test web, desktop and mobile applications for security
vulnerabilities.

DefenseCode ThunderScan is a SAST (Static Application Security
Testing, WhiteBox Testing) solution for performing extensive security
audits of application source code. ThunderScan SAST performs fast and
accurate analyses of large and complex source code projects delivering
precise results and low false positive rate.

DefenseCode WebScanner is a DAST (Dynamic Application Security
Testing, BlackBox Testing) solution for comprehensive security audits
of active web applications. WebScanner will test a website's security
by carrying out a large number of attacks using the most advanced
techniques, just as a real attacker would.

Subscribe for free software trial on our website
http://www.defensecode.com/ .

E-mail: defensecode[at]defensecode.com

Website: http://www.defensecode.com
Twitter: https://twitter.com/DefenseCode/



Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    0 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close