Issues (3099)

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.

UtilitiesBundle/Helper/Cipher/UrlSafeCipher.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
namespace Kunstmaan\UtilitiesBundle\Helper\Cipher;
4
5
/**
6
 * Cipher, this class can be used to encrypt string values to a format which is safe to use in urls.
7
 */
8
class UrlSafeCipher extends Cipher
9
{
10
    /**
11
     * Encrypt the given value so that it's unreadable and that it can be used in an url.
12
     *
13
     * @param string $value
14
     * @param bool   $raw_binary
15
     *
16
     * @return string
17
     *
18
     * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException
19
     */
20 1
    public function encrypt($value, $raw_binary = false)
21
    {
22 1
        return bin2hex(parent::encrypt($value, $raw_binary));
23
    }
24
25
    /**
26
     * Decrypt the given value so that it's readable again.
27
     *
28
     * @param string $value
29
     * @param bool   $raw_binary
30
     *
31
     * @return string
32
     *
33
     * @throws \Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException
34
     * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException
35
     */
36 2
    public function decrypt($value, $raw_binary = false)
37
    {
38 2
        $reflector = new \ReflectionMethod($this, 'hex2bin');
39 2
        $methodOverride = ($reflector->getDeclaringClass()->getName() !== __CLASS__);
40
41
        //NEXT_MAJOR: Remove override check, remove hex2bin method and switch to native php function
42 2
        $binaryValue = hex2bin($value);
43 2
        if ($methodOverride) {
44 1
            @trigger_error(sprintf('Overriding the "%s::hex2bin" method is deprecated since KunstmaanUtilitiesBundle 5.5 and the method will be removed in KunstmaanUtilitiesBundle 6.0. The "%s" class will use the native hex2bin function instead.', __CLASS__, __CLASS__), E_USER_DEPRECATED);
45
46 1
            $binaryValue = $this->hex2bin($value);
0 ignored issues
show
Deprecated Code introduced by
The method Kunstmaan\UtilitiesBundl...rlSafeCipher::hex2bin() has been deprecated with message: The "Kunstmaan\UtilitiesBundle\Helper\Cipher\UrlSafeCipher::hex2bin" method is deprecated since KunstmaanUtilitiesBundle 5.5 and will be removed in KunstmaanUtilitiesBundle 6.0.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
47
        }
48
49 2
        return parent::decrypt($binaryValue, $raw_binary);
50
    }
51
52
    /**
53
     * Decodes a hexadecimal encoded binary string.
54
     * PHP version >= 5.4 has a function for this by default.
55
     *
56
     * @deprecated The "Kunstmaan\UtilitiesBundle\Helper\Cipher\UrlSafeCipher::hex2bin" method is deprecated since KunstmaanUtilitiesBundle 5.5 and will be removed in KunstmaanUtilitiesBundle 6.0.
57
     *
58
     * @param string $hexString
59
     *
60
     * @return string
61
     */
62 2
    public function hex2bin($hexString)
63
    {
64 2
        @trigger_error(sprintf('The "%s::hex2bin" method is deprecated since KunstmaanUtilitiesBundle 5.5 and will be removed in KunstmaanUtilitiesBundle 6.0.', __CLASS__), E_USER_DEPRECATED);
65
66 2
        $pos = 0;
67 2
        $result = '';
68 2
        while ($pos < \strlen($hexString)) {
69 2
            if (strpos(" \t\n\r", $hexString[$pos]) !== false) {
70
                ++$pos;
71
            } else {
72 2
                $code = hexdec(substr($hexString, $pos, 2));
73 2
                $pos += 2;
74 2
                $result .= \chr($code);
75
            }
76
        }
77
78 2
        return $result;
79
    }
80
}
81