CVE-2025-29788: Sylius PayPal Plugin Payment Amount Manipulation Vulnerability
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 <?php
declare(stricttypes=1);
namespace App\Controller;
use Doctrine\Persistence\ObjectManager; use SM\Factory\FactoryInterface as StateMachineFactoryInterface; use Sylius\Abstraction\StateMachine\StateMachineInterface; use Sylius\Abstraction\StateMachine\WinzouStateMachineAdapter; use Sylius\Component\Core\Factory\AddressFactoryInterface; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Core\OrderCheckoutTransitions; use Sylius\Component\Core\Repository\CustomerRepositoryInterface; use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface; use Sylius\PayPalPlugin\Api\OrderDetailsApiInterface; use Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface; use Sylius\PayPalPlugin\Provider\OrderProviderInterface; use Sylius\PayPalPlugin\Verifier\PaymentAmountVerifierInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response;
final class ProcessPayPalOrderAction { public function construct( private readonly CustomerRepositoryInterface $customerRepository, private readonly FactoryInterface $customerFactory, private readonly AddressFactoryInterface $addressFactory, private readonly ObjectManager $orderManager, private readonly StateMachineFactoryInterface|StateMachineInterface $stateMachineFactory, private readonly PaymentStateManagerInterface $paymentStateManager, private readonly CacheAuthorizeClientApiInterface $authorizeClientApi, private readonly OrderDetailsApiInterface $orderDetailsApi, private readonly OrderProviderInterface $orderProvider, ) { }
public function invoke(Request $request): Response { $orderId = $request->request->getInt('orderId'); $order = $this->orderProvider->provideOrderById($orderId); / @var PaymentInterface $payment / $payment = $order->getLastPayment(PaymentInterface::STATECART);
$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['purchaseunits'][0];
$address = $this->addressFactory->createNew();
if ($order->isShippingRequired()) { $name = explode(' ', $purchaseUnit['shipping']['name']['fullname']); $address->setLastName(arraypop($name) ?? ''); $address->setFirstName(implode(' ', $name)); $address->setStreet($purchaseUnit['shipping']['address']['addressline1']); $address->setCity($purchaseUnit['shipping']['address']['adminarea2']); $address->setPostcode($purchaseUnit['shipping']['address']['postalcode']); $address->setCountryCode($purchaseUnit['shipping']['address']['countrycode']);
$this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONADDRESS); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONSELECTSHIPPING); } 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']['countrycode']);
$this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONADDRESS); }
$order->setShippingAddress(clone $address); $order->setBillingAddress(clone $address);
$this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONSELECTPAYMENT);
$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['emailaddress']]); if ($existingCustomer !== null) { return $existingCustomer; }
/ @var CustomerInterface $customer / $customer = $this->customerFactory->createNew(); $customer->setEmail($customerData['emailaddress']); $customer->setFirstName($customerData['name']['givenname']); $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['purchaseunits']) || !isarray($paypalOrderDetails['purchaseunits'])) { return 0; }
$totalAmount = 0;
foreach ($paypalOrderDetails['purchaseunits'] as $unit) { $stringAmount = $unit['amount']['value'] ?? '0';
$totalAmount += (int) ($stringAmount 100); }
return $totalAmount; } }
Also there is a need to overwrite CompletePayPalOrderFromPaymentPageAction with modified logic:
php <?php
declare(stricttypes=1);
namespace App\Controller;
use Doctrine\Persistence\ObjectManager; use SM\Factory\FactoryInterface; use Sylius\Abstraction\StateMachine\StateMachineInterface; use Sylius\Abstraction\StateMachine\WinzouStateMachineAdapter; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\OrderCheckoutTransitions; use Sylius\Component\Order\Processor\OrderProcessorInterface; use Sylius\PayPalPlugin\Exception\PaymentAmountMismatchException; use Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface; use Sylius\PayPalPlugin\Provider\OrderProviderInterface; use Sylius\PayPalPlugin\Verifier\PaymentAmountVerifierInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
final class CompletePayPalOrderFromPaymentPageAction { public function construct( private readonly PaymentStateManagerInterface $paymentStateManager, private readonly UrlGeneratorInterface $router, private readonly OrderProviderInterface $orderProvider, private readonly FactoryInterface|StateMachineInterface $stateMachine, private readonly ObjectManager $orderManager, private readonly OrderProcessorInterface $orderProcessor, ) { }
public function invoke(Request $request): Response { $orderId = $request->attributes->getInt('id');
$order = $this->orderProvider->provideOrderById($orderId); / @var PaymentInterface $payment / $payment = $order->getLastPayment(PaymentInterface::STATEPROCESSING);
try { $this->verify($payment); } catch (\Exception) { $this->paymentStateManager->cancel($payment); $order->removePayment($payment);
$this->orderProcessor->process($order);
return new JsonResponse([ 'returnurl' => $this->router->generate('syliusshopcheckoutcomplete', [], UrlGeneratorInterface::ABSOLUTEURL), ]); }
$this->paymentStateManager->complete($payment);
$this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONSELECTPAYMENT); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONCOMPLETE);
$this->orderManager->flush();
$request->getSession()->set('syliusorderid', $order->getId());
return new JsonResponse([ 'returnurl' => $this->router->generate('syliusshoporderthankyou', [], UrlGeneratorInterface::ABSOLUTEURL), ]); }
private function getStateMachine(): StateMachineInterface { if ($this->stateMachine instanceof FactoryInterface) { return new WinzouStateMachineAdapter($this->stateMachine); }
return $this->stateMachine; }
private function verify(PaymentInterface $payment): void { $totalAmount = $this->getTotalPaymentAmountFromPaypal($payment);
if ($payment->getOrder()->getTotal() !== $totalAmount) { throw new \Exception(); } }
private function getTotalPaymentAmountFromPaypal(PaymentInterface $payment): int { $details = $payment->getDetails();
return $details['paymentamount'] ?? 0; } }
And to overwrite CaptureAction with modified logic:
php <?php
declare(stricttypes=1);
namespace App\Payum\Action;
use Payum\Core\Action\ActionInterface; use Payum\Core\Exception\RequestNotSupportedException; use Payum\Core\Request\Capture; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface; use Sylius\PayPalPlugin\Api\CreateOrderApiInterface; use Sylius\PayPalPlugin\Payum\Action\StatusAction; use Sylius\PayPalPlugin\Provider\UuidProviderInterface;
final class CaptureAction implements ActionInterface { public function construct( private CacheAuthorizeClientApiInterface $authorizeClientApi, private CreateOrderApiInterface $createOrderApi, private UuidProviderInterface $uuidProvider, ) { }
/ @param Capture $request / public function execute($request): void { RequestNotSupportedException::assertSupports($this, $request);
/ @var PaymentInterface $payment / $payment = $request->getModel(); / @var PaymentMethodInterface $paymentMethod / $paymentMethod = $payment->getMethod();
$token = $this->authorizeClientApi->authorize($paymentMethod);
$referenceId = $this->uuidProvider->provide(); $content = $this->createOrderApi->create($token, $payment, $referenceId);
if ($content['status'] === 'CREATED') { $payment->setDetails([ 'status' => StatusAction::STATUSCAPTURED, 'paypalorderid' => $content['id'], 'referenceid' => $referenceId, 'paymentamount' => $payment->getAmount(), ]); } }
public function supports($request): bool { return $request instanceof Capture && $request->getModel() instanceof PaymentInterface ; } }
After that, register services in the container when using PayPal 1.x:
yaml services: App\Controller\ProcessPayPalOrderAction: class: App\Controller\ProcessPayPalOrderAction public: true arguments: - '@sylius.repository.customer' - '@sylius.factory.customer' - '@sylius.factory.address' - '@sylius.manager.order' - '@syliusabstraction.statemachine' - '@Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface' - '@Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface' - '@Sylius\PayPalPlugin\Api\OrderDetailsApiInterface' - '@Sylius\PayPalPlugin\Provider\OrderProviderInterface'
Sylius\PayPalPlugin\Controller\ProcessPayPalOrderAction: alias: App\Controller\ProcessPayPalOrderAction
App\Controller\CompletePayPalOrderFromPaymentPageAction: class: App\Controller\CompletePayPalOrderFromPaymentPageAction public: true arguments: - '@Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface' - '@router' - '@Sylius\PayPalPlugin\Provider\OrderProviderInterface' - '@syliusabstraction.statemachine' - '@sylius.manager.order' - '@sylius.orderprocessing.orderprocessor'
Sylius\PayPalPlugin\Controller\CompletePayPalOrderFromPaymentPageAction: alias: App\Controller\CompletePayPalOrderFromPaymentPageAction
Sylius\PayPalPlugin\Payum\Action\CaptureAction: class: App\Payum\Action\CaptureAction public: true arguments: - '@Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface' - '@Sylius\PayPalPlugin\Api\CreateOrderApiInterface' - '@Sylius\PayPalPlugin\Provider\UuidProviderInterface' tags: - { name: 'payum.action', factory: 'sylius.paypal', alias: 'payum.action.capture' }
or when using PayPal 2.x:
yaml services: App\Controller\ProcessPayPalOrderAction: class: App\Controller\ProcessPayPalOrderAction public: true arguments: - '@sylius.repository.customer' - '@sylius.factory.customer' - '@sylius.factory.address' - '@sylius.manager.order' - '@syliusabstraction.statemachine' - '@syliuspaypal.manager.paymentstate' - '@syliuspaypal.api.cacheauthorizeclient' - '@syliuspaypal.api.orderdetails' - '@syliuspaypal.provider.order'
syliuspaypal.controller.processpaypalorder: alias: App\Controller\ProcessPayPalOrderAction
App\Controller\CompletePayPalOrderFromPaymentPageAction: class: App\Controller\CompletePayPalOrderFromPaymentPageAction public: true arguments: - '@syliuspaypal.manager.paymentstate' - '@router' - '@syliuspaypal.provider.order' - '@syliusabstraction.statemachine' - '@sylius.manager.order' - '@sylius.orderprocessing.orderprocessor'
syliuspaypal.controller.completepaypalorderfrompaymentpage: alias: App\Controller\CompletePayPalOrderFromPaymentPageAction
syliuspaypal.payum.action.capture: class: App\Payum\Action\CaptureAction public: true arguments: - '@syliuspaypal.api.cacheauthorizeclient' - '@syliuspaypal.api.createorder' - '@syliuspaypal.provider.uuid' tags: - { name: 'payum.action', factory: 'sylius.paypal', alias: 'payum.action.capture' }
For more information
If you have any questions or comments about this advisory: Open an issue in Sylius issues Email us at security@sylius.com
Other sources
The Syliud PayPal Plugin is the Sylius Core Team’s plugin for the PayPal Commerce Platform. A vulnerability in versions prior to 1.6.1, 1.7.1, and 2.0.1 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 Express 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. Attackers can intentionally pay less than the actual total order amount, business owners may suffer financial losses due to underpaid orders, and integrity of payment processing is compromised. The issue is fixed in versions 1.6.1, 1.7.1, 2.0.1, and above. To resolve the problem in the end application without updating to the newest patches, there is a need to overwrite ProcessPayPalOrderAction, CompletePayPalOrderFromPaymentPageAction, and CaptureAction with modified logic.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/sylius/paypal-pluginto a version that resolves this vulnerability.Fixed in 2.0.1 - Upgrade
Upgrade
composer/sylius/paypal-pluginto a version that resolves this vulnerability.Fixed in 1.7.1 - Upgrade
Upgrade
composer/sylius/paypal-pluginto a version that resolves this vulnerability.Fixed in 1.6.1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.6.1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.7.1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.0.1 - Configuration
In the end application (without updating to newest patches), overwrite these classes with modified logic to prevent Sylius from treating the order as fully paid when PayPal captures only the initially transmitted amount: `ProcessPayPalOrderAction`, `CompletePayPalOrderFromPaymentPageAction`, and `CaptureAction` (Sylius\PayPalPlugin\Payum\Action\CaptureAction).
Sylius PayPal Plugin (service container overrides for Payum/Controllers) overwrite ProcessPayPalOrderAction / CompletePayPalOrderFromPaymentPageAction / CaptureAction with modified logic = required - Configuration
Register service aliases in the container when using PayPal 1.x so that `sylius_paypal.controller.complete_paypal_order_from_payment_page` points to `App\Controller\CompletePayPalOrderFromPaymentPageAction`, `sylius_paypal.controller.process_paypal_order` points to `App\Controller\ProcessPayPalOrderAction`, and `sylius_paypal.payum.action.capture` points to `App\Payum\Action\CaptureAction` (as indicated by the provided YAML aliases).
Symfony service container (PayPal action routing) aliases for Payum actions/controllers = App\Controller espective overrides + App edirection aliases shown
Event History
Frequently Asked Questions
What is the severity of CVE-2025-29788?
CVE-2025-29788 has a high severity rating as it allows users to manipulate the payment amount during transaction processing.
How do I fix CVE-2025-29788?
To fix CVE-2025-29788, update the Sylius PayPal Plugin to versions 1.6.1, 1.7.1, or 2.0.1 or later.
What versions are affected by CVE-2025-29788?
Versions prior to 1.6.1, 1.7.1, and 2.0.1 of the Sylius PayPal Plugin are affected by CVE-2025-29788.
What kind of manipulation does CVE-2025-29788 allow?
CVE-2025-29788 allows users to manipulate the final payment amount by modifying item quantities in their shopping cart.
Is my data safe with CVE-2025-29788?
Using an affected version of the Sylius PayPal Plugin exposes your financial transactions to potential manipulation, compromising data safety.