Issues (292)

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.

lib/Dwoo/Plugins/Functions/PluginMailto.php (2 issues)

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
 * Copyright (c) 2013-2017
4
 *
5
 * @category  Library
6
 * @package   Dwoo\Plugins\Functions
7
 * @author    Jordi Boggiano <[email protected]>
8
 * @author    David Sanchez <[email protected]>
9
 * @copyright 2008-2013 Jordi Boggiano
10
 * @copyright 2013-2017 David Sanchez
11
 * @license   http://dwoo.org/LICENSE Modified BSD License
12
 * @version   1.3.2
13
 * @date      2017-01-06
14
 * @link      http://dwoo.org/
15
 */
16
17
namespace Dwoo\Plugins\Functions;
18
19
use Dwoo\Plugin;
20
21
/**
22
 * Outputs a mailto link with optional spam-proof (okay probably not) encoding
23
 * <pre>
24
 *  * address : target email address
25
 *  * text : display text to show for the link, defaults to the address if not provided
26
 *  * subject : the email subject
27
 *  * encode : one of the available encoding (none, js, jscharcode or hex)
28
 *  * cc : address(es) to carbon copy, comma separated
29
 *  * bcc : address(es) to blind carbon copy, comma separated
30
 *  * newsgroups : newsgroup(s) to post to, comma separated
31
 *  * followupto : address(es) to follow up, comma separated
32
 *  * extra : additional attributes to add to the &lt;a&gt; tag
33
 * </pre>
34
 * This software is provided 'as-is', without any express or implied warranty.
35
 * In no event will the authors be held liable for any damages arising from the use of this software.
36
 */
37
class PluginMailto extends Plugin
38
{
39
    /**
40
     * @param      $address
41
     * @param null $text
42
     * @param null $subject
43
     * @param null $encode
44
     * @param null $cc
45
     * @param null $bcc
46
     * @param null $newsgroups
47
     * @param null $followupto
48
     * @param null $extra
49
     *
50
     * @return string
51
     */
52
    public function process($address, $text = null, $subject = null, $encode = null, $cc = null, $bcc = null, $newsgroups = null, $followupto = null, $extra = null)
53
    {
54
        if (empty($address)) {
55
            return '';
56
        }
57
        if (empty($text)) {
58
            $text = $address;
59
        }
60
61
        // build address string
62
        $address .= '?';
63
64
        if (!empty($subject)) {
65
            $address .= 'subject=' . rawurlencode($subject) . '&';
66
        }
67
        if (!empty($cc)) {
68
            $address .= 'cc=' . rawurlencode($cc) . '&';
69
        }
70
        if (!empty($bcc)) {
71
            $address .= 'bcc=' . rawurlencode($bcc) . '&';
72
        }
73
        if (!empty($newsgroups)) {
74
            $address .= 'newsgroups=' . rawurlencode($newsgroups) . '&';
75
        }
76
        if (!empty($followupto)) {
77
            $address .= 'followupto=' . rawurlencode($followupto) . '&';
78
        }
79
80
        $address = rtrim($address, '?&');
81
82
        // output
83
        switch ($encode) {
84
85
            case 'none':
86
            case null:
87
                return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
88
89
            case 'js':
90 View Code Duplication
            case 'javascript':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
91
                $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
92
                $len = strlen($str);
93
94
                $out = '';
95
                for ($i = 0; $i < $len; ++ $i) {
96
                    $out .= '%' . bin2hex($str[$i]);
97
                }
98
99
                return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
100
101
                break;
102
            case 'javascript_charcode':
103
            case 'js_charcode':
104
            case 'jscharcode':
105 View Code Duplication
            case 'jschar':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
106
                $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
107
                $len = strlen($str);
108
109
                $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(Str.fromCharCode(";
110
                for ($i = 0; $i < $len; ++ $i) {
111
                    $out .= ord($str[$i]) . ',';
112
                }
113
114
                return rtrim($out, ',') . "));\n-->\n</script>\n";
115
116
                break;
117
118
            case 'hex':
119
                if (strpos($address, '?') !== false) {
120
                    $this->core->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING);
121
                }
122
123
                $out = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
124
                $len = strlen($address);
125
                for ($i = 0; $i < $len; ++ $i) {
126
                    if (preg_match('#\w#', $address[$i])) {
127
                        $out .= '%' . bin2hex($address[$i]);
128
                    } else {
129
                        $out .= $address[$i];
130
                    }
131
                }
132
                $out .= '" ' . $extra . '>';
133
                $len = strlen($text);
134
                for ($i = 0; $i < $len; ++ $i) {
135
                    $out .= '&#x' . bin2hex($text[$i]);
136
                }
137
138
                return $out . '</a>';
139
140
            default:
141
                $this->core->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING);
142
        }
143
    }
144
}