CVE-2025-29788: Sylius/paypal plugin Sylius PayPal Plugin Payment Amount Vulnerability

MODERATE
Advisory Identifier: GHSA-pqq3-q84h-pj6x
CVSS 6.5
CWE-472
Published
Advisory Summary

CVE-2025-29788 is a MODERATE (CVSS 6.5) sylius paypal plugin payment amount vulnerability (CWE-472: External Control of Assumed-Immutable Web Parameter) affecting Sylius/paypal plugin libraries in the Packagist ecosystem. The issue involves sylius paypal plugin payment amount manipulation vulnerability. Remediation is available by upgrading affected packages to version 1.6.1, 1.7.1, 2.0.1.

CVE-2025-29788 at a Glance

CVE Identifier CVE-2025-29788
GHSA Identifier GHSA-pqq3-q84h-pj6x
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-472: External Control of Assumed-Immutable Web Parameter
Affected Product Sylius/paypal plugin
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2025-29788

To remediate this vulnerability, upgrade all affected Sylius/paypal plugin dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

sylius/paypal-plugin fixed: 1.6.1
Upgrade sylius/paypal-plugin to 1.6.1
sylius/paypal-plugin fixed: 1.7.1
Upgrade sylius/paypal-plugin to 1.7.1
sylius/paypal-plugin fixed: 2.0.1
Upgrade sylius/paypal-plugin to 2.0.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for sylius/paypal-plugin

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-29788, inspect your project dependencies for Sylius/paypal plugin:

inspect dependencies for sylius/paypal-plugin

