CVE-2015-10117 (published 2023-06-06T02:15Z)

A vulnerability, which was classified as problematic, was found in Gravity Forms DPS PxPay Plugin up to 1.4.2 on WordPress. Affected is an unknown function. The manipulation leads to cross site scripting. It is possible to launch the attack remotely. Upgrading to version 1.4.3 is able to address this issue. The name of the patch is 5966a5e6343e3d5610bdfa126a5cfbae95e629b6. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-230664.

CVSS v3 base score: 6.1, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)

Weakness information:
cwe_id: CWE-79
cwe_name: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
extended_description: 
            Cross-site scripting (XSS) vulnerabilities occur when:
            
               Untrusted data enters a web application, typically from a web request.
               The web application dynamically generates a web page that contains this untrusted data.
               During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc.
               A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data.
               Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain.
               This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain.
            
            There are three main kinds of XSS:
            
               
                  Type 1: Reflected XSS (or Non-Persistent) - 
         			The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser.
               
                  Type 2: Stored XSS (or Persistent) - 
               The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs.
            
               
                  Type 0: DOM-Based XSS - 
               In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible.
            
            
            Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking."
            In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
         
         

Fix information:
repo_url: https://github.com/wp-plugins/gravity-forms-dps-pxpay
commit_details: repo_url: https://github.com/wp-plugins/gravity-forms-dps-pxpay
author: webaware
author_date: 2015-05-01 02:50:24+00:00
msg: gravity-forms-dps-pxpay 1.4.3: XSS, error handling, new hooks

git-svn-id: https://plugins.svn.wordpress.org/gravity-forms-dps-pxpay/trunk@1150713 b8457f37-d9ea-0310-8a92-e5e31aec5664
repository: repo_url: https://github.com/wp-plugins/gravity-forms-dps-pxpay
repo_name: wp-plugins/gravity-forms-dps-pxpay
description: WordPress.org Plugin Mirror
repo_language: PHP
owner: wp-plugins
file_changes: filename: gravityforms-dps-pxpay.php
change_type: ModificationType.MODIFY
diff: @@ -3,13 +3,13 @@
 Plugin Name: Gravity Forms DPS PxPay
 Plugin URI: http://shop.webaware.com.au/downloads/gravity-forms-dps-pxpay/
 Description: Integrates Gravity Forms with DPS PxPay payment gateway, enabling end users to purchase goods and services through Gravity Forms.
