Issues (1798)

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.

console.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
/**
3
 * @author Bart Visscher <[email protected]>
4
 * @author Joas Schilling <[email protected]>
5
 * @author Lukas Reschke <[email protected]>
6
 * @author Morris Jobke <[email protected]>
7
 * @author Patrick Paysant <[email protected]>
8
 * @author Philipp Schaffrath <[email protected]>
9
 * @author RealRancor <[email protected]>
10
 * @author Thomas Müller <[email protected]>
11
 * @author Victor Dubiniuk <[email protected]>
12
 *
13
 * @copyright Copyright (c) 2018, ownCloud GmbH
14
 * @license AGPL-3.0
15
 *
16
 * This code is free software: you can redistribute it and/or modify
17
 * it under the terms of the GNU Affero General Public License, version 3,
18
 * as published by the Free Software Foundation.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
 * GNU Affero General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU Affero General Public License, version 3,
26
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
27
 *
28
 */
29
30
use OC\Console\Application;
31
use Symfony\Component\Console\Input\ArgvInput;
32
use Symfony\Component\Console\Output\ConsoleOutput;
33
34
\define('OC_CONSOLE', 1);
35
36
// Show warning if a PHP version below 7.1.0 is used, this has to happen here
37
// because base.php will already use 7.1 syntax.
38 View Code Duplication
if (\version_compare(PHP_VERSION, '7.1.0') === -1) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
	echo 'This version of ownCloud requires at least PHP 7.1.0'.PHP_EOL;
40
	echo 'You are currently running PHP ' . PHP_VERSION . '. Please update your PHP version.'.PHP_EOL;
41
	exit(1);
42
}
43
44
// Show warning if PHP 8 is used as ownCloud is not compatible with PHP 7.4
45 View Code Duplication
if (\version_compare(PHP_VERSION, '7.4.0alpha1') !== -1) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
	echo 'This version of ownCloud is not compatible with PHP 7.4' . PHP_EOL;
47
	echo 'You are currently running PHP ' . PHP_VERSION . '.' . PHP_EOL;
48
	exit(1);
49
}
50
51
// running oC on Windows is unsupported since 8.1, this has to happen here because
52
// is seems that the autoloader on Windows fails later and just throws an exception.
53
if (\stripos(PHP_OS, 'WIN') === 0) {
54
	echo 'ownCloud Server does not support Microsoft Windows.';
55
	exit(1);
56
}
57
58
function exceptionHandler($exception) {
59
	echo 'An unhandled exception has been thrown:' . PHP_EOL;
60
	echo $exception;
61
	exit(1);
62
}
63
try {
64
	require_once __DIR__ . '/lib/base.php';
65
66
	// set to run indefinitely if needed
67
	\set_time_limit(0);
68
69
	if (!OC::$CLI) {
70
		echo 'This script can be run from the command line only' . PHP_EOL;
71
		exit(1);
72
	}
73
74
	\set_exception_handler('exceptionHandler');
75
76
	if (!\function_exists('posix_getuid')) {
77
		echo 'The posix extensions are required - see http://php.net/manual/en/book.posix.php' . PHP_EOL;
78
		exit(1);
79
	}
80
	$user = \posix_getpwuid(\posix_getuid());
81
	$configUser = \posix_getpwuid(\fileowner(OC::$configDir . 'config.php'));
82
	if ($user['name'] !== $configUser['name']) {
83
		echo 'Console has to be executed with the user that owns the file config/config.php' . PHP_EOL;
84
		echo 'Current user: ' . $user['name'] . PHP_EOL;
85
		echo 'Owner of config.php: ' . $configUser['name'] . PHP_EOL;
86
		echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL;
87
		exit(1);
88
	}
89
90
	$oldWorkingDir = \getcwd();
91
	if ($oldWorkingDir === false) {
92
		echo 'This script can be run from the ownCloud root directory only.' . PHP_EOL;
93
		echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL;
94
	} elseif ($oldWorkingDir !== __DIR__ && !\chdir(__DIR__)) {
95
		echo 'This script can be run from the ownCloud root directory only.' . PHP_EOL;
96
		echo "Can't change to ownCloud root directory." . PHP_EOL;
97
		exit(1);
98
	}
99
100
	if (!\function_exists('pcntl_signal') && !\in_array('--no-warnings', $argv, true)) {
101
		echo 'The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php' . PHP_EOL;
102
	}
103
104
	$application = new Application(\OC::$server->getConfig(), \OC::$server->getEventDispatcher(), \OC::$server->getRequest());
105
	$application->loadCommands(new ArgvInput(), new ConsoleOutput());
106
	$application->run();
107
} catch (Exception $ex) {
108
	exceptionHandler($ex);
109
} catch (Error $ex) {
110
	exceptionHandler($ex);
111
}
112