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.

install/download_patches.php (2 issues)

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
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
/*********************************************************************************
4
 * SugarCRM Community Edition is a customer relationship management program developed by
5
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6
7
 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
8
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
9
 *
10
 * This program is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU Affero General Public License version 3 as published by the
12
 * Free Software Foundation with the addition of the following permission added
13
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
14
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
15
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
16
 *
17
 * This program is distributed in the hope that it will be useful, but WITHOUT
18
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
20
 * details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License along with
23
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
24
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25
 * 02110-1301 USA.
26
 *
27
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
28
 * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
29
 *
30
 * The interactive user interfaces in modified source and object code versions
31
 * of this program must display Appropriate Legal Notices, as required under
32
 * Section 5 of the GNU Affero General Public License version 3.
33
 *
34
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
35
 * these Appropriate Legal Notices must retain the display of the "Powered by
36
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
37
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
38
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39
 ********************************************************************************/
40
41
global $sugar_version, $js_custom_version;
42
require_once('ModuleInstall/PackageManager/PackageManagerDisplay.php');
43
if( !isset( $install_script ) || !$install_script ){
44
    die($mod_strings['ERR_NO_DIRECT_SCRIPT']);
45
}
46
///////////////////////////////////////////////////////////////////////////////
47
////    PREFILL $sugar_config VARS
48
if(empty($sugar_config['upload_dir'])) {
49
    $sugar_config['upload_dir'] = 'upload/';
50
}
51
if(empty($sugar_config['upload_maxsize'])) {
52
    $sugar_config['upload_maxsize'] = 8192000;
53
}
54
if(empty($sugar_config['upload_badext'])) {
55
    $sugar_config['upload_badext'] = array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm');
56
}
57
////    END PREFILL $sugar_config VARS
58
///////////////////////////////////////////////////////////////////////////////
59
require_once('include/utils/zip_utils.php');
60
61
require_once('include/upload_file.php');
62
63
64
///////////////////////////////////////////////////////////////////////////////
65
////    PREP VARS FOR LANG PACK
66
    $base_upgrade_dir       = "upload://upgrades";
67
    $base_tmp_upgrade_dir   = sugar_cached("upgrades/temp");
