Issues (4069)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

include/utils/zip_utils.php (4 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*********************************************************************************
3
 * SugarCRM Community Edition is a customer relationship management program developed by
4
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
5
6
 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
7
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
8
 *
9
 * This program is free software; you can redistribute it and/or modify it under
10
 * the terms of the GNU Affero General Public License version 3 as published by the
11
 * Free Software Foundation with the addition of the following permission added
12
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
13
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
14
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
15
 *
16
 * This program is distributed in the hope that it will be useful, but WITHOUT
17
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
19
 * details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License along with
22
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
23
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24
 * 02110-1301 USA.
25
 *
26
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
27
 * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
28
 *
29
 * The interactive user interfaces in modified source and object code versions
30
 * of this program must display Appropriate Legal Notices, as required under
31
 * Section 5 of the GNU Affero General Public License version 3.
32
 *
33
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
34
 * these Appropriate Legal Notices must retain the display of the "Powered by
35
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
36
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
37
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
38
 ********************************************************************************/
39
40
41
42
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
43
if(class_exists("ZipArchive")) {
44
    require_once 'include/utils/php_zip_utils.php';
45
    return;
46
} else {
47
require_once('include/pclzip/pclzip.lib.php');
48
if ( isset($GLOBALS['log']) && class_implements($GLOBALS['log'],'LoggerTemplate') ) {
49
    $GLOBALS['log']->deprecated('Use of PCLZip has been deprecated. Please enable the zip extension in your PHP install ( see http://www.php.net/manual/en/zip.installation.php for more details ).');
50
}
51
function unzip( $zip_archive, $zip_dir, $forceOverwrite = false ){
0 ignored issues
show
The function unzip() has been defined more than once; this definition is ignored, only the first definition in include/utils/php_zip_utils.php (L44-47) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
52
    if( !is_dir( $zip_dir ) ){
53
        if (!defined('SUITE_PHPUNIT_RUNNER'))
54
            die( "Specified directory '$zip_dir' for zip file '$zip_archive' extraction does not exist." );
55
        return false;
56
    }
57
58
    $archive = new PclZip( $zip_archive );
59
60
    if ( $forceOverwrite ) {
61
        if( $archive->extract( PCLZIP_OPT_PATH, $zip_dir, PCLZIP_OPT_REPLACE_NEWER ) == 0 ){
62
            if (!defined('SUITE_PHPUNIT_RUNNER'))
63
                die( "Error: " . $archive->errorInfo(true) );
64
            return false;
65
        }
66
    }
67
    else {
68
        if( $archive->extract( PCLZIP_OPT_PATH, $zip_dir ) == 0 ){
69
            if (!defined('SUITE_PHPUNIT_RUNNER'))
70
                die( "Error: " . $archive->errorInfo(true) );
71
            return false;
72
        }
73
    }
74
}
75
76
function unzip_file( $zip_archive, $archive_file, $to_dir, $forceOverwrite = false ){
0 ignored issues
show
The function unzip_file() has been defined more than once; this definition is ignored, only the first definition in include/utils/php_zip_utils.php (L49-92) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
77
    if( !is_dir( $to_dir ) ){
78
        if (!defined('SUITE_PHPUNIT_RUNNER'))
79
            die( "Specified directory '$to_dir' for zip file '$zip_archive' extraction does not exist." );
80
        return false;
81
    }
82
83
    $archive = new PclZip($zip_archive);
84
    if ( $forceOverwrite ) {
85
        if( $archive->extract(  PCLZIP_OPT_BY_NAME, $archive_file,
86
                                PCLZIP_OPT_PATH,    $to_dir,
87
                                PCLZIP_OPT_REPLACE_NEWER ) == 0 ){
88
            if (!defined('SUITE_PHPUNIT_RUNNER'))
89
                die( "Error: " . $archive->errorInfo(true) );
90
            return false;
91
        }
92
    }
93
    else {
94
        if( $archive->extract(  PCLZIP_OPT_BY_NAME, $archive_file,
95
                                PCLZIP_OPT_PATH,    $to_dir        ) == 0 ){
96
            if (!defined('SUITE_PHPUNIT_RUNNER'))
97
                die( "Error: " . $archive->errorInfo(true) );
98
            return false;
99
        }
100
    }
101
}
102
103
function zip_dir( $zip_dir, $zip_archive ){
0 ignored issues
show
The function zip_dir() has been defined more than once; this definition is ignored, only the first definition in include/utils/php_zip_utils.php (L94-121) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
104
    $archive    = new PclZip( $zip_archive );
105
    $v_list     = $archive->create( $zip_dir );
106
    if( $v_list == 0 ){
107
        if (!defined('SUITE_PHPUNIT_RUNNER'))
108
            die( "Error: " . $archive->errorInfo(true) );
109
        return false;
110
    }
111
}
112
113
/**
114
 * Zip list of files, optionally stripping prefix
115
 * @param string $zip_file
116
 * @param array $file_list
117
 * @param string $prefix Regular expression for the prefix to strip
118
 */
119
function zip_files_list($zip_file, $file_list, $prefix = '')
0 ignored issues
show
The function zip_files_list() has been defined more than once; this definition is ignored, only the first definition in include/utils/php_zip_utils.php (L130-148) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
120
{
121
    $archive    = new PclZip( $zip_file );
122
    foreach($file_list as $file) {
123
        if(!empty($prefix) && preg_match($prefix, $file, $matches) > 0) {
124
            $remove_path = $matches[0];
125
            $archive->add($file, PCLZIP_OPT_REMOVE_PATH, $prefix);
126
        } else {
127
            $archive->add($file);
128
        }
129
    }
130
    return true;
131
}
132
133
} // if (ZipArchive exists)