Kestrel
대시보드로 돌아가기
CVE-2026-53639MEDIUMGHSA대응게시일: 2026. 07. 09.수정일: 2026. 07. 09.

Sylius: IDOR on Shop Payment Request API endpoints

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
medium

이론적 심각도 점수

EPSS

예측 데이터 없음

KEV
미등재

실측 악용 기록 없음

권장 대응 기한60일 이내CISA SSVC 기준

계획된 패치 주기 내 조치(60일 이내)

외부 노출· KEV 미등재 · 자동화 어려움 · 부분 영향 · 외부 노출

CVSS 벡터 · 메트릭

CVSS 벡터 정보 없음

상세 설명

Impact

The GET /api/v2/shop/payment-requests/{hash} and PUT /api/v2/shop/payment-requests/{hash} endpoints look up the payment request solely by the hash from the URL. No ownership check is performed against the authenticated customer or the underlying order.

An attacker who obtains a payment request hash can:

  • read the payment request and, through the payment IRI in the response, recover the underlying order's tokenValue (which itself grants access to the full order, items, addresses, customer email, totals);
  • update the payment request payload (e.g. target_path, after_path). These fields are used by the front-end controller to redirect the user after the payment, so an attacker can flip them to an attacker-controlled URL and intercept the buyer.

The hash is a UUID, so it has to be obtained out-of-band (logs, shared links, referrer headers, a co-located client), but once it is known no other credential is required, neither authentication nor knowledge of the order token.

The creation endpoint POST /api/v2/shop/orders/{tokenValue}/payment-requests shares the same flaw: it resolves the target order solely from the tokenValue in the URL without verifying that the caller owns the order.

Patches

The issue is fixed in versions: 2.0.18, 2.1.15, 2.2.6.

Workarounds