68
///////////////////////////////////////////////////////////////////////////////
69
70
///////////////////////////////////////////////////////////////////////////////
71
////    HANDLE FILE UPLOAD AND PROCESSING
72
$errors = array();
73
$uploadResult = '';
74
if(isset($_REQUEST['languagePackAction']) && !empty($_REQUEST['languagePackAction'])) {
75
    switch($_REQUEST['languagePackAction']) {
76
        case 'upload':
77
        $perform = false;
78
        $tempFile = '';
79
        if(isset($_REQUEST['release_id']) && $_REQUEST['release_id'] != ""){
80
            require_once('ModuleInstall/PackageManager/PackageManager.php');
81
            $pm = new PackageManager();
82
            $tempFile = $pm->download('3', '3', $_REQUEST['release_id'], $sugar_config['upload_dir']);
0 ignored issues
show
The call to PackageManager::download() has too many arguments starting with $sugar_config['upload_dir'].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
83
            $perform = true;
84
            //$base_filename = urldecode($tempFile);
85
        }else{
86
            $file = new UploadFile('language_pack');
87
            if($file->confirm_upload())
88
            $perform = true;
89
             if(strpos($file->mime_type, 'zip') !== false) { // only .zip files
90
                    if(langPackFinalMove($file)) {
91
                        $perform = true;
92
                    }
93
                    else {
94
                        $errors[] = $mod_strings['ERR_LANG_UPLOAD_3'];
95
                    }
96
                } else {
97
                    $errors[] = $mod_strings['ERR_LANG_UPLOAD_2'];
98
                }
99
        }
100
101
102
            if($perform) { // check for a real file
103
                        $uploadResult = $mod_strings['LBL_LANG_SUCCESS'];
104
                        $result = langPackUnpack('patch', $tempFile);
105
            } else {
106
                $errors[] = $mod_strings['ERR_LANG_UPLOAD_1'];
107
            }
108
109
            if(count($errors) > 0) {
110
                foreach($errors as $error) {
111
                    $uploadResult .= $error."<br />";
112
                }
113
            }
114
            break; // end 'validate'
115
        case 'commit':
116
            $sugar_config = commitPatch();
0 ignored issues
show
Are you sure the assignment to $sugar_config is correct as commitPatch() seems to always returns null.
Loading history...
117
            break;
118
        case 'remove':
119
            removeLanguagePack();
120
            break;
121
        default:
122
            break;
123
    }
124
}
125
////    END HANDLE FILE UPLOAD AND PROCESSING
126
///////////////////////////////////////////////////////////////////////////////
127
128
129
///////////////////////////////////////////////////////////////////////////////
130
////    PRELOAD DISPLAY DATA
131
$upload_max_filesize = ini_get('upload_max_filesize');
132
$upload_max_filesize_bytes = return_bytes($upload_max_filesize);
133
$fileMaxSize ='';
134
if(!defined('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')){
135
    define('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES', 6 * 1024 * 1024);
136
}
137
if($upload_max_filesize_bytes < constant('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')) {
138
    $GLOBALS['log']->debug("detected upload_max_filesize: $upload_max_filesize");
139
    $fileMaxSize = '<p class="error">'.$mod_strings['ERR_UPLOAD_MAX_FILESIZE']."</p>\n";
140
}
141
$availablePatches = getLangPacks(false, array('patch'), $mod_strings['LBL_PATCH_READY']);
142
143
$errs = '';
144
if(isset($validation_errors)) {
145
    if(count($validation_errors) > 0) {
146
        $errs  = '<div id="errorMsgs">';
147
        $errs .= "<p>{$mod_strings['LBL_SYSOPTS_ERRS_TITLE']}</p>";
148
        $errs .= '<ul>';
149
150
        foreach($validation_errors as $error) {
151
            $errs .= '<li>' . $error . '</li>';
152
        }
153
154
        $errs .= '</ul>';
155
        $errs .= '</div>';
156
    }
157
}
158
159
////    PRELOAD DISPLAY DATA
160
///////////////////////////////////////////////////////////////////////////////
161
162
163
///////////////////////////////////////////////////////////////////////////////
164
////    BEING PAGE OUTPUT
165
$disabled = "";
166
$result = "";
167
$langHeader = get_language_header();
168
$out =<<<EOQ
169
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
170
<html {$langHeader}>
171
<head>
172
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
173
   <meta http-equiv="Content-Script-Type" content="text/javascript">
174
   <meta http-equiv="Content-Style-Type" content="text/css">
175
   <title>{$mod_strings['LBL_WIZARD_TITLE']} {$next_step}</title>
176
   <link REL="SHORTCUT ICON" HREF="include/images/sugar_icon.ico">
177
   <link rel="stylesheet" href="install/install.css" type="text/css">
178
   <script type="text/javascript" src="install/installCommon.js"></script>
179
   <link rel="stylesheet" type="text/css" media="all" href="jscalendar/calendar-win2k-cold-1.css?s={$sugar_version}&c={$js_custom_version}">
180
   <script>jscal_today = 1161698116000; if(typeof app_strings == "undefined") app_strings = new Array();</script>
181
   <script type="text/javascript" src="cache/include/javascript/sugar_grp1.js?s={$sugar_version}&c={$js_custom_version}"></script>
182
   <script type="text/javascript" src="cache/include/javascript/sugar_grp1_yui.js?s={$sugar_version}&c={$js_custom_version}"></script>
183
   <script type="text/javascript">
184
    <!--
185
    if ( YAHOO.env.ua )
186
        UA = YAHOO.env.ua;
187
    -->
188
    </script>
189
</head>
190
191
<body onLoad="document.getElementById('button_next2').focus();">
192
{$fileMaxSize}
193
  <table cellspacing="0" width="100%" cellpadding="0" border="0" align="center" class="shell">
194
      <tr><td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr>
195
    <tr>
196
      <th width="500">
197
		<p>
198
		<img src="{$sugar_md}" alt="SugarCRM" border="0">
199
		</p>
200
      {$mod_strings['LBL_PATCHES_TITLE']}</th>
201
      <th width="200" style="text-align: right;">&nbsp;
202
        </th>
203
    </tr>
204
205
    <tr>
206
        <td colspan="2">
207
            <p>{$mod_strings['LBL_PATCH_1']}</p>
208
            <table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" class="StyleDottedHr">
