PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
← All changes | includes/class-give-email-access.php +14 -1 4.16.5 → 4.16.9 View file →
@@ -213,8 +213,9 @@
213 213
214 214 /**
215 215 * This function is used to fetch the token value from query string or cookies based on availability.
216 216 *
217 + * @since 4.16.7 Return an empty string for non-string token values.
217 218 * @since 2.4.1
218 219 * @access public
219 220 *
220 221 * @return string
@@ -227,9 +228,9 @@
227 228 if ( empty( $token ) ) {
228 229 $token = isset( $_COOKIE['give_nl'] ) ? give_clean( $_COOKIE['give_nl'] ) : '';
229 230 }
230 231
231 - return $token;
232 + return is_string( $token ) ? $token : '';
232 233 }
233 234
234 235 /**
235 236 * Has the user authenticated?
@@ -269,8 +270,9 @@
269 270
270 271 /**
271 272 * Is this a valid token?
272 273 *
274 + * @since 4.16.7 Only accept non-empty string tokens.
273 275 * @since 1.0
274 276 * @access public
275 277 *
276 278 * @param $token string The token.
@@ -280,8 +282,13 @@
280 282 public function is_valid_token( $token ) {
281 283
282 284 global $wpdb;
283 285
286 + // A crafted give_nl[]= parameter arrives as an array; reject non-string and empty tokens.
287 + if ( ! is_string( $token ) || '' === $token ) {
288 + return false;
289 + }
290 +
284 291 // Make sure token isn't expired.
285 292 $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration );
286 293
287 294 $email = $wpdb->get_var(
@@ -343,8 +350,9 @@
343 350
344 351 /**
345 352 * Is this a valid verify key?
346 353 *
354 + * @since 4.16.7 Only accept non-empty string tokens.
347 355 * @since 1.0
348 356 * @access public
349 357 *
350 358 * @param $token string The token.
@@ -353,8 +361,13 @@
353 361 */
354 362 public function is_valid_verify_key( $token ) {
355 363 /* @var WPDB $wpdb */
356 364 global $wpdb;
365 +
366 + // A crafted give_nl[]= parameter arrives as an array; reject non-string and empty tokens.
367 + if ( ! is_string( $token ) || '' === $token ) {
368 + return false;
369 + }
357 370
358 371 // See if the verify_key exists.
359 372 $row = $wpdb->get_row(
360 373 $wpdb->prepare( "SELECT id, email FROM {$wpdb->donors} WHERE verify_key = %s LIMIT 1", $token )