Issues (992)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

class/AudioPhpCaptcha.php (1 issue)

1
<?php
2
3
namespace XoopsModules\Extgallery;
4
5
/***************************************************************/
6
/* PhpCaptcha - A visual and audio CAPTCHA generation library
7
8
   Software License Agreement (BSD License)
9
10
   Copyright (C) 2005-2006, Edward Eliot.
11
   All rights reserved.
12
13
   Redistribution and use in source and binary forms, with or without
14
   modification, are permitted provided that the following conditions are met:
15
16
      * Redistributions of source code must retain the above copyright
17
        notice, this list of conditions and the following disclaimer.
18
      * Redistributions in binary form must reproduce the above copyright
19
        notice, this list of conditions and the following disclaimer in the
20
        documentation and/or other materials provided with the distribution.
21
      * Neither the name of Edward Eliot nor the names of its contributors
22
        may be used to endorse or promote products derived from this software
23
        without specific prior written permission of Edward Eliot.
24
25
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
26
   EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28
   DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
29
   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30
   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32
   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
36
   Last Updated:  18th April 2006                               */
37
/***************************************************************/
38
39
/************************ Documentation ************************/
40
41
/*
42
43
Documentation is available at http://www.ejeliot.com/pages/2
44
45
*/
46
47
// this class will only work correctly if a visual CAPTCHA has been created first using PhpCaptcha
48
49
/**
50
 * Class AudioPhpCaptcha
51
 */
52
class AudioPhpCaptcha
53
{
54
    public $sFlitePath;
55
    public $sAudioPath;
56
    public $sCode;
57
58
    /**
59
     * AudioPhpCaptcha constructor.
60
     * @param string $sFlitePath
61
     * @param string $sAudioPath
62
     */
63
    public function __construct(
64
        $sFlitePath = CAPTCHA_FLITE_PATH, // path to flite binary
65
        $sAudioPath = CAPTCHA_AUDIO_PATH // the location to temporarily store the generated audio CAPTCHA
66
    )
67
    {
68
        $this->SetFlitePath($sFlitePath);
69
        $this->SetAudioPath($sAudioPath);
70
71
        // retrieve code if already set by previous instance of visual PhpCaptcha
72
        if (isset($_SESSION[CAPTCHA_SESSION_ID])) {
73
            $this->sCode = $_SESSION[CAPTCHA_SESSION_ID];
74
        }
75
    }
76
77
    /**
78
     * @param $sFlitePath
79
     */
80
    public function SetFlitePath($sFlitePath)
81
    {
82
        $this->sFlitePath = $sFlitePath;
83
    }
84
85
    /**
86
     * @param $sAudioPath
87
     */
88
    public function SetAudioPath($sAudioPath)
89
    {
90
        $this->sAudioPath = $sAudioPath;
91
    }
92
93
    /**
94
     * @param $sText
95
     *
96
     * @return string
97
     */
98
    public function Mask($sText)
99
    {
100
        $iLength = mb_strlen($sText);
101
102
        // loop through characters in code and format
103
        $sFormattedText = '';
104
        foreach ($sText as $i => $iValue) {
105
            // comma separate all but first and last characters
106
            if ($i > 0 && $i < $iLength - 1) {
107
                $sFormattedText .= ', ';
108
            } elseif ($i == $iLength - 1) {
109
                // precede last character with "and"
110
                $sFormattedText .= ' and ';
111
            }
112
            $sFormattedText .= $sText[$i];
113
        }
114
115
        $aPhrases = [
116
            'The %1$s characters are as follows: %2$s',
117
            '%2$s, are the %1$s letters',
118
            'Here are the %1$s characters: %2$s',
119
            '%1$s characters are: %2$s',
120
            '%1$s letters: %2$s',
121
        ];
122
123
        $iPhrase = \array_rand($aPhrases);
124
125
        return \sprintf($aPhrases[$iPhrase], $iLength, $sFormattedText);
126
    }
127
128
    public function Create()
129
    {
130
        $sText = $this->Mask($this->sCode);
131
        $sFile = \md5($this->sCode . \time());
132
133
        // create file with flite
134
        \shell_exec("$this->sFlitePath -t \"$sText\" -o $this->sAudioPath$sFile.wav");
135
136
        // set headers
137
        \header('Content-type: audio/x-wav');
138
        \header("Content-Disposition: attachment;filename=$sFile.wav");
139
140
        // output to browser
141
        echo file_get_contents("$this->sAudioPath$sFile.wav");
142
143
        // delete temporary file
144
        @\unlink("$this->sAudioPath$sFile.wav");
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition for unlink(). This can introduce security issues, and is generally not recommended. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled  annotation

144
        /** @scrutinizer ignore-unhandled */ @\unlink("$this->sAudioPath$sFile.wav");

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
145
    }
146
}
147