-Version: 1.4.2
+Version: 1.4.3
 Author: WebAware
 Author URI: http://webaware.com.au/
 */
 
 /*
-copyright (c) 2013-2014 WebAware Pty Ltd (email : support@webaware.com.au)
+copyright (c) 2013-2015 WebAware Pty Ltd (email : support@webaware.com.au)
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
@@ -34,7 +34,7 @@ define('GFDPSPXPAY_PLUGIN_ROOT', dirname(__FILE__) . '/');
 define('GFDPSPXPAY_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
 define('GFDPSPXPAY_PLUGIN_FILE', __FILE__);
 define('GFDPSPXPAY_PLUGIN_OPTIONS', 'gfdpspxpay_plugin');
-define('GFDPSPXPAY_PLUGIN_VERSION', '1.4.2');
+define('GFDPSPXPAY_PLUGIN_VERSION', '1.4.3');
 
 // custom post types
 define('GFDPSPXPAY_TYPE_FEED', 'gfdpspxpay_feed');

programming_language: PHP
filename: class.GFDpsPxPayAdmin.php
change_type: ModificationType.MODIFY
diff: @@ -134,7 +134,7 @@ class GFDpsPxPayAdmin {
 	public function addPluginActionLinks($links) {
 		// add settings link, but only if GravityForms plugin is active
 		if (self::isGfActive()) {
-			$settings_link = sprintf('<a href="%s">Settings</a>', admin_url('admin.php?page=gf_settings&subview=DPS+PxPay'));
+			$settings_link = sprintf('<a href="%s">Settings</a>', esc_url(admin_url('admin.php?page=gf_settings&subview=DPS+PxPay')));
 			array_unshift($links, $settings_link);
 		}
 
@@ -146,8 +146,8 @@ class GFDpsPxPayAdmin {
 	*/
 	public static function addPluginDetailsLinks($links, $file) {
 		if ($file == GFDPSPXPAY_PLUGIN_NAME) {
-			$links[] = '<a href="http://wordpress.org/support/plugin/gravity-forms-dps-pxpay">' . __('Get help') . '</a>';
-			$links[] = '<a href="http://wordpress.org/plugins/gravity-forms-dps-pxpay/">' . __('Rating') . '</a>';
+			$links[] = '<a href="https://wordpress.org/support/plugin/gravity-forms-dps-pxpay">' . __('Get help') . '</a>';
+			$links[] = '<a href="https://wordpress.org/plugins/gravity-forms-dps-pxpay/">' . __('Rating') . '</a>';
 			$links[] = '<a href="http://shop.webaware.com.au/downloads/gravity-forms-dps-pxpay/">' . __('Donate') . '</a>';
 		}
 
@@ -217,6 +217,8 @@ class GFDpsPxPayAdmin {
 	* @return array
 	*/
 	public function settingsValidate($input) {
+		$output = array();
+
 		$output['userID']			= trim($input['userID']);
 		$output['userKey']			= trim($input['userKey']);
 		$output['testID']			= trim($input['testID']);

programming_language: PHP
filename: class.GFDpsPxPayFeedAdmin.php
change_type: ModificationType.MODIFY
diff: @@ -105,8 +105,8 @@ class GFDpsPxPayFeedAdmin {
 	* @param array $metabox has metabox id, title, callback, and args elements.
 	*/
 	public function metaboxList($post, $metabox) {
-		$feedsURL = 'edit.php?post_type=' . GFDPSPXPAY_TYPE_FEED;
-		echo "<a href=\"$feedsURL\">Click to return to list</a>.\n";
+		$feedsURL = admin_url('edit.php?post_type=' . GFDPSPXPAY_TYPE_FEED);
+		printf('<a href="%s">Click to return to list</a>', esc_url($feedsURL));
 	}
 
 	/**
@@ -267,8 +267,8 @@ class GFDpsPxPayFeedAdmin {
 
 				$delete = array_pop($actions);		// pop the end link, so that we can "insert" ours before it
 
-				$actions['entries'] = sprintf('<a href="%s" title="%s">%s</a>',
-					add_query_arg(array('page' => 'gf_entries', 'id' => $feed->FormID), admin_url('admin.php')), 'View Entries', 'Entries');
+				$url = add_query_arg(array('page' => 'gf_entries', 'id' => $feed->FormID), admin_url('admin.php'));
+				$actions['entries'] = sprintf('<a href="%s" title="%s">%s</a>', esc_url($url), 'View Entries', 'Entries');
 
 				$actions['delete'] = $delete;		// replace the end link
 			}

programming_language: PHP
filename: class.GFDpsPxPayPayment.php
change_type: ModificationType.MODIFY
diff: @@ -236,6 +236,8 @@ class GFDpsPxPayPaymentResponse {
 	*/
 	public $paymentURL;
 
+	protected $errorMessage;
+
 	/**
 	* load DPS PxPay response data as XML string
 	* @param string $response DPS PxPay response as a string (hopefully of XML data)
@@ -256,8 +258,31 @@ class GFDpsPxPayPaymentResponse {
 				throw new Exception($errmsg);
 			}
 
-			$this->isValid = ('1' === ((string) $xml['valid']));
-			$this->paymentURL = (string) $xml->URI;
+			if ('1' === ((string) $xml['valid'])) {
+				$this->isValid = true;
+				$this->paymentURL = (string) $xml->URI;
+
+				if (empty($this->paymentURL)) {
+					$this->isValid = false;
+
+					$this->errorMessage = (string) $xml->ResponseText;
+					if (empty($this->errorMessage)) {
+						$this->errorMessage = 'no hosted page URI given';
+					}
+				}
+			}
+			else {
+				$this->isValid = false;
+				$this->errorMessage = (string) $xml->ResponseText;
+				if (empty($this->errorMessage)) {
+					// API 1.0 passed error message in URI
+					$this->errorMessage = (string) $xml->URI;
+
+					if (empty($this->errorMessage)) {
+						$this->errorMessage = 'invalid request';
+					}
+				}
+			}
 
 			// restore old libxml settings
 			libxml_disable_entity_loader($oldDisableEntityLoader);
@@ -268,12 +293,12 @@ class GFDpsPxPayPaymentResponse {
 			libxml_disable_entity_loader($oldDisableEntityLoader);
 			libxml_use_internal_errors($oldUseInternalErrors);
 
-			throw new GFDpsPxPayException('Error parsing DPS PxPay generate response: ' . $e->getMessage());
+			throw new GFDpsPxPayException('Error parsing DPS PxPay request: ' . $e->getMessage());
 		}
 
-		// if response is "invalid", throw error with message given in URI field
+		// if response is "invalid", throw error with message
 		if (!$this->isValid) {
-			throw new GFDpsPxPayException('Error from DPS PxPay generate response: ' . $this->paymentURL);
+			throw new GFDpsPxPayException('Error from DPS PxPay request: ' . $this->errorMessage);
 		}
 	}
 }

programming_language: PHP
filename: class.GFDpsPxPayPlugin.php
change_type: ModificationType.MODIFY
diff: @@ -405,11 +405,13 @@ class GFDpsPxPayPlugin {
 			else {
 				$entry['payment_status'] = 'Failed';
 				$this->errorMessage = 'Payment Express request invalid.';
+				self::log_debug($this->errorMessage);
 			}
 		}
 		catch (GFDpsPxPayException $e) {
 			$entry['payment_status'] = 'Failed';
 			$this->errorMessage = $e->getMessage();
+			self::log_debug($this->errorMessage);
 		}
 
 		// update the entry
@@ -432,15 +434,7 @@ class GFDpsPxPayPlugin {
 	* @return mixed
 	*/
 	public function gformConfirmation($confirmation, $form, $entry, $ajax) {
-		if ($this->paymentURL) {
-			// NB: GF handles redirect via JavaScript if headers already sent, or AJAX
-			$confirmation = array('redirect' => $this->paymentURL);
-			self::log_debug('Payment Express request valid, redirecting...');
-
-			$this->paymentURL = false;
-		}
-
-		elseif ($this->errorMessage) {
+		if ($this->errorMessage) {
 			$feed = $this->getFeed($form['id']);
 			if ($feed) {
 				// create a "confirmation message" in which to display the error
@@ -454,10 +448,18 @@ class GFDpsPxPayPlugin {
 				include GFDPSPXPAY_PLUGIN_ROOT . 'views/error-payment-failure.php';
 				$confirmation = ob_get_clean();
 			}
+		}
 
-			$this->errorMessage = false;
+		elseif ($this->paymentURL) {
+			// NB: GF handles redirect via JavaScript if headers already sent, or AJAX
+			$confirmation = array('redirect' => $this->paymentURL);
+			self::log_debug('Payment Express request valid, redirecting to: ' . $this->paymentURL);
 		}
 
+		// reset transient members
+		$this->errorMessage = false;
+		$this->paymentURL = false;
+
 		return $confirmation;
 	}
 
@@ -498,6 +500,8 @@ class GFDpsPxPayPlugin {
 					$form = GFFormsModel::get_form_meta($lead['form_id']);
 					$feed = $this->getFeed($form['id']);
 
+					do_action('gfdpspxpay_process_return_parsed', $lead, $form, $feed);
+
 					// update lead entry, with success/fail details
 					if ($response->success) {
 						$lead['payment_status']		= 'Approved';
@@ -539,7 +543,7 @@ class GFDpsPxPayPlugin {
 					// on failure, redirect to failure page if set, otherwise fall through to redirect back to confirmation page
 					if ($lead['payment_status']	== 'Failed') {
 						if ($feed->UrlFail) {
-							wp_redirect($feed->UrlFail);
+							wp_redirect(esc_url_raw($feed->UrlFail));
 							exit;
 						}
 					}
@@ -547,7 +551,8 @@ class GFDpsPxPayPlugin {
 					// redirect to Gravity Forms page, passing form and lead IDs, encoded to deter simple attacks
 					$query = "form_id={$lead['form_id']}&lead_id={$lead['id']}";
 					$query .= "&hash=" . wp_hash($query);
-					wp_redirect(add_query_arg(array(self::PXPAY_RETURN => base64_encode($query)), $lead['source_url']));
+					$redirect_url = esc_url_raw(add_query_arg(array(self::PXPAY_RETURN => base64_encode($query)), $lead['source_url']));
+					wp_redirect($redirect_url);
 					exit;
 				}
 			}
@@ -584,6 +589,8 @@ class GFDpsPxPayPlugin {
 				$form = GFFormsModel::get_form_meta($query['form_id']);
 				$lead = GFFormsModel::get_lead($query['lead_id']);
 
+				do_action('gfdpspxpay_process_confirmation_parsed', $lead, $form);
+
 				// get confirmation page
 				if (!class_exists('GFFormDisplay')) {
 					require_once(GFCommon::get_base_path() . '/form_display.php');

programming_language: PHP
filename: class.GFDpsPxPayResult.php
change_type: ModificationType.MODIFY
diff: @@ -311,7 +311,7 @@ class GFDpsPxPayResultResponse {
 			libxml_disable_entity_loader($oldDisableEntityLoader);
 			libxml_use_internal_errors($oldUseInternalErrors);
 
-			throw new GFDpsPxPayException('Error parsing DPS PxPay result request: ' . $e->getMessage());
+			throw new GFDpsPxPayException('Error parsing DPS PxPay result: ' . $e->getMessage());
 		}
 
 		// if response is "invalid", throw error with message given in statusText field

programming_language: PHP
filename: readme.md
change_type: ModificationType.MODIFY
diff: @@ -5,7 +5,7 @@ Integrate [Gravity Forms](http://webaware.com.au/get-gravity-forms) with the DPS
 * [Home](http://shop.webaware.com.au/downloads/gravity-forms-dps-pxpay/)
 * [GitHub](https://github.com/webaware/gravity-forms-dps-pxpay/)
 * [Readme](https://github.com/webaware/gravity-forms-dps-pxpay/blob/master/readme.txt)
-* [Download](http://wordpress.org/plugins/gravity-forms-dps-pxpay/)
-* [Documentation](http://wordpress.org/plugins/gravity-forms-dps-pxpay/faq/)
-* [Support](http://wordpress.org/support/plugin/gravity-forms-dps-pxpay)
+* [Download](https://wordpress.org/plugins/gravity-forms-dps-pxpay/)
+* [Documentation](https://wordpress.org/plugins/gravity-forms-dps-pxpay/faq/)
+* [Support](https://wordpress.org/support/plugin/gravity-forms-dps-pxpay)
 * [Donate](http://shop.webaware.com.au/downloads/gravity-forms-dps-pxpay/)

programming_language: Markdown
filename: readme.txt
change_type: ModificationType.MODIFY
diff: @@ -6,8 +6,8 @@ Author URI: http://webaware.com.au/
 Donate link: http://shop.webaware.com.au/downloads/gravity-forms-dps-pxpay/
 Tags: gravityforms, gravity forms, gravity, dps, payment express, pxpay, donation, donations, payment, payment gateway, ecommerce, credit cards, new zealand, australia
 Requires at least: 3.7.1
-Tested up to: 4.2
-Stable tag: 1.4.2
+Tested up to: 4.2.1
+Stable tag: 1.4.3
 License: GPLv2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
 
@@ -25,7 +25,7 @@ Gravity Forms DPS PxPay adds a credit card payment gateway for [DPS PxPay](http:
 
 = Sponsorships =
 
-* creation of this plugin was generously sponsored by [IstanbulMMV](http://profiles.wordpress.org/IstanbulMMV/profile/)
+* creation of this plugin was generously sponsored by [IstanbulMMV](https://profiles.wordpress.org/IstanbulMMV/profile/)
 
 Thanks for sponsoring new features on Gravity Forms DPS PxPay!
 
@@ -137,6 +137,14 @@ Developers can run processes on these actions (e.g. load classes required to han
 
 == Changelog ==
 
+= 1.4.3, 2015-05-01 =
+
+* fixed: error reporting when initial request fails, e.g. with API key error
+* fixed: error handling logic with redirect as confirmation
+* added: some more precautionary XSS prevention steps
+* added: action `gfdpspxpay_process_return_parsed` with `$lead`, `$form`, `$feed`
+* added: action `gfdpspxpay_process_confirmation_parsed` with `$entry`, `$form`
+
 = 1.4.2, 2014-12-23 =
 * added: hooks `gfdpspxpay_process_return` and `gfdpspxpay_process_confirmation`
 * changed: merge tags use currency of transaction for amount display

programming_language: Markdown
filename: metabox-save.php
change_type: ModificationType.MODIFY
diff: @@ -14,7 +14,7 @@ if ( current_user_can( "delete_post", $post->ID ) ) {
 	else
 		$delete_text = __('Move to Trash');
 	?>
-	<a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
+	<a class="submitdelete deletion" href="<?php echo esc_url(get_delete_post_link($post->ID)); ?>"><?php echo $delete_text; ?></a><?php
 } ?>
 </div>
 

programming_language: PHP
filename: requires-extensions.php
change_type: ModificationType.MODIFY
diff: @@ -2,8 +2,8 @@
 <div class="error">
 	<p>Gravity Forms DPS PxPay requires these missing PHP extensions. Please contact your website host to have these extensions installed.</p>
 	<ul style="list-style-type: disc; padding-left: 2em;">
-	<?php foreach ($missing as $ext): if (!extension_loaded($ext)): ?>
-		<li><?php echo $ext; ?></li>
-	<?php endif; endforeach; ?>
+	<?php foreach ($missing as $ext): ?>
+		<li><?php echo esc_html($ext); ?></li>
+	<?php endforeach; ?>
 	</ul>
 </div>

programming_language: PHP