209
                <tr>
210
                    <th colspan="2" align="left">{$mod_strings['LBL_PATCH_TITLE']}</th>
211
                </tr>
212
                <tr>
213
                    <td colspan="2">
214
EOQ;
215
$form =<<<EOQ1
216
                    <form name="the_form" enctype="multipart/form-data"
217
                        action="install.php" method="post">
218
                        <input type="hidden" name="current_step" value="{$next_step}">
219
                        <input type="hidden" name="goto" value="{$mod_strings['LBL_CHECKSYS_RECHECK']}">
220
                        <input type="hidden" name="languagePackAction" value="upload">
221
222
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
223
                        <tr>
224
                            <td>
225
                                <table width="450" border="0" cellspacing="0" cellpadding="0">
226
                                    <tr>
227
										<td colspan='2'>
228
											{$mod_strings['LBL_PATCH_UPLOAD']}:
229
										</td>
230
									</tr><tr>
231
                                        <td>
232
233
                                            <input type="file" name="language_pack" size="40" />
234
                                        </td>
235
                                        <td valign="bottom">
236
                                            <input class='button' type=button value="{$mod_strings['LBL_LANG_BUTTON_UPLOAD']}"  onClick="document.the_form.language_pack_escaped.value = escape( document.the_form.language_pack.value ); document.the_form.submit();"/>
237
                                            <input type=hidden name="language_pack_escaped" value="" />
238
                                        </td>
239
                                    </tr>
240
                                </table>
241
                            </td>
242
                        </tr>
243
                        <tr>
244
                            <td>
245
                                {$uploadResult}
246
                            </td>
247
                        </tr>
248
                    </table>
249
                    </form>
250
EOQ1;
251
$out1 =<<<EOQ2
252
                  </td>
253
                </tr>
254
                <tr>
255
                    <td colspan=2>
256
                        {$result}
257
                    </td>
258
                </tr>
259
260
                <!--// Available Upgrades //-->
261
                <tr>
262
                    <td align="left" colspan="2">
263
                        <hr>
264
                        <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
265
                            {$availablePatches}
266
                        </table>
267
                    </td>
268
                </tr>
269
                 <tr>
270
                    <td align="right" colspan="2">
271
                        <hr>
272
                        <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
273
                        <tr><td><form action='install.php' method='POST'>
274
                                <input type='hidden' name='current_step' value="{$next_step}">
275
                                <input type='hidden' name='goto' value="{$mod_strings['LBL_CHECKSYS_RECHECK']}">
276
                                <input type='hidden' name='languagePackAction' value='commit'>
277
                                <input type='submit' value="{$mod_strings['LBL_INSTALL']}" class='button'>
278
                                </form>
279
                        </td></tr>
280
                        </table>
281
                    </td>
282
                </tr>
283
                <tr>
284
                    <td align="right" colspan="2">
285
                        <hr>
286
                        <form name="the_form1" action="install.php" method="post">
287
                        <input type="hidden" name="current_step" value="{$next_step}">
288
                        <table cellspacing="0" cellpadding="0" border="0" class="stdTable">
289
                            <tr>
290
                                <td>
291
292
                                </td>
293
                                <td>
294
                                    <input class="button" type="submit" name="goto" value="{$mod_strings['LBL_NEXT']}" id="button_next2" {$disabled} />
295
                                </td>
296
                            </tr>
297
                        </table>
298
                        </form>
299
                    </td>
300
                </tr>
301
            </table>
302
        </td>
303
    </tr>
304
</table>
305
306
</body>
307
</html>
308
EOQ2;
309
$hidden_fields =  "<input type=\"hidden\" name=\"current_step\" value=\"{$next_step}\">";
310
$hidden_fields .=  "<input type=\"hidden\" name=\"goto\" value=\"{$mod_strings['LBL_CHECKSYS_RECHECK']}\">";
311
$hidden_fields .=  "<input type=\"hidden\" name=\"languagePackAction\" value=\"upload\">";
312
$form2 = PackageManagerDisplay::buildPatchDisplay($form, $hidden_fields, 'install.php', array('patch'));
313
314
echo $out.$form2.$out1;
315
316
//unlinkTempFiles('','');
317
////    END PAGEOUTPUT
318
///////////////////////////////////////////////////////////////////////////////
319
?>
320