Analyze the terminal output to locate any version of Sylius/paypal plugin in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.6.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-472: External Control of Assumed-Immutable Web Parameter, where the web application does not sufficiently verify inputs that are assumed to be immutable but are actually externally controllable, such as hidden form fields. In Sylius/paypal plugin, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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(strict_types=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::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 overwrite `CompletePayPalOrderFromPaymentPageAction` with modified logic: ```php <?php declare(strict_types=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::STATE_PROCESSING); try { $this->verify($payment); } catch (\Exception) { $this->paymentStateManager->cancel($payment); $order->removePayment($payment); $this->orderProcessor->process($order); return new JsonResponse([ 'return_url' => $this->router->generate('sylius_shop_checkout_complete', [], UrlGeneratorInterface::ABSOLUTE_URL), ]); } $this->paymentStateManager->complete($payment); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_COMPLETE); $this->orderManager->flush(); $request->getSession()->set('sylius_order_id', $order->getId()); return new JsonResponse([ 'return_url' => $this->router->generate('sylius_shop_order_thank_you', [], UrlGeneratorInterface::ABSOLUTE_URL), ]); } 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['payment_amount'] ?? 0; } } ``` And to overwrite `CaptureAction` with modified logic: ```php <?php declare(strict_types=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::STATUS_CAPTURED, 'paypal_order_id' => $content['id'], 'reference_id' => $referenceId, 'payment_amount' => $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' - '@sylius_abstraction.state_machine' - '@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' - '@sylius_abstraction.state_machine' - '@sylius.manager.order' - '@sylius.order_processing.order_processor' 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.pay_pal', 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' - '@sylius_abstraction.state_machine' - '@sylius_paypal.manager.payment_state' - '@sylius_paypal.api.cache_authorize_client' - '@sylius_paypal.api.order_details' - '@sylius_paypal.provider.order' sylius_paypal.controller.process_paypal_order: alias: App\Controller\ProcessPayPalOrderAction App\Controller\CompletePayPalOrderFromPaymentPageAction: class: App\Controller\CompletePayPalOrderFromPaymentPageAction public: true arguments: - '@sylius_paypal.manager.payment_state' - '@router' - '@sylius_paypal.provider.order' - '@sylius_abstraction.state_machine' - '@sylius.manager.order' - '@sylius.order_processing.order_processor' sylius_paypal.controller.complete_paypal_order_from_payment_page: alias: App\Controller\CompletePayPalOrderFromPaymentPageAction sylius_paypal.payum.action.capture: class: App\Payum\Action\CaptureAction public: true arguments: - '@sylius_paypal.api.cache_authorize_client' - '@sylius_paypal.api.create_order' - '@sylius_paypal.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](https://github.com/Sylius/Sylius/issues) * Email us at security@sylius.com

CVE-2025-29788 Affected Sylius/paypal plugin Versions

3 component(s)
Fixed Versions:
1.6.11.7.12.0.1
Product / Package Ecosystem Affected Versions Fixed Version
sylius/paypal-plugin
Packagist
< 1.6.1
1.6.1
sylius/paypal-plugin
Packagist
≥ 1.7.0
< 1.7.1
1.7.1
sylius/paypal-plugin
Packagist
≥ 2.0.0
< 2.0.1
2.0.1

References

Frequently Asked Questions

What is CVE-2025-29788?
CVE-2025-29788 is a security vulnerability in Sylius/paypal plugin involving Sylius PayPal Plugin Payment Amount Manipulation Vulnerability under CWE-472: External Control of Assumed-Immutable Web Parameter.
Which Sylius/paypal plugin versions are affected?
Affected versions include releases prior to 1.6.1, 1.7.1, 2.0.1 across affected packages: sylius/paypal-plugin.
What version fixes CVE-2025-29788?
Upgrading to 1.6.1, 1.7.1, 2.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sylius/paypal-plugin affected?
Yes, sylius/paypal-plugin is affected in releases prior to 1.6.1, 1.7.1, 2.0.1. Upgrade your dependency to 1.6.1, 1.7.1, 2.0.1 or later.
What is the CVSS score of CVE-2025-29788?
CVE-2025-29788 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2025-29788?
CVE-2025-29788 is classified under CWE-472: External Control of Assumed-Immutable Web Parameter (The web application does not sufficiently verify inputs that are assumed to be immutable but are actually externally controllable, such as hidden form fields.).
How can I check Packagist dependencies for CVE-2025-29788?
Run the dependency tree command: 'inspect dependencies for sylius/paypal-plugin'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-pqq3-q84h-pj6x",
  "modified" : "2025-03-17T21:26:51Z",
  "published" : "2025-03-17T21:26:50Z",
  "aliases" : [ "CVE-2025-29788" ],
  "summary" : "Sylius PayPal Plugin Payment Amount Manipulation Vulnerability",
  "details" : "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.\n\n### Impact\n\n- Attackers can intentionally pay less than the actual total order amount.\n- Business owners may suffer financial losses due to underpaid orders.\n- Integrity of payment processing is compromised.\n\n### Patches\n\nThe issue is fixed in versions: 1.6.1, 1.7.1, 2.0.1 and above.\n\n### Workarounds\n\nTo resolve the problem in the end application without updating to the newest patches, there is a need to overwrite `ProcessPayPalOrderAction` with modified logic:\n\n```php\n<?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Controller;\n\nuse Doctrine\\Persistence\\ObjectManager;\nuse SM\\Factory\\FactoryInterface as StateMachineFactoryInterface;\nuse Sylius\\Abstraction\\StateMachine\\StateMachineInterface;\nuse Sylius\\Abstraction\\StateMachine\\WinzouStateMachineAdapter;\nuse Sylius\\Component\\Core\\Factory\\AddressFactoryInterface;\nuse Sylius\\Component\\Core\\Model\\CustomerInterface;\nuse Sylius\\Component\\Core\\Model\\PaymentInterface;\nuse Sylius\\Component\\Core\\Model\\PaymentMethodInterface;\nuse Sylius\\Component\\Core\\OrderCheckoutTransitions;\nuse Sylius\\Component\\Core\\Repository\\CustomerRepositoryInterface;\nuse Sylius\\Component\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\PayPalPlugin\\Api\\CacheAuthorizeClientApiInterface;\nuse Sylius\\PayPalPlugin\\Api\\OrderDetailsApiInterface;\nuse Sylius\\PayPalPlugin\\Manager\\PaymentStateManagerInterface;\nuse Sylius\\PayPalPlugin\\Provider\\OrderProviderInterface;\nuse Sylius\\PayPalPlugin\\Verifier\\PaymentAmountVerifierInterface;\nuse Symfony\\Component\\HttpFoundation\\JsonResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class ProcessPayPalOrderAction\n{\n    public function __construct(\n        private readonly CustomerRepositoryInterface $customerRepository,\n        private readonly FactoryInterface $customerFactory,\n        private readonly AddressFactoryInterface $addressFactory,\n        private readonly ObjectManager $orderManager,\n        private readonly StateMachineFactoryInterface|StateMachineInterface $stateMachineFactory,\n        private readonly PaymentStateManagerInterface $paymentStateManager,\n        private readonly CacheAuthorizeClientApiInterface $authorizeClientApi,\n        private readonly OrderDetailsApiInterface $orderDetailsApi,\n        private readonly OrderProviderInterface $orderProvider,\n    ) {\n    }\n\n    public function __invoke(Request $request): Response\n    {\n        $orderId = $request->request->getInt('orderId');\n        $order = $this->orderProvider->provideOrderById($orderId);\n        /** @var PaymentInterface $payment */\n        $payment = $order->getLastPayment(PaymentInterface::STATE_CART);\n\n        $data = $this->getOrderDetails((string) $request->request->get('payPalOrderId'), $payment);\n\n        /** @var CustomerInterface|null $customer */\n        $customer = $order->getCustomer();\n        if ($customer === null) {\n            $customer = $this->getOrderCustomer($data['payer']);\n            $order->setCustomer($customer);\n        }\n\n        $purchaseUnit = (array) $data['purchase_units'][0];\n\n        $address = $this->addressFactory->createNew();\n\n        if ($order->isShippingRequired()) {\n            $name = explode(' ', $purchaseUnit['shipping']['name']['full_name']);\n            $address->setLastName(array_pop($name) ?? '');\n            $address->setFirstName(implode(' ', $name));\n            $address->setStreet($purchaseUnit['shipping']['address']['address_line_1']);\n            $address->setCity($purchaseUnit['shipping']['address']['admin_area_2']);\n            $address->setPostcode($purchaseUnit['shipping']['address']['postal_code']);\n            $address->setCountryCode($purchaseUnit['shipping']['address']['country_code']);\n\n            $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_ADDRESS);\n            $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING);\n        } else {\n            $address->setFirstName($customer->getFirstName());\n            $address->setLastName($customer->getLastName());\n\n            $defaultAddress = $customer->getDefaultAddress();\n\n            $address->setStreet($defaultAddress ? $defaultAddress->getStreet() : '');\n            $address->setCity($defaultAddress ? $defaultAddress->getCity() : '');\n            $address->setPostcode($defaultAddress ? $defaultAddress->getPostcode() : '');\n            $address->setCountryCode($data['payer']['address']['country_code']);\n\n            $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_ADDRESS);\n        }\n\n        $order->setShippingAddress(clone $address);\n        $order->setBillingAddress(clone $address);\n\n        $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT);\n\n        $this->orderManager->flush();\n\n        try {\n            $this->verify($payment, $data);\n        } catch (\\Exception) {\n            $this->paymentStateManager->cancel($payment);\n\n            return new JsonResponse(['orderID' => $order->getId()]);\n        }\n\n        $this->paymentStateManager->create($payment);\n        $this->paymentStateManager->process($payment);\n\n        return new JsonResponse(['orderID' => $order->getId()]);\n    }\n\n    private function getOrderCustomer(array $customerData): CustomerInterface\n    {\n        /** @var CustomerInterface|null $existingCustomer */\n        $existingCustomer = $this->customerRepository->findOneBy(['email' => $customerData['email_address']]);\n        if ($existingCustomer !== null) {\n            return $existingCustomer;\n        }\n\n        /** @var CustomerInterface $customer */\n        $customer = $this->customerFactory->createNew();\n        $customer->setEmail($customerData['email_address']);\n        $customer->setFirstName($customerData['name']['given_name']);\n        $customer->setLastName($customerData['name']['surname']);\n\n        return $customer;\n    }\n\n    private function getOrderDetails(string $id, PaymentInterface $payment): array\n    {\n        /** @var PaymentMethodInterface $paymentMethod */\n        $paymentMethod = $payment->getMethod();\n        $token = $this->authorizeClientApi->authorize($paymentMethod);\n\n        return $this->orderDetailsApi->get($token, $id);\n    }\n\n    private function getStateMachine(): StateMachineInterface\n    {\n        if ($this->stateMachineFactory instanceof StateMachineFactoryInterface) {\n            return new WinzouStateMachineAdapter($this->stateMachineFactory);\n        }\n\n        return $this->stateMachineFactory;\n    }\n\n    private function verify(PaymentInterface $payment, array $paypalOrderDetails): void\n    {\n        $totalAmount = $this->getTotalPaymentAmountFromPaypal($paypalOrderDetails);\n\n        if ($payment->getAmount() !== $totalAmount) {\n            throw new \\Exception();\n        }\n    }\n\n    private function getTotalPaymentAmountFromPaypal(array $paypalOrderDetails): int\n    {\n        if (!isset($paypalOrderDetails['purchase_units']) || !is_array($paypalOrderDetails['purchase_units'])) {\n            return 0;\n        }\n\n        $totalAmount = 0;\n\n        foreach ($paypalOrderDetails['purchase_units'] as $unit) {\n            $stringAmount = $unit['amount']['value'] ?? '0';\n\n            $totalAmount += (int) ($stringAmount * 100);\n        }\n\n        return $totalAmount;\n    }\n}\n```\n\nAlso there is a need to overwrite `CompletePayPalOrderFromPaymentPageAction` with modified logic:\n\n```php\n<?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Controller;\n\nuse Doctrine\\Persistence\\ObjectManager;\nuse SM\\Factory\\FactoryInterface;\nuse Sylius\\Abstraction\\StateMachine\\StateMachineInterface;\nuse Sylius\\Abstraction\\StateMachine\\WinzouStateMachineAdapter;\nuse Sylius\\Component\\Core\\Model\\PaymentInterface;\nuse Sylius\\Component\\Core\\OrderCheckoutTransitions;\nuse Sylius\\Component\\Order\\Processor\\OrderProcessorInterface;\nuse Sylius\\PayPalPlugin\\Exception\\PaymentAmountMismatchException;\nuse Sylius\\PayPalPlugin\\Manager\\PaymentStateManagerInterface;\nuse Sylius\\PayPalPlugin\\Provider\\OrderProviderInterface;\nuse Sylius\\PayPalPlugin\\Verifier\\PaymentAmountVerifierInterface;\nuse Symfony\\Component\\HttpFoundation\\JsonResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n\nfinal class CompletePayPalOrderFromPaymentPageAction\n{\n    public function __construct(\n        private readonly PaymentStateManagerInterface $paymentStateManager,\n        private readonly UrlGeneratorInterface $router,\n        private readonly OrderProviderInterface $orderProvider,\n        private readonly FactoryInterface|StateMachineInterface $stateMachine,\n        private readonly ObjectManager $orderManager,\n        private readonly OrderProcessorInterface $orderProcessor,\n    ) {\n    }\n\n    public function __invoke(Request $request): Response\n    {\n        $orderId = $request->attributes->getInt('id');\n\n        $order = $this->orderProvider->provideOrderById($orderId);\n        /** @var PaymentInterface $payment */\n        $payment = $order->getLastPayment(PaymentInterface::STATE_PROCESSING);\n\n        try {\n            $this->verify($payment);\n        } catch (\\Exception) {\n            $this->paymentStateManager->cancel($payment);\n            $order->removePayment($payment);\n\n            $this->orderProcessor->process($order);\n\n            return new JsonResponse([\n                'return_url' => $this->router->generate('sylius_shop_checkout_complete', [], UrlGeneratorInterface::ABSOLUTE_URL),\n            ]);\n        }\n\n        $this->paymentStateManager->complete($payment);\n\n        $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT);\n        $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_COMPLETE);\n\n        $this->orderManager->flush();\n\n        $request->getSession()->set('sylius_order_id', $order->getId());\n\n        return new JsonResponse([\n            'return_url' => $this->router->generate('sylius_shop_order_thank_you', [], UrlGeneratorInterface::ABSOLUTE_URL),\n        ]);\n    }\n\n    private function getStateMachine(): StateMachineInterface\n    {\n        if ($this->stateMachine instanceof FactoryInterface) {\n            return new WinzouStateMachineAdapter($this->stateMachine);\n        }\n\n        return $this->stateMachine;\n    }\n\n    private function verify(PaymentInterface $payment): void\n    {\n        $totalAmount = $this->getTotalPaymentAmountFromPaypal($payment);\n\n        if ($payment->getOrder()->getTotal() !== $totalAmount) {\n            throw new \\Exception();\n        }\n    }\n\n    private function getTotalPaymentAmountFromPaypal(PaymentInterface $payment): int\n    {\n        $details = $payment->getDetails();\n\n        return $details['payment_amount'] ?? 0;\n    }\n}\n```\n\nAnd to overwrite `CaptureAction` with modified logic:\n\n```php\n<?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Payum\\Action;\n\nuse Payum\\Core\\Action\\ActionInterface;\nuse Payum\\Core\\Exception\\RequestNotSupportedException;\nuse Payum\\Core\\Request\\Capture;\nuse Sylius\\Component\\Core\\Model\\PaymentInterface;\nuse Sylius\\Component\\Core\\Model\\PaymentMethodInterface;\nuse Sylius\\PayPalPlugin\\Api\\CacheAuthorizeClientApiInterface;\nuse Sylius\\PayPalPlugin\\Api\\CreateOrderApiInterface;\nuse Sylius\\PayPalPlugin\\Payum\\Action\\StatusAction;\nuse Sylius\\PayPalPlugin\\Provider\\UuidProviderInterface;\n\nfinal class CaptureAction implements ActionInterface\n{\n    public function __construct(\n        private CacheAuthorizeClientApiInterface $authorizeClientApi,\n        private CreateOrderApiInterface $createOrderApi,\n        private UuidProviderInterface $uuidProvider,\n    ) {\n    }\n\n    /** @param Capture $request */\n    public function execute($request): void\n    {\n        RequestNotSupportedException::assertSupports($this, $request);\n\n        /** @var PaymentInterface $payment */\n        $payment = $request->getModel();\n        /** @var PaymentMethodInterface $paymentMethod */\n        $paymentMethod = $payment->getMethod();\n\n        $token = $this->authorizeClientApi->authorize($paymentMethod);\n\n        $referenceId = $this->uuidProvider->provide();\n        $content = $this->createOrderApi->create($token, $payment, $referenceId);\n\n        if ($content['status'] === 'CREATED') {\n            $payment->setDetails([\n                'status' => StatusAction::STATUS_CAPTURED,\n                'paypal_order_id' => $content['id'],\n                'reference_id' => $referenceId,\n                'payment_amount' => $payment->getAmount(),\n            ]);\n        }\n    }\n\n    public function supports($request): bool\n    {\n        return\n            $request instanceof Capture &&\n            $request->getModel() instanceof PaymentInterface\n        ;\n    }\n}\n\n```\n\nAfter that, register services in the container when using PayPal 1.x:\n\n```yaml\nservices:\n    App\\Controller\\ProcessPayPalOrderAction:\n        class: App\\Controller\\ProcessPayPalOrderAction\n        public: true\n        arguments:\n            - '@sylius.repository.customer'\n            - '@sylius.factory.customer'\n            - '@sylius.factory.address'\n            - '@sylius.manager.order'\n            - '@sylius_abstraction.state_machine'\n            - '@Sylius\\PayPalPlugin\\Manager\\PaymentStateManagerInterface'\n            - '@Sylius\\PayPalPlugin\\Api\\CacheAuthorizeClientApiInterface'\n            - '@Sylius\\PayPalPlugin\\Api\\OrderDetailsApiInterface'\n            - '@Sylius\\PayPalPlugin\\Provider\\OrderProviderInterface'\n\n    Sylius\\PayPalPlugin\\Controller\\ProcessPayPalOrderAction:\n        alias: App\\Controller\\ProcessPayPalOrderAction\n\n    App\\Controller\\CompletePayPalOrderFromPaymentPageAction:\n        class: App\\Controller\\CompletePayPalOrderFromPaymentPageAction\n        public: true\n        arguments:\n            - '@Sylius\\PayPalPlugin\\Manager\\PaymentStateManagerInterface'\n            - '@router'\n            - '@Sylius\\PayPalPlugin\\Provider\\OrderProviderInterface'\n            - '@sylius_abstraction.state_machine'\n            - '@sylius.manager.order'\n            - '@sylius.order_processing.order_processor'\n\n    Sylius\\PayPalPlugin\\Controller\\CompletePayPalOrderFromPaymentPageAction:\n        alias: App\\Controller\\CompletePayPalOrderFromPaymentPageAction\n\n    Sylius\\PayPalPlugin\\Payum\\Action\\CaptureAction:\n        class: App\\Payum\\Action\\CaptureAction\n        public: true\n        arguments:\n            - '@Sylius\\PayPalPlugin\\Api\\CacheAuthorizeClientApiInterface'\n            - '@Sylius\\PayPalPlugin\\Api\\CreateOrderApiInterface'\n            - '@Sylius\\PayPalPlugin\\Provider\\UuidProviderInterface'\n        tags:\n            - { name: 'payum.action', factory: 'sylius.pay_pal', alias: 'payum.action.capture' }\n```\n\nor when using PayPal 2.x:\n\n```yaml\nservices:\n    App\\Controller\\ProcessPayPalOrderAction:\n        class: App\\Controller\\ProcessPayPalOrderAction\n        public: true\n        arguments:\n            - '@sylius.repository.customer'\n            - '@sylius.factory.customer'\n            - '@sylius.factory.address'\n            - '@sylius.manager.order'\n            - '@sylius_abstraction.state_machine'\n            - '@sylius_paypal.manager.payment_state'\n            - '@sylius_paypal.api.cache_authorize_client'\n            - '@sylius_paypal.api.order_details'\n            - '@sylius_paypal.provider.order'\n\n    sylius_paypal.controller.process_paypal_order:\n        alias: App\\Controller\\ProcessPayPalOrderAction\n\n    App\\Controller\\CompletePayPalOrderFromPaymentPageAction:\n        class: App\\Controller\\CompletePayPalOrderFromPaymentPageAction\n        public: true\n        arguments:\n            - '@sylius_paypal.manager.payment_state'\n            - '@router'\n            - '@sylius_paypal.provider.order'\n            - '@sylius_abstraction.state_machine'\n            - '@sylius.manager.order'\n            - '@sylius.order_processing.order_processor'\n\n    sylius_paypal.controller.complete_paypal_order_from_payment_page:\n        alias: App\\Controller\\CompletePayPalOrderFromPaymentPageAction\n\n    sylius_paypal.payum.action.capture:\n        class: App\\Payum\\Action\\CaptureAction\n        public: true\n        arguments:\n            - '@sylius_paypal.api.cache_authorize_client'\n            - '@sylius_paypal.api.create_order'\n            - '@sylius_paypal.provider.uuid'\n        tags:\n            - { name: 'payum.action', factory: 'sylius.paypal', alias: 'payum.action.capture' }\n```\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [Sylius issues](https://github.com/Sylius/Sylius/issues)\n* Email us at security@sylius.com",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sylius/paypal-plugin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.6.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sylius/paypal-plugin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.7.0"
      }, {
        "fixed" : "1.7.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sylius/paypal-plugin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Sylius/PayPalPlugin/security/advisories/GHSA-pqq3-q84h-pj6x"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-29788"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Sylius/PayPalPlugin/commit/31e71b0457e5d887a6c19f8cfabb8b16125ec406"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Sylius/PayPalPlugin/commit/8a81258f965b7860d4bccb52942e4c5b53e6774d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Sylius/PayPalPlugin"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Sylius/PayPalPlugin/releases/tag/v1.6.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Sylius/PayPalPlugin/releases/tag/v1.7.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Sylius/PayPalPlugin/releases/tag/v2.0.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-472" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-17T21:26:50Z",
    "nvd_published_at" : "2025-03-17T14:15:22Z"
  }
}