Skip to content
CSRF Disclosed report Intermediate

CSRF on connecting Paypal as Payment Provider

The endpoint that completes the PayPal onboarding flow accepted a GET request whose only CSRF defence was a fixed, store-specific merchantId value. An attacker who knows that value, for example a former admin or someone who saw it leaked, could make a victim's browser connect the victim's store to the attacker's PayPal account.

ngalog Follow

Originally disclosed on HackerOne

  • Triaged in 3 days
  • Fixed in 37 days
  • Paid in 4 days
  • Disclosed after 40 days

Hi,

I think there is a weak csrf protection on adding paypal as the payment provider, but the protection is not good. When user try to add paypal as payment provider, they will make this GET request

https://h60ngalog.myshopify.com/admin/payments/complete_paypal_incontext_oauth/41?merchantId=MTU4MzAzMDUwNDowMTBmMDZkYjg1NzM0YjQ4NWVkMDk1YzQ1YWYxY2ZlNw%3D%3D&merchantIdInPayPal=5NS8DHQCFGT84&permissionsGranted=true&accountStatus=BUSINESS_ACCOUNT&consentStatus=true&productIntentID=addipmt&productIntentId=addipmt&isEmailConfirmed=true

The merchantId belongs to your store only, and the base64 decoded value is 1583030504:010f06db85734b485ed095c45af1cfe7 which is obviously too long to brute force, I'll say it is a pretty good way to mitigate CSRF, however there is one catch. This value is fixed, i.e. if someone who previously was an admin of this store before, then he/she can take advantage of this fixed value for CSRF protection, and perfomr CSRF attack on victim to connect victim's payment provider to their Paypal order. Or this value is leaked somewhere, then the store owner is forever vulnerable to CSRF attack

Steps to reproduce

  • Visit https://YOURDOMAIN.myshopify.com/admin/settings/payments, if there is already paypal account connected, disconnect it first
  • Then click the link Acitivate paypal express checkout
  • In the link, jot down the value of merchantId, this merchantId belongs to your store only, in order to connect your store to victim's store, you'll need this parameter, it looks like this MTU4MzAzMDUwNDowMTBmMDZkYjg1NzM0YjQ4NWVkMDk1YzQ1YWYxY2ZlNw%3D%3D
  • Finally, visit this link with merchantId replaced with the value you got from above step (replace YOUTSUBDOMAIN and REPLACEME)

https://YOURSUBDOMAIN.myshopify.com/admin/payments/complete_paypal_incontext_oauth/41?merchantId=REPLACEME&merchantIdInPayPal=5NS8DHQCFGT84&permissionsGranted=true&accountStatus=BUSINESS_ACCOUNT&consentStatus=true&productIntentID=addipmt&productIntentId=addipmt&isEmailConfirmed=true

Here in 5NS8DHQCFGT84 is the attacker's paypal merchant id, so after you visit that link, you got CSRFed to connect your store to my paypal as payment provider, very similar to #807921 but different impact

Impact

CSRFed to connect your store to my paypal as payment provider, very similar to #807921 but different impact

The original report as published on HackerOne, by ngalog. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the OAuth completion endpoint used a GET request and relied on a static, per-store merchantId as its anti-CSRF token instead of a fresh, unpredictable, single-use value.

Impact

A victim could be CSRFed into connecting their store to the attacker's PayPal account as the payment provider.

What the attacker needed

Attacker knows the store's fixed merchantId; victim is logged in as store admin; victim visits attacker's link

How it was found

  1. Open the payments settings page and disconnect any existing PayPal account.
  2. Click the link to activate PayPal express checkout.
  3. Note the merchantId value from the resulting URL.
  4. Visit the completion URL on the victim's store with the attacker's merchantId and PayPal merchant id substituted.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

CSRF (cross-site request forgery) is when a malicious page makes your logged-in browser send a request you did not intend. Here the request that links a PayPal account to a shop could be triggered by simply visiting a link, because the only check was a value that never changes for that shop. Anyone who once saw that value could reuse it to attach their own PayPal account to the shop.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

More by ngalog

View all

21 more disclosed reports, best first.

More from Shopify

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.