Issues (52)

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.

include/zip.lib.php (1 issue)

Severity
1
<?php
2
/*
3
*******************************************************
4
***													***
5
*** backpack										***
6
*** Cedric MONTUY pour CHG-WEB                      ***
7
*** Original author : Yoshi Sakai					***
8
***													***
9
*******************************************************
10
*/
11
12
class zipfile
13
{
14
    public $datasec      = [];
15
    public $ctrl_dir     = [];
16
    public $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
17
    public $old_offset   = 0;
18
19
    public function __construct()
20
    {
21
    }
22
23
    protected function unix2DosTime($unixtime = 0)
24
    {
25
        $timearray = (0 == $unixtime) ? getdate() : getdate($unixtime);
26
27
        if ($timearray['year'] < 1980) {
28
            $timearray['year']    = 1980;
29
            $timearray['mon']     = 1;
30
            $timearray['mday']    = 1;
31
            $timearray['hours']   = 0;
32
            $timearray['minutes'] = 0;
33
            $timearray['seconds'] = 0;
34
        } // end if
35
36
        return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1);
37
    } // end of the 'unix2DosTime()' method
38
39
    public function addFile($data, $name, $time = 0)
40
    {
41
        $name = str_replace('\\', '/', $name);
42
43
        $dtime    = dechex($this->unix2DosTime($time));
44
        $hexdtime = '\x' . $dtime[6] . $dtime[7] . '\x' . $dtime[4] . $dtime[5] . '\x' . $dtime[2] . $dtime[3] . '\x' . $dtime[0] . $dtime[1];
45
        eval('$hexdtime = \'' . $hexdtime . '\';');
0 ignored issues
show
The use of eval() is discouraged.
Loading history...
46
47
        $fr = "\x50\x4b\x03\x04";
48
        $fr .= "\x14\x00";            // ver needed to extract
49
        $fr .= "\x00\x00";            // gen purpose bit flag
50
        $fr .= "\x08\x00";            // compression method
51
        $fr .= $hexdtime;             // last mod time and date
52
53
        // "local file header" segment
54
        $unc_len = strlen($data);
55
        $crc     = crc32($data);
56
        $zdata   = gzcompress($data);
57
        $zdata   = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug
58
        $c_len   = strlen($zdata);
59
        $fr      .= pack('V', $crc);             // crc32
60
        $fr      .= pack('V', $c_len);           // compressed filesize
61
        $fr      .= pack('V', $unc_len);         // uncompressed filesize
62
        $fr      .= pack('v', strlen($name));    // length of filename
63
        $fr      .= pack('v', 0);                // extra field length
64
        $fr      .= $name;
65
66
        // "file data" segment
67
        $fr .= $zdata;
68
69
        // "data descriptor" segment (optional but necessary if archive is not
70
        // served as file)
71
        $fr .= pack('V', $crc);                 // crc32
72
        $fr .= pack('V', $c_len);               // compressed filesize
73
        $fr .= pack('V', $unc_len);             // uncompressed filesize
74
75
        // add this entry to array
76
        $this->datasec[] = $fr;
77
        $new_offset      = strlen(implode('', $this->datasec));
78
79
        // now add to central directory record
80
        $cdrec = "\x50\x4b\x01\x02";
81
        $cdrec .= "\x00\x00";                // version made by
82
        $cdrec .= "\x14\x00";                // version needed to extract
83
        $cdrec .= "\x00\x00";                // gen purpose bit flag
84
        $cdrec .= "\x08\x00";                // compression method
85
        $cdrec .= $hexdtime;                 // last mod time & date
86
        $cdrec .= pack('V', $crc);           // crc32
87
        $cdrec .= pack('V', $c_len);         // compressed filesize
88
        $cdrec .= pack('V', $unc_len);       // uncompressed filesize
89
        $cdrec .= pack('v', strlen($name)); // length of filename
90
        $cdrec .= pack('v', 0);             // extra field length
91
        $cdrec .= pack('v', 0);             // file comment length
92
        $cdrec .= pack('v', 0);             // disk number start
93
        $cdrec .= pack('v', 0);             // internal file attributes
94
        $cdrec .= pack('V', 32);            // external file attributes - 'archive' bit set
95
96
        $cdrec            .= pack('V', $this->old_offset); // relative offset of local header
97
        $this->old_offset = $new_offset;
98
99
        $cdrec .= $name;
100
101
        // optional extra field, file comment goes here
102
        // save to central directory
103
        $this->ctrl_dir[] = $cdrec;
104
    } // end of the 'addFile()' method
105
106
    public function file()
107
    {
108
        $data    = implode('', $this->datasec);
109
        $ctrldir = implode('', $this->ctrl_dir);
110
111
        return $data . $ctrldir . $this->eof_ctrl_dir . pack('v', count($this->ctrl_dir)) .  // total # of entries "on this disk"
112
               pack('v', count($this->ctrl_dir)) .  // total # of entries overall
113
               pack('V', strlen($ctrldir)) .           // size of central dir
114
               pack('V', strlen($data)) .              // offset to start of central dir
115
               "\x00\x00";                             // .zip file comment length
116
    } // end of the 'file()' method
117
} // end of the 'zipfile' class
118