Issues (2473)

Branch: master

Security Analysis    no vulnerabilities found

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.

mod/externalpages/start.php (2 issues)

Labels
Severity

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
/**
3
 * Plugin for creating web pages for your site
4
 */
5
6
elgg_register_event_handler('init', 'system', 'expages_init');
7
8
function expages_init() {
9
10
	// Register a page handler, so we can have nice URLs
11
	elgg_register_page_handler('about-a_propos', 'expages_page_handler');		// GCChange change - Ilia: Bilingual page url
12
	elgg_register_page_handler('terms', 'expages_page_handler');		// GCChange change - Ilia: Bilingual page url
13
	elgg_register_page_handler('privacy-confidentialite', 'expages_page_handler');		// GCChange change - Ilia: Bilingual page url
14
	elgg_register_page_handler('expages', 'expages_page_handler');
15
16
	// Register public external pages
17
	elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'expages_public');
18
19
	elgg_register_plugin_hook_handler('register', 'menu:expages', 'expages_menu_register_hook');
20
21
	// add a menu item for the admin edit page
22
	elgg_register_admin_menu_item('configure', 'expages', 'appearance');
23
24
	// add footer links
25
	expages_setup_footer_menu();
26
27
	// register action
28
	$actions_base = elgg_get_plugins_path() . 'externalpages/actions';
29
	elgg_register_action("expages/edit", "$actions_base/edit.php", 'admin');
30
}
31
32
/**
33
 * Extend the public pages range
34
 *
35
 */
36
function expages_public($hook, $handler, $return, $params){
37
	$pages = array('about-a_propos', 'terms-termes', 'privacy-confidentialite');		// GCChange change - Ilia: Bilingual page url
38
	return array_merge($pages, $return);
39
}
40
41
/**
42
 * Setup the links to site pages
43
 */
44
function expages_setup_footer_menu() {
45
	$pages = array('about-a_propos', 'terms-termes', 'privacy-confidentialite');		// GCChange change - Ilia: Bilingual page url
46
	
47 View Code Duplication
	foreach ($pages as $page) {
48
		$url = "$page";
49
		$wg_item = new ElggMenuItem($page, elgg_echo("expages:$page"), $url);
50
		elgg_register_menu_item('walled_garden', $wg_item);
51
52
		$footer_item = clone $wg_item;
53
		elgg_register_menu_item('footer', $footer_item);
54
	}
55
}
56
57
/**
58
 * External pages page handler
59
 *
60
 * @param array  $page    URL segements
61
 * @param string $handler Handler identifier
62
 * @return bool
63
 */
64 View Code Duplication
function expages_page_handler($page, $handler) {
65
	if ($handler == 'expages') {
66
		expages_url_forwarder($page[1]);
67
	}
68
	$type = strtolower($handler);
69
70
	$title = elgg_echo("expages:$type");
71
	$header = elgg_view_title($title);
72
73
	$object = elgg_get_entities(array(
74
		'type' => 'object',
75
		'subtype' => $type,
76
		'limit' => 1,
77
	));
78
	if ($object) {
79
		$content .= elgg_view('output/longtext', array('value' => $object[0]->description));
0 ignored issues
show
The variable $content seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
80
	} else {
81
		$content .= elgg_echo("expages:notset");
0 ignored issues
show
The variable $content seems only to be defined at a later point. Did you maybe move this code here without moving the variable definition?

This error can happen if you refactor code and forget to move the variable initialization.

Let’s take a look at a simple example:

function someFunction() {
    $x = 5;
    echo $x;
}

The above code is perfectly fine. Now imagine that we re-order the statements:

function someFunction() {
    echo $x;
    $x = 5;
}

In that case, $x would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.

Loading history...
82
	}
83
	$content = elgg_view('expages/wrapper', array('content' => $content));
84
	
85
	if (elgg_is_admin_logged_in()) {
86
		elgg_register_menu_item('title', array(
87
			'name' => 'edit',
88
			'text' => elgg_echo('edit'),
89
			'href' => "admin/appearance/expages?type=$type",
90
			'link_class' => 'elgg-button elgg-button-action',
91
		));
92
	}
93
94
	if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) {
95
		$body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content));
96
		echo elgg_view_page($title, $body);
97
	} else {
98
		elgg_load_css('elgg.walled_garden');
99
		$body = elgg_view_layout('walled_garden', array('content' => $header . $content));
100
		echo elgg_view_page($title, $body, 'walled_garden');
101
	}
102
	return true;
103
}
104
105
/**
106
 * Adds menu items to the expages edit form
107
 *
108
 * @param string $hook   'register'
109
 * @param string $type   'menu:expages'
110
 * @param array  $return current menu items
111
 * @param array  $params parameters
112
 * 
113
 * @return array
114
 */
115
function expages_menu_register_hook($hook, $type, $return, $params) {
116
	$type = elgg_extract('type', $params);
117
		
118
	$pages = array('about', 'terms', 'privacy');
119 View Code Duplication
	foreach ($pages as $page) {
120
		$return[] = ElggMenuItem::factory(array(
121
			'name' => $page,
122
			'text' => elgg_echo("expages:$page"),
123
			'href' => "admin/appearance/expages?type=$page",
124
			'selected' => $page === $type,
125
		));
126
	}
127
	return $return;
128
}
129
130
131
/**
132
 * Forward to the new style of URLs
133
 *
134
 * @param string $page
135
 */
136
function expages_url_forwarder($page) {
137
	global $CONFIG;
138
	$url = "{$CONFIG->wwwroot}{$page}";
139
	forward($url);
140
}
141