Issues (4967)

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.

src/wp-admin/link.php (1 issue)

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
 * Manage link administration actions.
4
 *
5
 * This page is accessed by the link management pages and handles the forms and
6
 * Ajax processes for link actions.
7
 *
8
 * @package WordPress
9
 * @subpackage Administration
10
 */
11
12
/** Load WordPress Administration Bootstrap */
13
require_once( dirname( __FILE__ ) . '/admin.php' );
14
15
wp_reset_vars( array( 'action', 'cat_id', 'link_id' ) );
16
17
if ( ! current_user_can('manage_links') )
18
	wp_link_manager_disabled_message();
19
20
if ( !empty($_POST['deletebookmarks']) )
21
	$action = 'deletebookmarks';
22
if ( !empty($_POST['move']) )
23
	$action = 'move';
24
if ( !empty($_POST['linkcheck']) )
25
	$linkcheck = $_POST['linkcheck'];
26
27
$this_file = admin_url('link-manager.php');
28
29
switch ($action) {
30
	case 'deletebookmarks' :
31
		check_admin_referer('bulk-bookmarks');
32
33
		// For each link id (in $linkcheck[]) change category to selected value.
34
		if (count($linkcheck) == 0) {
35
			wp_redirect($this_file);
36
			exit;
37
		}
38
39
		$deleted = 0;
40
		foreach ($linkcheck as $link_id) {
41
			$link_id = (int) $link_id;
42
43
			if ( wp_delete_link($link_id) )
44
				$deleted++;
45
		}
46
47
		wp_redirect("$this_file?deleted=$deleted");
48
		exit;
49
50
	case 'move' :
51
		check_admin_referer('bulk-bookmarks');
52
53
		// For each link id (in $linkcheck[]) change category to selected value.
54
		if (count($linkcheck) == 0) {
55
			wp_redirect($this_file);
56
			exit;
57
		}
58
		$all_links = join(',', $linkcheck);
59
		/*
60
		 * Should now have an array of links we can change:
61
		 *     $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
62
		 */
63
64
		wp_redirect($this_file);
65
		exit;
66
67
	case 'add' :
68
		check_admin_referer('add-bookmark');
69
70
		$redir = wp_get_referer();
71
		if ( add_link() )
72
			$redir = add_query_arg( 'added', 'true', $redir );
73
74
		wp_redirect( $redir );
0 ignored issues
show
It seems like $redir defined by wp_get_referer() on line 70 can also be of type false; however, wp_redirect() does only seem to accept string, did you maybe forget to handle an error condition?

This check looks for type mismatches where the missing type is false. This is usually indicative of an error condtion.

Consider the follow example

<?php

function getDate($date)
{
    if ($date !== null) {
        return new DateTime($date);
    }

    return false;
}

This function either returns a new DateTime object or false, if there was an error. This is a typical pattern in PHP programming to show that an error has occurred without raising an exception. The calling code should check for this returned false before passing on the value to another function or method that may not be able to handle a false.

Loading history...
75
		exit;
76
77
	case 'save' :
78
		$link_id = (int) $_POST['link_id'];
79
		check_admin_referer('update-bookmark_' . $link_id);
80
81
		edit_link($link_id);
82
83
		wp_redirect($this_file);
84
		exit;
85
86
	case 'delete' :
87
		$link_id = (int) $_GET['link_id'];
88
		check_admin_referer('delete-bookmark_' . $link_id);
89
90
		wp_delete_link($link_id);
91
92
		wp_redirect($this_file);
93
		exit;
94
95
	case 'edit' :
96
		wp_enqueue_script('link');
97
		wp_enqueue_script('xfn');
98
99
		if ( wp_is_mobile() )
100
			wp_enqueue_script( 'jquery-touch-punch' );
101
102
		$parent_file = 'link-manager.php';
103
		$submenu_file = 'link-manager.php';
104
		$title = __('Edit Link');
105
106
		$link_id = (int) $_GET['link_id'];
107
108
		if (!$link = get_link_to_edit($link_id))
109
			wp_die(__('Link not found.'));
110
111
		include( ABSPATH . 'wp-admin/edit-link-form.php' );
112
		include( ABSPATH . 'wp-admin/admin-footer.php' );
113
		break;
114
115
	default :
116
		break;
117
}
118