Issues (4296)

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.

includes/gateways/actions.php (10 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
/**
3
 * Gateway Actions
4
 *
5
 * @package     Give
6
 * @subpackage  Gateways
7
 * @copyright   Copyright (c) 2016, WordImpress
8
 * @license     https://opensource.org/licenses/gpl-license GNU Public License
9
 * @since       1.0
10
 */
11
12
// Exit if accessed directly.
13
if ( ! defined( 'ABSPATH' ) ) {
14
	exit;
15
}
16
17
/**
18
 * Processes gateway select on checkout. Only for users without ajax / javascript
19
 *
20
 * @since 1.0
21
 *
22
 * @param $data
23
 */
24
function give_process_gateway_select( $data ) {
0 ignored issues
show
The parameter $data is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
	if ( isset( $_POST['gateway_submit'] ) ) {
0 ignored issues
show
Detected access of super global var $_POST, probably need manual inspection.
Loading history...
26
		wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) );
0 ignored issues
show
Detected access of super global var $_POST, probably need manual inspection.
Loading history...
Detected usage of a non-validated input variable: $_POST
Loading history...
Detected usage of a non-sanitized input variable: $_POST
Loading history...
27
		exit;
28
	}
29
}
30
31
add_action( 'give_gateway_select', 'give_process_gateway_select' );
32
33
/**
34
 * Loads a payment gateway via AJAX.
35
 *
36
 * @since 1.0
37
 *
38
 * @return void
39
 */
40
function give_load_ajax_gateway() {
41
42
	$post_data = give_clean( $_POST ); // WPCS: input var ok, CSRF ok.
0 ignored issues
show
Detected access of super global var $_POST, probably need manual inspection.
Loading history...
43
44
	if ( isset( $post_data['give_payment_mode'] ) ) {
45
46
		$form_id_prefix = ! empty( $post_data['give_form_id_prefix'] ) ? $post_data['give_form_id_prefix'] : '';
47
48
		$args = array(
49
			'id_prefix' => $form_id_prefix,
50
		);
51
52
		/**
53
		 * Fire to render donation form.
54
		 *
55
		 * @since 1.7
56
		 */
57
		do_action( 'give_donation_form', $post_data['give_form_id'], $args );
58
59
		exit();
60
	}
61
}
62
63
add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
64
add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
65
66
/**
67
 * Create wp nonce using Ajax call.
68
 *
69
 * Use give_donation_form_nonce() js fn to create nonce.
70
 *
71
 * @since 2.0
72
 *
73
 * @return void
74
 */
75
function give_donation_form_nonce() {
76
	if ( isset( $_POST['give_form_id'] ) ) {
77
78
		// Get donation form id.
79
		$form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0;
0 ignored issues
show
Detected access of super global var $_POST, probably need manual inspection.
Loading history...
Detected usage of a non-sanitized input variable: $_POST
Loading history...
80
81
		// Send nonce json data.
82
		wp_send_json_success( wp_create_nonce( "give_donation_form_nonce_{$form_id}" ) );
83
	}
84
}
85
86
add_action( 'wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce' );
87
add_action( 'wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce' );
88
89
90
/**
91
 * Create all nonce of donation form using Ajax call.
92
 * Note: only for internal use
93
 *
94
 * @since 2.2.0
95
 *
96
 * @return void
97
 */
98
function __give_donation_form_reset_all_nonce() {
99
	if ( isset( $_POST['give_form_id'] ) ) {
100
101
		// Get donation form id.
102
		$form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0;
0 ignored issues
show
Detected access of super global var $_POST, probably need manual inspection.
Loading history...
Detected usage of a non-sanitized input variable: $_POST
Loading history...
103
104
		$data = array(
105
			'give_form_hash'               => wp_create_nonce( "give_donation_form_nonce_{$form_id}" ),
106
			'give_form_user_register_hash' => wp_create_nonce( "give_form_create_user_nonce_{$form_id}" )
107
		);
108
109
		/**
110
		 * Filter the ajax request data
111
		 *
112
		 * @since  2.2.0
113
		 *
114
		 */
115
		$data = apply_filters( 'give_donation_form_reset_all_nonce_data', $data );
116
117
		// Send nonce json data.
118
		wp_send_json_success( $data );
119
	}
120
121
	wp_send_json_error();
122
}
123
124
add_action( 'wp_ajax_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce' );
125
add_action( 'wp_ajax_nopriv_give_donation_form_reset_all_nonce', '__give_donation_form_reset_all_nonce' );
126
127
/**
128
 * Sets an error within the donation form if no gateways are enabled.
129
 * @todo: we can deprecate this function in future because gateways will not empty if get via Give API.
130
 *
131
 * @since 1.0
132
 *
133
 * @return void
134
 */
135
function give_no_gateway_error() {
136
	$gateways = give_get_enabled_payment_gateways();
137
138
	if ( empty( $gateways ) ) {
139
		give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) );
140
	} else {
141
		give_unset_error( 'no_gateways' );
142
	}
143
}
144
145
add_action( 'init', 'give_no_gateway_error' );
146