Issues (66)

Security Analysis    no request data  

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/Client/Adapter/LegacyAdapter.php (1 issue)

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
namespace Buttress\Concrete\Client\Adapter;
3
4
use Buttress\Concrete\Client\Connection\LegacyConnection;
5
use Buttress\Concrete\Console\Console;
6
use Buttress\Concrete\Exception\VersionMismatchException;
7
use Buttress\Concrete\Locator\Site;
8
9
/**
10
 * An adapter that connects to legacy concrete5 sites
11
 * @todo Determine the lowest version of c5 we support
12
 */
13
class LegacyAdapter implements Adapter
14
{
15
16
    /** @var \Buttress\Concrete\Locator\Site $site */
17
    protected $site;
18
19
    /** @var \Buttress\Concrete\Console\Console */
20
    protected $console;
21
22
    public function __construct(Site $site, Console $console)
23
    {
24
        $this->site = $site;
25
        $this->console = $console;
26
    }
27
28
    /**
29
     * Attach to legacy concrete5
30
     * @throws \Buttress\Concrete\Exception\VersionMismatchException
31
     */
32
    public function attach()
0 ignored issues
show
attach uses the super-global variable $GLOBALS which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
33
    {
34
        // If the version number is more than 5.6.999, we have the wrong version.
35
        if (version_compare(PHP_VERSION, '5.6.999') > 0) {
36
            throw new VersionMismatchException('Legacy versions of concrete5 do not support PHP 7!', PHP_VERSION);
37
        }
38
39
        // Get the site path
40
        $path = $this->site->getPath();
41
42
        // Change the cwd to the site path
43
        chdir($path);
44
45
        // Define a couple things concrete5 expects
46
        define('DIR_BASE', $path);
47
        define('C5_ENVIRONMENT_ONLY', true);
48
49
        // Set the error reporting low
50
        error_reporting(E_ALL | ~E_NOTICE | ~E_WARNING | ~E_STRICT);
51
52
        // Include Adodb first, not sure why this was needed
53
        require_once $path . '/concrete/libraries/3rdparty/adodb/adodb.inc.php';
54
55
        // Load in legacy dispatcher
56
        require_once $path . '/concrete/dispatcher.php';
57
58
        $this->console->registerErrorHandler();
59
60
        // Adodb Stuff
61
        $GLOBALS['ADODB_ASSOC_CASE'] = 2;
62
        $GLOBALS['ADODB_ACTIVE_CACHESECS'] = 300;
63
        $GLOBALS['ADODB_CACHE_DIR'] = DIR_FILES_CACHE_DB;
64
65
        return new LegacyConnection();
66
    }
67
}
68