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/postmail.php (4 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
global $rawKillmailParser;
20
21
$error = "";
22
23
if($_POST)
24
{
25
	$keyid = Util::getPost("keyid");
26
	$vcode = Util::getPost("vcode");
27
	$killmail = Util::getPost("killmail");
28
	$killmailurl = Util::getPost("killmailurl");
29
	$rawKillmail = Util::getPost("rawkillmail");
30
31
	// Apikey stuff
32
	if($keyid || $vcode)
0 ignored issues
show
Bug Best Practice introduced by
The expression $keyid of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
Bug Best Practice introduced by
The expression $vcode of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
33
	{
34
		$check = Api::checkAPI($keyid, $vcode);
35
		if($check == "success")
36
		{
37
			Db::execute("insert ignore into zz_api (keyID, vCode) values (:keyID, :vCode)", array(":keyID" => $keyid, ":vCode" => $vcode));
38
			$error = "Your API Key has been added.";
39
		}
40
		else
41
		{
42
			$error = $check;
43
		}
44
	}
45
46
	// Crest Killmail
47
	if ($killmailurl)
0 ignored issues
show
Bug Best Practice introduced by
The expression $killmailurl of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
48
	{
49
		// Looks like http://public-crest.eveonline.com/killmails/30290604/787fb3714062f1700560d4a83ce32c67640b1797/
50
		$exploded = explode("/", $killmailurl);
51
52
		if (count($exploded) != 7) $error = "Invalid killmail link.";
53
		else
54
		{
55
			if((int) $exploded[4] <= 0) $error = "Invalid killmail link";
56
			elseif(strlen($exploded[5]) != 40) $error = "Invalid killmail link";
57
			else
58
			{
59
				$killID = (int) $exploded[4];
60
				$hash = (string) $exploded[5];
61
				$i = Db::execute("insert ignore into zz_crest_killmail (killID, hash) values (:killID, :hash)", array(":killID" => $killID, ":hash" => $hash));
62
				Db::execute("update zz_crest_killmail set processed = 0 where processed = -1 and killID = :killID", array(":killID" => $killID));
63
64
				$timer = new Timer();
65
				do {
66
					// Has the kill been processed?
67
					$crestStatus = Db::queryField("select processed from zz_crest_killmail where killID = :killID", "processed", array(":killID" => $killID), 0);
68
					$processed = Db::queryField("select processed from zz_killmails where killID = :killID", "processed", array(":killID" => $killID), 0);
69
					if ($crestStatus == -1) $error = "There is an error with the killmail at the CREST endpoint. We'll let CCP know. Your kill has still been submitted and we'll process it as soon as the error has been fixed. Thank you.";
70
					else if ($processed == 1) $app->redirect("/detail/$killID/");
71
					else if ($processed == 2) $error = "There was an error while processing the killmail. Please open a ticket and include the external killmail link so we can examine what happened. Thank you.";
72
					else if ($processed == 3) $error = "Only PvP mails are accepted, the mail you just submitted was a PvE killmail.";
73
					else if (date("Gi") < 105) $error = "Between 00:00 and 01:05 no kills are processed while we wait for CCP's Market CREST cache to clear... However, the kill has been stored and will be processed at 01:05";
74
					else usleep(450000);
75
				} while ($timer->stop() < 60000 && $error == "");
76
				if ($error == "") $error = "We waited 60 seconds for the kill to be processed but the server must be busy atm, please wait!";
77
			}
78
		}
79
	}
80
81
	// Raw manual killmail
82
	if($rawKillmailParser && $rawKillmail)
0 ignored issues
show
Bug Best Practice introduced by
The expression $rawKillmail of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
83
	{
84
		$userData = User::getUserInfo();
85
		if(User::isLoggedIn())
86
		{
87
			$return = Parser::parseRaw($killmail, $userData["id"]);
88
89
			if(isset($return["success"]))
90
				$app->redirect("/detail/" . $return["success"] . "/");
91
92
			if(isset($return["dupe"]))
93
				$app->redirect("/detail/" . $return["dupe"] . "/");
94
95
			if(isset($return["error"]))
96
				$error = $return["error"];
97
		}
98
		else
99
			$error = "sorry, you need to be logged in to post raw killmails";
100
	}
101
}
102
103
if(!is_array($error)) $error = array($error);
104
105
$app->render("postmail.html", array("message" => $error));
106