GitHub Advisoryadvisory · Packagist

GHSA-pqq3-q84h-pj6x Sylius PayPal Plugin Payment Amount Manipulation Vulnerability

MEDIUM Published 2025-03-17 Modified 2025-03-17 Official page ↗
Aliases
CVE-2025-29788
Ecosystem
Packagist
Packages
sylius/paypal-plugin
Severity
Moderate
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
Weaknesses
CWE-472
Reviewed
2025-03-17

Affected packages

• Packagist sylius/paypal-plugin: < 1.6.1 → fixed in 1.6.1 • Packagist sylius/paypal-plugin: >= 1.7.0, < 1.7.1 → fixed in 1.7.1 • Packagist sylius/paypal-plugin: >= 2.0.0, < 2.0.1 → fixed in 2.0.1

Description

A vulnerability allows users to manipulate the final payment amount processed by PayPal. If a user modifies the item quantity in their shopping cart after initiating the PayPal Checkout process, PayPal will not receive the updated total amount. As a result, PayPal captures only the initially transmitted amount, while Sylius incorrectly considers the order fully paid based on the modified total. This flaw can be exploited both accidentally and intentionally, potentially enabling fraud by allowing customers to pay less than the actual order value. Impact • Attackers can intentionally pay less than the actual total order amount. • Business owners may suffer financial losses due to underpaid orders. • Integrity of payment processing is compromised. Patches The issue is fixed in versions: 1.6.1, 1.7.1, 2.0.1 and above. Workarounds To resolve the problem in the end application without updating to the newest patches, there is a need to overwrite `ProcessPayPalOrderAction` with modified logic: ```php request->getInt('orderId'); $order = $this->orderProvider->provideOrderById($orderId); /** @var PaymentInterface $payment */ $payment = $order->getLastPayment(PaymentInterface::STATE_CART); $data = $this->getOrderDetails((string) $request->request->get('payPalOrderId'), $payment); /** @var CustomerInterface|null $customer */ $customer = $order->getCustomer(); if ($customer === null) { $customer = $this->getOrderCustomer($data['payer']); $order->setCustomer($customer); } $purchaseUnit = (array) $data['purchase_units'][0]; $address = $this->addressFactory->createNew(); if ($order->isShippingRequired()) { $name = explode(' ', $purchaseUnit['shipping']['name']['full_name']); $address->setLastName(array_pop($name) ?? ''); $address->setFirstName(implode(' ', $name)); $address->setStreet($purchaseUnit['shipping']['address']['address_line_1']); $address->setCity($purchaseUnit['shipping']['address']['admin_area_2']); $address->setPostcode($purchaseUnit['shipping']['address']['postal_code']); $address->setCountryCode($purchaseUnit['shipping']['address']['country_code']); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_ADDRESS); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING); } else { $address->setFirstName($customer->getFirstName()); $address->setLastName($customer->getLastName()); $defaultAddress = $customer->getDefaultAddress(); $address->setStreet($defaultAddress ? $defaultAddress->getStreet() : ''); $address->setCity($defaultAddress ? $defaultAddress->getCity() : ''); $address->setPostcode($defaultAddress ? $defaultAddress->getPostcode() : ''); $address->setCountryCode($data['payer']['address']['country_code']); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_ADDRESS); } $order->setShippingAddress(clone $address); $order->setBillingAddress(clone $address); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT); $this->orderManager->flush(); try { $this->verify($payment, $data); } catch (\Exception) { $this->paymentStateManager->cancel($payment); return new JsonResponse(['orderID' => $order->getId()]); } $this->paymentStateManager->create($payment); $this->paymentStateManager->process($payment); return new JsonResponse(['orderID' => $order->getId()]); } private function getOrderCustomer(array $customerData): CustomerInterface { /** @var CustomerInterface|null $existingCustomer */ $existingCustomer = $this->customerRepository->findOneBy(['email' => $customerData['email_address']]); if ($existingCustomer !== null) { return $existingCustomer; } /** @var CustomerInterface $customer */ $customer = $this->customerFactory->createNew(); $customer->setEmail($customerData['email_address']); $customer->setFirstName($customerData['name']['given_name']); $customer->setLastName($customerData['name']['surname']); return $customer; } private function getOrderDetails(string $id, PaymentInterface $payment): array { /** @var PaymentMethodInterface $paymentMethod */ $paymentMethod = $payment->getMethod(); $token = $this->authorizeClientApi->authorize($paymentMethod); return $this->orderDetailsApi->get($token, $id); } private function getStateMachine(): StateMachineInterface { if ($this->stateMachineFactory instanceof StateMachineFactoryInterface) { return new WinzouStateMachineAdapter($this->stateMachineFactory); } return $this->stateMachineFactory; } private function verify(PaymentInterface $payment, array $paypalOrderDetails): void { $totalAmount = $this->getTotalPaymentAmountFromPaypal($paypalOrderDetails); if ($payment->getAmount() !== $totalAmount) { throw new \Exception(); } } private function getTotalPaymentAmountFromPaypal(array $paypalOrderDetails): int { if (!isset($paypalOrderDetails['purchase_units']) || !is_array($paypalOrderDetails['purchase_units'])) { return 0; } $totalAmount = 0; foreach ($paypalOrderDetails['purchase_units'] as $unit) { $stringAmount = $unit['amount']['value'] ?? '0'; $totalAmount += (int) ($stringAmount * 100); } return $totalAmount; } } ``` Also there is a need to …

Related

Alias · CVE (1)

  • CVE-2025-29788 The Syliud PayPal Plugin is the Sylius Core Team’s plugin for the PayPal Commerce Platform. vulnerability

Weakness · CWE (1)

  • CWE-472 External Control of Assumed-Immutable Web Parameter weakness

References