CVE-2015-10122 (published 2023-07-18T05:15Z)

A vulnerability was found in wp-donate Plugin up to 1.4 on WordPress. It has been classified as critical. This affects an unknown part of the file includes/donate-display.php. The manipulation leads to sql injection. It is possible to initiate the attack remotely. Upgrading to version 1.5 is able to address this issue. The identifier of the patch is 019114cb788d954c5d1b36d6c62418619e93a757. It is recommended to upgrade the affected component. The identifier VDB-234249 was assigned to this vulnerability.

CVSS v3 base score: 9.8, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-89
cwe_name: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
description: The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/wp-plugins/wp-donate
commit_details: repo_url: https://github.com/wp-plugins/wp-donate
author: ketanajani
author_date: 2015-03-23 09:39:42+00:00
msg: made changes in sql query to fix sql injection vulnerabilities by using proper WP query

git-svn-id: https://plugins.svn.wordpress.org/wp-donate/trunk@1118609 b8457f37-d9ea-0310-8a92-e5e31aec5664
repository: repo_url: https://github.com/wp-plugins/wp-donate
repo_name: wp-plugins/wp-donate
description: WordPress.org Plugin Mirror
repo_language: PHP
owner: wp-plugins
file_changes: filename: donate-display.php
change_type: ModificationType.MODIFY
diff: @@ -12,26 +12,26 @@
     {
     if($_REQUEST['action']=='submitdonate')
     {		
-		$first_name = $_REQUEST['first_name'];
-		$last_name = $_REQUEST['last_name'];
-		$organization = $_REQUEST['organization'];
-		$address = $_REQUEST['address'];
-		$city = $_REQUEST['city'];
-		$country = $_REQUEST['country'];
-		$state = $_REQUEST['state'];
-		$zip = $_REQUEST['zip'];
-		$phone = $_REQUEST['phone'];
-		$email = $_REQUEST['email'];		
-		$donation_type = $_REQUEST['donation_type'];
-		$r_frequency = $_REQUEST['r_frequency'];
-		$r_times = $_REQUEST['r_times'];
-		$amount = $_REQUEST['amount'];
-		$card_type = $_REQUEST['card_type'];
-		$x_card_num = $_REQUEST['x_card_num'];
-		$exp_month = $_REQUEST['exp_month'];
-		$exp_year = $_REQUEST['exp_year'];
-		$x_card_code = $_REQUEST['x_card_code'];
-		$comment = $_REQUEST['comment'];
+		$first_name = mysql_real_escape_string($_REQUEST['first_name']);
+		$last_name = mysql_real_escape_string($_REQUEST['last_name']);
+		$organization = mysql_real_escape_string($_REQUEST['organization']);
+		$address = mysql_real_escape_string($_REQUEST['address']);
+		$city = mysql_real_escape_string($_REQUEST['city']);
+		$country = mysql_real_escape_string($_REQUEST['country']);
+		$state = mysql_real_escape_string($_REQUEST['state']);
+		$zip = mysql_real_escape_string($_REQUEST['zip']);
+		$phone = mysql_real_escape_string($_REQUEST['phone']);
+		$email = mysql_real_escape_string($_REQUEST['email']);		
+		$donation_type = mysql_real_escape_string($_REQUEST['donation_type']);
+		$r_frequency = mysql_real_escape_string($_REQUEST['r_frequency']);
+		$r_times = mysql_real_escape_string($_REQUEST['r_times']);
+		$amount = mysql_real_escape_string($_REQUEST['amount']);
+		$card_type = mysql_real_escape_string($_REQUEST['card_type']);
+		$x_card_num = mysql_real_escape_string($_REQUEST['x_card_num']);
+		$exp_month = mysql_real_escape_string($_REQUEST['exp_month']);
+		$exp_year = mysql_real_escape_string($_REQUEST['exp_year']);
+		$x_card_code = mysql_real_escape_string($_REQUEST['x_card_code']);
+		$comment = mysql_real_escape_string($_REQUEST['comment']);
 		$payment_method = $_REQUEST['payment_method'];
 		
 		// Adjust this to point to the Authorize.Net PHP SDK
@@ -56,9 +56,32 @@
 		$REQUEST = $_REQUEST;
 		if($paypalp = authorizepayment($METHOD_TO_USE,$REQUEST,$address1,$city,$state,$country,$zipcode,$emailaddress,$plan))
 		{
-			$sql = "INSERT INTO `".$wpdb->prefix."donate` (`first_name`, `last_name`, `organization`, `address`, `city`, `country`, `state`, `zip`, `phone`, `email`, `donation_type`, `amount`, `comment`, `status`,`date`) 
-			VALUES ('".$first_name."', '".$last_name."','".$organization."','".$address."','".$city."','".$country."','".$state."','".$zip."','".$phone."','".$email."','".$donation_type."','".$amount."','".$comment."', '1',now());";
-			$wpdb->query($sql);
+			
+                        
+				$q_status = "1";
+				$wpdb->query(
+						$wpdb->prepare("
+							INSERT INTO `".$wpdb->prefix."donate`
+							(`first_name`, `last_name`, `organization`, `address`, `city`, `country`, `state`, `zip`, `phone`, `email`, `donation_type`, `amount`, `comment`, `status`,`date`) 
+							VALUES ( %s, %s, %s, %s,%s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s  )
+						", 
+						$first_name, 
+						$last_name, 
+						$organization,
+						$address,
+						$city,
+						$country,
+						$state,
+						$zip,
+						$phone,
+						$email,
+						$donation_type,
+						$amount,
+						$comment,
+						$q_status,
+						date('Y-m-d H:i:s')
+					)
+				);
 			
 			$post = get_post($post->ID);
 			$slug = $post->post_name;

programming_language: PHP