Issues (1)

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/Encrypt.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
 * Jaeger
4
 *
5
 * @copyright	Copyright (c) 2015-2016, mithra62
6
 * @link		http://jaeger-app.com
7
 * @version		1.0
8
 * @filesource 	./Encrypt.php
9
 */
10
namespace JaegerApp;
11
12
use phpseclib\Crypt\AES;
13
14
/**
15
 * Jaeger - Encryption Object
16
 *
17
 * Handles encrypting and decrypting items from and for storage
18
 *
19
 * @package Encrypt
20
 * @author Eric Lamb <[email protected]>
21
 */
22
class Encrypt
23
{
24
25
    /**
26
     * The encryption key/salt to use for the request
27
     * 
28
     * @var string
29
     */
30
    protected $key = 'MolliePosellIsLikeSoAmazingYouCantEvenLookWithoutYourHeadBlowingUp';
31
32
    /**
33
     * The encryption library we're using
34
     * 
35
     * @var \Crypt_AES
36
     */
37
    protected $api = null;
38
39
    /**
40
     * Sets the encryption key
41
     * 
42
     * @param string $key            
43
     * @return \mithra62\Encrypt
44
     */
45
    public function setKey($key)
46
    {
47
        if ($key != '') {
48
            $this->key = $key;
49
        }
50
        
51
        return $this;
52
    }
53
54
    /**
55
     * Returns the encryption key
56
     * 
57
     * @return \mithra62\string
58
     */
59
    public function getKey()
60
    {
61
        return $this->key;
62
    }
63
64
    /**
65
     * Encrypts a string
66
     * 
67
     * @param string $string
68
     *            The string to encrypt
69
     * @return string
70
     */
71
    public function encode($string)
72
    {
73
        return base64_encode($this->getApi()->encrypt($string));
74
    }
75
76
    /**
77
     * Decrypts a previously encrypted string
78
     * 
79
     * @param string $string
80
     *            The string to decrypt
81
     * @return string
82
     */
83
    public function decode($string)
84
    {
85
        return $this->getApi()->decrypt(base64_decode($string));
86
    }
87
88
    /**
89
     * Returns an instance of the Crypto library
90
     * 
91
     * @return Crypt_AES
92
     */
93
    public function getApi()
94
    {
95
        if (is_null($this->api)) {
96
            $this->api = new AES();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \phpseclib\Crypt\AES() of type object<phpseclib\Crypt\AES> is incompatible with the declared type object<Crypt_AES> of property $api.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
97
            $this->api->setKey($this->getKey());
98
        }
99
        
100
        return $this->api;
101
    }
102
    
103
    /**
104
     * Generates a Guid if able
105
     * @return string
106
     */
107
    public function guid()
108
    {
109
        if (function_exists('com_create_guid')) {
110
            return com_create_guid();
111
        } else {
112
            mt_srand((double) microtime() * 10000); // optional for php 4.2.0 and up.
113
            $charid = strtoupper(md5(uniqid(rand(), true) . $this->getKey()));
114
            $hyphen = chr(45); // "-"
115
            $uuid = substr($charid, 0, 8) . $hyphen . substr($charid, 8, 4) . $hyphen . substr($charid, 12, 4) . $hyphen . substr($charid, 16, 4) . $hyphen . substr($charid, 20, 12);
116
            return strtolower($uuid);
117
        }
118
    }    
119
}