Until you can upgrade, apply the following workaround. It enforces ownership on the existing endpoints, so that:

  • an authenticated shop user may only access payment requests of their own orders;
  • an anonymous caller may only access payment requests of guest orders (the order's customer has no associated user account);
  • everyone else receives 404 Not Found.
Step 1. Add a query extension that filters the GET operation

Create file src/ApiPlatform/QueryExtension/PaymentRequestOwnershipExtension.php:

bash
1<?php
2
3declare(strict_types=1);
4
5namespace App\ApiPlatform\QueryExtension;
6
7use ApiPlatform\Doctrine\Orm\Extension\QueryItemExtensionInterface;
8use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
9use ApiPlatform\Metadata\Operation;
10use Doctrine\ORM\QueryBuilder;
11use Sylius\Bundle\ApiBundle\Context\UserContextInterface;
12use Sylius\Bundle\ApiBundle\SectionResolver\ShopApiSection;
13use Sylius\Bundle\CoreBundle\SectionResolver\SectionProviderInterface;
14use Sylius\Component\Core\Model\ShopUserInterface;
15use Sylius\Component\Payment\Model\PaymentRequestInterface;
16
17final readonly class PaymentRequestOwnershipExtension implements QueryItemExtensionInterface
18{
19 public function __construct(
20 private SectionProviderInterface $sectionProvider,
21 private UserContextInterface $userContext,
22 ) {
23 }
24
25 public function applyToItem(
26 QueryBuilder $queryBuilder,
27 QueryNameGeneratorInterface $queryNameGenerator,
28 string $resourceClass,
29 array $identifiers,
30 ?Operation $operation = null,
31 array $context = [],
32 ): void {
33 if (!is_a($resourceClass, PaymentRequestInterface::class, true)) {
34 return;
35 }
36
37 if (!$this->sectionProvider->getSection() instanceof ShopApiSection) {
38 return;
39 }
40
41 $rootAlias = $queryBuilder->getRootAliases()[0];
42 $paymentJoin = $queryNameGenerator->generateJoinAlias('payment');
43 $orderJoin = $queryNameGenerator->generateJoinAlias('order');
44 $customerJoin = $queryNameGenerator->generateJoinAlias('customer');
45 $userJoin = $queryNameGenerator->generateJoinAlias('user');
46 $createdByGuestParameterName = $queryNameGenerator->generateParameterName('createdByGuest');
47
48 $queryBuilder
49 ->innerJoin(sprintf('%s.payment', $rootAlias), $paymentJoin)
50 ->innerJoin(sprintf('%s.order', $paymentJoin), $orderJoin)
51 ->leftJoin(sprintf('%s.customer', $orderJoin), $customerJoin)
52 ->leftJoin(sprintf('%s.user', $customerJoin), $userJoin)
53 ;
54
55 $user = $this->userContext->getUser();
56
57 if ($user instanceof ShopUserInterface) {
58 $customerParam = $queryNameGenerator->generateParameterName('customer');
59
60 $queryBuilder
61 ->andWhere($queryBuilder->expr()->eq(sprintf('%s.customer', $orderJoin), sprintf(':%s', $customerParam)))
62 ->setParameter($customerParam, $user->getCustomer())
63 ;
64
65 return;
66 }
67
68 $queryBuilder
69 ->andWhere(
70 $queryBuilder->expr()->orX(
71 $queryBuilder->expr()->isNull($userJoin),
72 $queryBuilder->expr()->isNull(sprintf('%s.customer', $orderJoin)),
73 $queryBuilder->expr()->andX(
74 $queryBuilder->expr()->isNotNull($userJoin),
75 $queryBuilder->expr()->eq(sprintf('%s.createdByGuest', $orderJoin), sprintf(':%s', $createdByGuestParameterName)),
76 ),
77 ),
78 )
79 ->setParameter($createdByGuestParameterName, true)
80 ;
81 }
82}
Step 2. Decorate the PUT state provider

Create file src/ApiPlatform/StateProvider/PaymentRequestOwnershipProvider.php:

bash
1<?php
2
3declare(strict_types=1);
4
5namespace App\ApiPlatform\StateProvider;
6
7use ApiPlatform\Metadata\Operation;
8use ApiPlatform\State\ProviderInterface;
9use Sylius\Bundle\ApiBundle\Context\UserContextInterface;
10use Sylius\Component\Core\Model\CustomerInterface;
11use Sylius\Component\Core\Model\OrderInterface;
12use Sylius\Component\Core\Model\PaymentInterface;
13use Sylius\Component\Core\Model\ShopUserInterface;
14use Sylius\Component\Payment\Model\PaymentRequestInterface;
15
16/** @implements ProviderInterface<PaymentRequestInterface> */
17final readonly class PaymentRequestOwnershipProvider implements ProviderInterface
18{
19 /** @param ProviderInterface<PaymentRequestInterface> $inner */
20 public function __construct(
21 private ProviderInterface $inner,
22 private UserContextInterface $userContext,
23 ) {
24 }
25
26 public function provide(Operation $operation, array $uriVariables = [], array $context = []): array|object|null
27 {
28 $paymentRequest = $this->inner->provide($operation, $uriVariables, $context);
29 if (!$paymentRequest instanceof PaymentRequestInterface) {
30 return $paymentRequest;
31 }
32
33 if (!$this->isAccessible($paymentRequest)) {
34 return null;
35 }
36
37 return $paymentRequest;
38 }
39
40 private function isAccessible(PaymentRequestInterface $paymentRequest): bool
41 {
42 $payment = $paymentRequest->getPayment();
43 if (!$payment instanceof PaymentInterface) {
44 return false;
45 }
46
47 $order = $payment->getOrder();
48 if (!$order instanceof OrderInterface) {
49 return false;
50 }
51
52 $user = $this->userContext->getUser();
53
54 if ($user instanceof ShopUserInterface) {
55 $customer = $user->getCustomer();
56
57 return $customer instanceof CustomerInterface && $order->getCustomer() === $customer;
58 }
59
60 $customer = $order->getCustomer();
61
62 return null === $customer
63 || null === $customer->getUser()
64 || $order->isCreatedByGuest();
65 }
66}
Step 3. Guard the POST creation endpoint with a command-bus middleware

The POST /api/v2/shop/orders/{tokenValue}/payment-requests operation is a messenger: input operation: it dispatches a Sylius\Bundle\ApiBundle\Command\Payment\AddPaymentRequest command whose orderTokenValue comes straight from the URL, so no query extension or state provider runs. Add a middleware on the Sylius command bus that loads the order, applies the same ownership rule, and aborts with 404 before the handler runs.

Create file src/Messenger/Middleware/PaymentRequestOwnershipMiddleware.php:

bash
1<?php
2
3declare(strict_types=1);
4
5namespace App\Messenger\Middleware;
6
7use Sylius\Bundle\ApiBundle\Command\Payment\AddPaymentRequest;
8use Sylius\Bundle\ApiBundle\Context\UserContextInterface;
9use Sylius\Component\Core\Model\CustomerInterface;
10use Sylius\Component\Core\Model\OrderInterface;
11use Sylius\Component\Core\Model\ShopUserInterface;
12use Sylius\Component\Core\Repository\OrderRepositoryInterface;
13use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
14use Symfony\Component\Messenger\Envelope;
15use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
16use Symfony\Component\Messenger\Middleware\StackInterface;
17
18final readonly class PaymentRequestOwnershipMiddleware implements MiddlewareInterface
19{
20 /** @param OrderRepositoryInterface<OrderInterface> $orderRepository */
21 public function __construct(
22 private OrderRepositoryInterface $orderRepository,
23 private UserContextInterface $userContext,
24 ) {
25 }
26
27 public function handle(Envelope $envelope, StackInterface $stack): Envelope
28 {
29 $command = $envelope->getMessage();
30
31 if ($command instanceof AddPaymentRequest && !$this->isOrderAccessible($command->orderTokenValue)) {
32 throw new NotFoundHttpException('Not Found');
33 }
34
35 return $stack->next()->handle($envelope, $stack);
36 }
37
38 private function isOrderAccessible(string $orderTokenValue): bool
39 {
40 /** @var OrderInterface|null $order */
41 $order = $this->orderRepository->findOneByTokenValue($orderTokenValue);
42 if (null === $order) {
43 // Unknown token — let the handler return its own 404 (PaymentNotFoundException).
44 return true;
45 }
46
47 $user = $this->userContext->getUser();
48
49 if ($user instanceof ShopUserInterface) {
50 $customer = $user->getCustomer();
51
52 return $customer instanceof CustomerInterface && $order->getCustomer() === $customer;
53 }
54
55 $customer = $order->getCustomer();
56
57 return null === $customer
58 || null === $customer->getUser()
59 || $order->isCreatedByGuest();
60 }
61}
Step 4. Wire the services

Append to config/services.yaml:

bash
1services:
2 App\ApiPlatform\QueryExtension\PaymentRequestOwnershipExtension:
3 arguments:
4 - '@sylius.section_resolver.uri_based'
5 - '@sylius_api.context.user.token_based'
6 tags:
7 - { name: api_platform.doctrine.orm.query_extension.item }
8
9 App\ApiPlatform\StateProvider\PaymentRequestOwnershipProvider:
10 decorates: sylius_api.state_provider.shop.payment.payment_request.item
11 arguments:
12 $inner: '@.inner'
13 $userContext: '@sylius_api.context.user.token_based'
14
15 App\Messenger\Middleware\PaymentRequestOwnershipMiddleware:
16 arguments:
17 - '@sylius.repository.order'
18 - '@sylius_api.context.user.token_based'

With the default Sylius-Standard services.yaml (autowire: true, autoconfigure: true) the two classes are already autoloaded, the block above only adds the tag and the decoration, which cannot be derived from the constructor signatures.

Step 5. Register the middleware on the Sylius command bus

Add to config/packages/messenger.yaml:

text
1framework:
2 messenger:
3 buses:
4 sylius.command_bus:
5 middleware:
6 - 'App\Messenger\Middleware\PaymentRequestOwnershipMiddleware'
7 - 'validation'
8 - 'doctrine_transaction'
Step 6. Clear the cache
text
1bin/console cache:clear

Reporters

We would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability:

  • Fase Rais Baradika (@baradika)
  • Anshu Chimala (@achimala)

For more information

If you have any questions or comments about this advisory:

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.