Issues (438)

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.

view/moderator.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
/* zKillboard
3
 * Copyright (C) 2012-2015 EVE-KILL Team and EVSCO.
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Affero General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Affero General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Affero General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
$message = "";
20
if (!User::isLoggedIn()) {
21
    $app->render("login.html");
22
    die();
23
}
24
$info = User::getUserInfo();
25
if (!User::isModerator()) $app->redirect("/");
26
27
if($_POST)
28
{
29
	$status = Util::getPost("status");
30
	$reply = Util::getPost("reply");
31
	$report = Util::getPost("report");
32
	$delete = Util::getPost("delete");
33
	$deleteapi = Util::getPost("deleteapi");
34
	$manualpull = Util::getPost("manualpull");
35
36
	if(isset($status))
37
	{
38
		Db::execute("UPDATE zz_tickets SET status = :status WHERE id = :id", array(":status" => $status, ":id" => $id));
39
		if ($status == 0) $app->redirect("..");
40
	}
41
	if(isset($reply))
42
	{
43
		$name = $info["username"];
44
		$moderator = $info["moderator"];
45
		$check = Db::query("SELECT * FROM zz_tickets_replies WHERE reply = :reply AND userid = :userid", array(":reply" => $reply, ":userid" => $info["id"]), 0);
46
		if(!$check)
47
		{
48
			Db::execute("INSERT INTO zz_tickets_replies (userid, belongsTo, name, reply, moderator) VALUES (:userid, :belongsTo, :name, :reply, :moderator)", array(":userid" => $info["id"], ":belongsTo" => $id, ":name" => $name, ":reply" => $reply, ":moderator" => $moderator));
49
			$tic = Db::query("SELECT name,email FROM zz_tickets WHERE id = :id", array(":id" => $id));
50
			$ticname = $tic[0]["name"];
51
			$ticmail = $tic[0]["email"];
52
			$subject = "zKillboard Ticket";
53
			global $baseAddr;
54
			$message = "$ticname, there is a new reply to your ticket from $name - https://$baseAddr/tickets/view/$id/";
55
			if ($moderator == 0) Log::ircAdmin("User replied to ticket: |g|$name|n|  https://$baseAddr/moderator/tickets/$id/");
56
			if ($moderator != 0) Email::send($ticmail, $subject, $message);
57
			if(isset($report))
58
				$app->redirect("/moderator/reportedkills/$id/");
59
			$app->redirect("/moderator/tickets/$id/");
60
		}
61
	}
62
	if(isset($delete))
63
	{
64
		if($delete < 0)
65
		{
66
			Util::deleteKill($delete);
67
			Db::execute("DELETE FROM zz_tickets WHERE id = :id", array(":id" => $id));
68
			Db::execute("DELETE FROM zz_tickets_replies WHERE belongsTo = :belongsTo", array(":belongsTo" => $id));
69
			$app->redirect("/moderator/reportedkills/");
70
		}
71
		$message = "Error, kill is positive, and thus api verified.. something is wrong!";
72
	}
73
74
	if(isset($manualpull) )
75
	{
76
		$message = "ah";
77
	}
78
79
	if(isset($deleteapi)){
80
		Api::deleteKey($deleteapi);
81
		$message = "The Api had been deleted";
82
	}
83
84
}
85
86
if ($req == "") {
87
	$app->redirect("tickets/");
88
	die();
89
}
90
91
if($req == "tickets" && $id)
92
{
93
	$info["ticket"] = Db::query("SELECT * FROM zz_tickets WHERE id = :id", array(":id" => $id), 0);
94
	$info["replies"] = Db::query("SELECT * FROM zz_tickets_replies WHERE belongsTo = :id", array(":id" => $id), 0);
95
}
96
elseif($req == "tickets")
97
{
98
	$limit = 30;
99
	$offset = ($page - 1) * $limit;
100
	$info = Db::query("SELECT t.*, count(r.belongsTo) replyCount FROM zz_tickets t left join zz_tickets_replies r on (t.id = r.belongsTo)  WHERE killID = 0 GROUP BY 1 ORDER BY status DESC, count(r.belongsTo) != 0, datePosted DESC LIMIT $offset, $limit", array(), 0);
101
	foreach($info as $key => $val)
0 ignored issues
show
This foreach statement is empty and can be removed.

This check looks for foreach loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

Consider removing the loop.

Loading history...
102
	{
103
		//if($val["tags"]) $info[$key]["tags"] = explode(",", $val["tags"]);
104
	}
105
}
106
elseif($req == "users")
107
{
108
	$info = Moderator::getUsers($page);
109
}
110
if($req == "reportedkills" && $id)
111
{
112
	$info["ticket"] = Db::query("SELECT * FROM zz_tickets WHERE id = :id", array(":id" => $id), 0);
113
	$info["replies"] = Db::query("SELECT * FROM zz_tickets_replies WHERE belongsTo = :id", array(":id" => $id), 0);
114
}
115
elseif($req == "reportedkills")
116
{
117
	$limit = 30;
118
	$offset = ($page - 1) * $limit;
119
	$info = Db::query("SELECT * FROM zz_tickets WHERE killID != 0 ORDER BY status DESC LIMIT $offset, $limit", array(), 0);
120
	foreach($info as $key => $val)
0 ignored issues
show
This foreach statement is empty and can be removed.

This check looks for foreach loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

Consider removing the loop.

Loading history...
121
	{
122
		//if($val["tags"]) $info[$key]["tags"] = explode(",", $val["tags"]);
123
	}
124
}
125
126
$app->render("moderator/moderator.html", array("id" => $id, "info" => $info, "key" => $req, "url"=>"moderator", "message" => $message, "page" => $page));
127