Issues (32)

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/PhpEws/Ntlm/NtlmSoapClient.php (3 issues)

Labels
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
3
namespace PhpEws\Ntlm;
4
5
use PhpEws\Exception\EwsException;
6
7
/**
8
 * Soap Client using Microsoft's NTLM Authentication.
9
 *
10
 * @link http://rabaix.net/en/articles/2008/03/13/using-soap-php-with-ntlm-authentication
11
 * @author Thomas Rabaix
12
 */
13
class NtlmSoapClient extends \SoapClient
14
{
15
    /**
16
     * cURL resource used to make the SOAP request
17
     *
18
     * @var resource
19
     */
20
    protected $ch;
21
22
    /**
23
     * Whether or not to validate ssl certificates
24
     *
25
     * @var boolean
26
     */
27
    protected $validate = false;
28
29
    /**
30
     * Performs a SOAP request
31
     *
32
     * @link http://php.net/manual/en/function.soap-soapclient-dorequest.php
33
     *
34
     * @param string $request the xml soap request
35
     * @param string $location the url to request
36
     * @param string $action the soap action.
37
     * @param integer $version the soap version
38
     * @param integer $one_way
39
     *
40
     * @return string the xml soap response.
41
     *
42
     * @throws EwsException If the response if false than there was an error.
43
     */
44
    public function __doRequest($request, $location, $action, $version, $one_way = 0)
45
    {
46
        $headers = array(
47
            'Method: POST',
48
            'Connection: Keep-Alive',
49
            'User-Agent: PHP-SOAP-CURL',
50
            'Content-Type: text/xml; charset=utf-8',
51
            'SOAPAction: "'.$action.'"',
52
        );
53
54
        $this->__last_request_headers = $headers;
0 ignored issues
show
The property __last_request_headers does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
55
        $this->ch = curl_init($location);
56
57
        curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, $this->validate);
58
        curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, $this->validate);
59
        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
60
        curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
61
        curl_setopt($this->ch, CURLOPT_POST, true );
62
        curl_setopt($this->ch, CURLOPT_POSTFIELDS, $request);
63
        curl_setopt($this->ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
64
        curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM);
65
        curl_setopt($this->ch, CURLOPT_USERPWD, $this->user.':'.$this->password);
0 ignored issues
show
The property user does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
The property password does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
66
67
        $response = curl_exec($this->ch);
68
69
        // TODO: Add some real error handling.
70
        // If the response if false than there was an error and we should throw
71
        // an exception.
72
        if ($response === false) {
73
            throw new EwsException(
74
              'Curl error: ' . curl_error($this->ch),
75
              curl_errno($this->ch)
76
            );
77
        }
78
79
        return $response;
80
    }
81
82
    /**
83
     * Returns last SOAP request headers
84
     *
85
     * @link http://php.net/manual/en/function.soap-soapclient-getlastrequestheaders.php
86
     *
87
     * @return string the last soap request headers
88
     */
89
    public function __getLastRequestHeaders()
90
    {
91
        return implode('n', $this->__last_request_headers) . "\n";
92
    }
93
94
    /**
95
     * Sets whether or not to validate ssl certificates
96
     *
97
     * @param boolean $validate
98
     *
99
     * @return true
100
     */
101
    public function validateCertificate($validate = true)
102
    {
103
        $this->validate = $validate;
104
105
        return true;
106
    }
107
}
108