Issues (569)

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.

src/Common/ProcessUtils.php (1 issue)

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
/*
4
 * This file is derived from part of the Symfony package, which is
5
 * (c) Fabien Potencier <[email protected]>
6
 */
7
8
namespace Robo\Common;
9
10
use Symfony\Component\Process\Exception\InvalidArgumentException;
11
12
/**
13
 * ProcessUtils is a bunch of utility methods. We want to allow Robo 1.x
14
 * to work with Symfony 4.x while remaining backwards compatibility. This
15
 * requires us to replace some deprecated functionality removed in Symfony.
16
 */
17
class ProcessUtils
18
{
19
    /**
20
     * This class should not be instantiated.
21
     */
22
    private function __construct()
23
    {
24
    }
25
26
    /**
27
     * Escapes a string to be used as a shell argument.
28
     *
29
     * @param string $argument
30
     *   The argument that will be escaped.
31
     *
32
     * @return string
33
     *   The escaped argument.
34
     *
35
     * @deprecated since version 3.3, to be removed in 4.0. Use a command line array or give env vars to the `Process::start/run()` method instead.
36
     */
37
    public static function escapeArgument($argument)
38
    {
39
        @trigger_error('The ' . __METHOD__ . '() method is a copy of a method that was deprecated by Symfony 3.3 and removed in Symfony 4; it will be removed in Robo 2.0.', E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
40
41
        //Fix for PHP bug #43784 escapeshellarg removes % from given string
42
        //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
43
        //@see https://bugs.php.net/bug.php?id=43784
44
        //@see https://bugs.php.net/bug.php?id=49446
45
        if ('\\' === DIRECTORY_SEPARATOR) {
46
            if ('' === $argument) {
47
                return escapeshellarg($argument);
48
            }
49
50
            $escapedArgument = '';
51
            $quote = false;
52
            foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
53
                if ('"' === $part) {
54
                    $escapedArgument .= '\\"';
55
                } elseif (self::isSurroundedBy($part, '%')) {
56
                    // Avoid environment variable expansion
57
                    $escapedArgument .= '^%"' . substr($part, 1, -1) . '"^%';
58
                } else {
59
                    // escape trailing backslash
60
                    if ('\\' === substr($part, -1)) {
61
                        $part .= '\\';
62
                    }
63
                    $quote = true;
64
                    $escapedArgument .= $part;
65
                }
66
            }
67
            if ($quote) {
68
                $escapedArgument = '"' . $escapedArgument . '"';
69
            }
70
71
            return $escapedArgument;
72
        }
73
74
        return "'" . str_replace("'", "'\\''", $argument) . "'";
75
    }
76
77
    private static function isSurroundedBy($arg, $char)
78
    {
79
        return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
80
    }
81
}
82