Exploit databaseDownload repository ZIP
GH-c3c89120e2a52c8d61f777b438101247
cybfar/cve-2023-23488-pmpro-2.8
Sources for CVE-2023-23488
6 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files11
cybfar/cve-2023-23488-pmpro-2.8Revision 555f7544c7fa
- ↑..Parent directory
- class.pmprogateway.php
- class.pmprogateway_authorizenet.php
- class.pmprogateway_braintree.php
- class.pmprogateway_check.php
- class.pmprogateway_cybersource.php
- class.pmprogateway_payflowpro.php
- class.pmprogateway_paypal.php
- class.pmprogateway_paypalexpress.php
- class.pmprogateway_paypalstandard.php
- class.pmprogateway_stripe.php
- class.pmprogateway_twocheckout.php
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
plugins/paid-memberships-pro/classes/gateways/class.pmprogateway.php
PHP · 6,667 bytes<?php
//require_once(dirname(__FILE__) . "/class.pmprogateway.php");
class PMProGateway
{
function __construct($gateway = NULL)
{
$this->gateway = $gateway;
return $this->gateway;
}
function process(&$order)
{
//check for initial payment
if(floatval($order->InitialPayment) == 0)
{
//auth first, then process
if($this->authorize($order))
{
$this->void($order);
if(!pmpro_isLevelTrial($order->membership_level))
{
//subscription will start today with a 1 period trial
$order->ProfileStartDate = date_i18n("Y-m-d\TH:i:s");
$order->TrialBillingPeriod = $order->BillingPeriod;
$order->TrialBillingFrequency = $order->BillingFrequency;
$order->TrialBillingCycles = 1;
$order->TrialAmount = 0;
//add a billing cycle to make up for the trial, if applicable
if(!empty($order->TotalBillingCycles))
$order->TotalBillingCycles++;
}
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
{
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
$order->ProfileStartDate = date_i18n("Y-m-d\TH:i:s");
$order->TrialBillingCycles++;
//add a billing cycle to make up for the trial, if applicable
if($order->TotalBillingCycles)
$order->TotalBillingCycles++;
}
else
{
//add a period to the start date to account for the initial payment
$order->ProfileStartDate = date_i18n("Y-m-d\TH:i:s", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp")));
}
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
return $this->subscribe($order);
}
else
{
if(empty($order->error))
$order->error = __("Unknown error: Authorization failed.", 'paid-memberships-pro' );
return false;
}
}
else
{
//charge first payment
if($this->charge($order))
{
//set up recurring billing
if(pmpro_isLevelRecurring($order->membership_level))
{
if(!pmpro_isLevelTrial($order->membership_level))
{
//subscription will start today with a 1 period trial
$order->ProfileStartDate = date_i18n("Y-m-d\TH:i:s");
$order->TrialBillingPeriod = $order->BillingPeriod;
$order->TrialBillingFrequency = $order->BillingFrequency;
$order->TrialBillingCycles = 1;
$order->TrialAmount = 0;
//add a billing cycle to make up for the trial, if applicable
if(!empty($order->TotalBillingCycles))
$order->TotalBillingCycles++;
}
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
{
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
$order->ProfileStartDate = date_i18n("Y-m-d\TH:i:s");
$order->TrialBillingCycles++;
//add a billing cycle to make up for the trial, if applicable
if(!empty($order->TotalBillingCycles))
$order->TotalBillingCycles++;
}
else
{
//add a period to the start date to account for the initial payment
$order->ProfileStartDate = date_i18n("Y-m-d\TH:i:s", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod, current_time("timestamp")));
}
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
if($this->subscribe($order))
{
return true;
}
else
{
if($this->void($order))
{
if(!$order->error)
$order->error = __("Unknown error: Payment failed.", 'paid-memberships-pro' );
}
else
{
if(!$order->error)
$order->error = __("Unknown error: Payment failed.", 'paid-memberships-pro' );
$order->error .= " " . __("A partial payment was made that we could not void. Please contact the site owner immediately to correct this.", 'paid-memberships-pro' );
}
return false;
}
}
else
{
//only a one time charge
$order->status = "success"; //saved on checkout page
return true;
}
}
else
{
if(empty($order->error))
$order->error = __("Unknown error: Payment failed.", 'paid-memberships-pro' );
return false;
}
}
}
function authorize(&$order)
{
//create a code for the order
if(empty($order->code))
$order->code = $order->getRandomCode();
//simulate a successful authorization
$order->payment_transaction_id = "TEST" . $order->code;
$order->updateStatus("authorized");
return true;
}
function void(&$order)
{
//need a transaction id
if(empty($order->payment_transaction_id))
return false;
//simulate a successful void
$order->payment_transaction_id = "TEST" . $order->code;
$order->updateStatus("voided");
return true;
}
function charge(&$order)
{
//create a code for the order
if(empty($order->code))
$order->code = $order->getRandomCode();
//simulate a successful charge
$order->payment_transaction_id = "TEST" . $order->code;
$order->updateStatus("success");
return true;
}
function subscribe(&$order)
{
//create a code for the order
if(empty($order->code))
$order->code = $order->getRandomCode();
//filter order before subscription. use with care.
$order = apply_filters("pmpro_subscribe_order", $order, $this);
//simulate a successful subscription processing
$order->status = "success";
$order->subscription_transaction_id = "TEST" . $order->code;
return true;
}
function update(&$order)
{
//simulate a successful billing update
return true;
}
function cancel(&$order)
{
//require a subscription id
if(empty($order->subscription_transaction_id))
return false;
//simulate a successful cancel
$order->updateStatus("cancelled");
return true;
}
function getSubscriptionStatus(&$order)
{
//require a subscription id
if(empty($order->subscription_transaction_id))
return false;
//this looks different for each gateway, but generally an array of some sort
return array();
}
function getTransactionStatus(&$order)
{
//this looks different for each gateway, but generally an array of some sort
return array();
}
}