Issues (81)

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.

event/mcp_topic.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\content\event;
11
12
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
13
14
class mcp_topic implements EventSubscriberInterface
15
{
16
	/** @var \phpbb\db\driver\driver_interface */
17
	protected $db;
18
19
	/* @var \blitze\content\services\types */
20
	protected $content_types;
21
22
	/* @var \blitze\content\services\fields */
23
	protected $fields;
24
25
	/** @var string */
26
	protected $phpbb_root_path;
27
28
	/** @var string */
29
	protected $php_ext;
30
31
	/** @var string */
32
	private $type;
33
34
	/**
35
	 * Constructor
36
	 *
37
	 * @param \phpbb\db\driver\driver_interface		$db					Database object
38
	 * @param \blitze\content\services\types		$content_types		Content types object
39
	 * @param \blitze\content\services\fields		$fields				Content fields object
40
	 * @param string								$phpbb_root_path	Path to the phpbb includes directory.
41
	 * @param string								$php_ext			php file extension
42
	*/
43
	public function __construct(\phpbb\db\driver\driver_interface $db, \blitze\content\services\types $content_types, \blitze\content\services\fields $fields, $phpbb_root_path, $php_ext)
44
	{
45
		$this->db = $db;
46
		$this->content_types = $content_types;
47
		$this->fields = $fields;
48
		$this->phpbb_root_path = $phpbb_root_path;
49
		$this->php_ext = $php_ext;
50
	}
51
52
	/**
53
	 * @return array
54
	 */
55
	public static function getSubscribedEvents()
56
	{
57
		return array(
58
			'core.mcp_topic_modify_post_data'	=> 'modify_post_data',
59
			'core.mcp_topic_review_modify_row'	=> 'modify_review_row',
60
			'core.mcp_view_forum_modify_sql'	=> 'modify_forum_sql',
61
			'core.mcp_queue_get_posts_for_topics_query_before'	=> 'modify_topic_queue_sql',
62
			'core.mcp_front_queue_unapproved_total_before'		=> 'modify_forumlist',
63
			'core.mcp_front_view_queue_postid_list_after'		=> 'modify_forumlist',
64
		);
65
	}
66
67
	/**
68
	 * @param \phpbb\event\data $event
69
	 * @return void
70
	 */
71
	public function modify_post_data(\phpbb\event\data $event)
72
	{
73
		$forum_type = $this->content_types->get_forum_type($event['rowset'][0]['forum_id']);
74
		$this->type = $forum_type ?: '';
75
	}
76
77
	/**
78
	 * @param \phpbb\event\data $event
79
	 * @return void
80
	 */
81
	public function modify_review_row(\phpbb\event\data $event)
82
	{
83
		if ($this->type && $event['row']['post_id'] === $event['topic_info']['topic_first_post_id'] && ($entity = $this->content_types->get_type($this->type)) !== false)
84
		{
85
			$this->fields->prepare_to_show($entity, array($event['topic_info']['topic_id']), $entity->get_summary_fields(), $entity->get_summary_tpl(), 'summary');
86
			$users_cache = $attachments = $topic_tracking_info = $update_count = array();
87
88
			$post_row = (array) $event['post_row'];
89
			$topic_data = $event['topic_info'];
90
			$post_data = array_merge($post_row, $event['row']);
91
			$users_cache[$post_data['poster_id']] = array();
92
93
			$tpl_data = $this->fields->get_summary_template_data($this->type, $topic_data, $post_data, $users_cache, $attachments, $topic_tracking_info, $update_count);
0 ignored issues
show
It seems like $topic_data can also be of type null; however, parameter $topic_data of blitze\content\services\...summary_template_data() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

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

93
			$tpl_data = $this->fields->get_summary_template_data($this->type, /** @scrutinizer ignore-type */ $topic_data, $post_data, $users_cache, $attachments, $topic_tracking_info, $update_count);
Loading history...
94
			$content = $this->fields->build_content($tpl_data);
95
96
			$post_row['MESSAGE'] = isset($content['CUSTOM_DISPLAY']) ? $content['CUSTOM_DISPLAY'] : join('', $content['FIELDS']['all']);
97
			$event['post_row'] = $post_row;
98
		}
99
	}
100
101
	/**
102
	 * @param \phpbb\event\data $event
103
	 * @return void
104
	 */
105
	public function modify_forum_sql(\phpbb\event\data $event)
106
	{
107
		$types = $this->content_types->get_forum_types();
108
109
		if ($types[$event['forum_id']])
110
		{
111
			redirect(append_sid("{$this->phpbb_root_path}mcp.$this->php_ext"));
112
		}
113
	}
114
115
	/**
116
	 * @param \phpbb\event\data $event
117
	 * @return void
118
	 */
119
	public function modify_topic_queue_sql(\phpbb\event\data $event)
120
	{
121
		$forum_list = $event['forum_list'];
122
		$forum_list = is_array($forum_list) ? $forum_list : array($forum_list);
123
124
		$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_attachment AS post_attachment, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour
125
			FROM ' . TOPICS_TABLE . ' t
126
			WHERE ' . $this->db->sql_in_set('forum_id', $this->get_forum_list($forum_list)) . '
127
				AND  ' . $this->db->sql_in_set('topic_visibility', $event['visibility_const']) . "
128
				AND topic_delete_user <> 0
129
				{$event['limit_time_sql']}
130
			ORDER BY {$event['sort_order_sql']}";
131
132
		$event['sql'] = $sql;
133
	}
134
135
	/**
136
	 * @param \phpbb\event\data $event
137
	 * @return void
138
	 */
139
	public function modify_forumlist(\phpbb\event\data $event)
140
	{
141
		$event['forum_list'] = $this->get_forum_list((array) $event['forum_list']);
142
	}
143
144
	/**
145
	 * @param array
146
	 * @return array
147
	 */
148
	protected function get_forum_list(array $forum_list)
149
	{
150
		$types = $this->content_types->get_forum_types();
151
		$forum_ids = array_diff($forum_list, array_keys($types));
152
153
		return sizeof($forum_ids) ? $forum_ids : array(0);
154
	}
155
}
156