Business Logic Flaw - A non premium user can change/update retailers to get cashback on all the retailers associated with Curve
A non-premium user is limited to three cashback retailers, but by tampering with the client-side response of the retailer list endpoint the app can be tricked into letting the user pick a fresh set of three retailers. This lets the user rotate retailers repeatedly and earn cashback across all merchants rather than the three allowed.
- Triaged in 14 days
- Fixed in 26 days
- Paid in 26 days
- Disclosed after 11 months
Hi,
While testing your android application I've found a business logic flaw by using which a non premium user can update/change the retailers when ever and what ever retailers he wants to.
Curve application has a functionality called "Earn curve cash". A non premium user can select only 3 retailers (where as premium user can select 6 or more retailers) at a time. A business logic flaw exists at this endpoint by using which a non premium user can update/change already existing retailers and can use cashback with all the retailers associated with curve application.
Steps to reproduce:
1] Login to non premium user account 2] Navigate to "Earn curve cash" and you can select only 3 retailers (because you are non premium user) 3] And click on "Confirm" 4] You have now added 3 retailers to your account and you dont have any option to edit/update the added retailers. 5] Now go back to "Earn curve cash" functionality and make sure to capture the request and response
Request:
GET /v1/rewards/users/programs/e329e463-7f5d-4358-9109-4f97c9f86abd/merchants HTTP/1.1
Accept: application/json
Curve-UserAgent: Android;Genymotion;Custom Phone
Curve-AppAndVersion: Curve Android 2.9.0
crv-user-agent: Android 2.9.0/20900
Authorization: APE7kg446BXw2iFEI6Ca079RaGrJ3bcelA9DKDoUFUA
crv-idempotency-key: a161ccfc-077c-4099-a180-ebbbacb50da6
crv-request-id: 88fb2296-46f4-49e4-858f-8aff312a9587
crv-correlation-id: android-98600fe2-6b09-48d8-94b1-cecf73094c43
Host: api.imaginecurve.com
Connection: close
Accept-Encoding: gzip, deflate
User-Agent: okhttp/3.12.2
Response:
HTTP/1.1 200 OK
Date: Tue, 13 Aug 2019 14:55:30 GMT
Content-Type: application/json
Connection: close
server: envoy
cache-control: no-cache, private
set-cookie: device_view=full; expires=Fri, 13-Sep-2019 14:55:30 GMT; Max-Age=2678400; path=/; HttpOnly
x-envoy-upstream-service-time: 48
Content-Length: 734
{"success":true,"data":{"merchants":[{"id":"7603f8b7-407c-4234-9153-7fe3b29863ed","name":"Waitrose","alias":"waitrose","hidden":false,"countries":["GBR"],"category":{"id":"0856b35f-ea59-479a-8f25-b70772d39dc8","name":"Groceries","curve_category_id":10},"percentage":1},{"id":"ca6daefd-f772-4286-9d70-504b094a98b8","name":"Whole Foods","alias":"wholefoods","hidden":false,"countries":["GBR"],"category":{"id":"0856b35f-ea59-479a-8f25-b70772d39dc8","name":"Groceries","curve_category_id":10},"percentage":1},{"id":"efb47f27-d905-4047-889c-f4da68e5a9b3","name":"Tesco","alias":"tesco","hidden":false,"countries":["GBR"],"category":{"id":"0856b35f-ea59-479a-8f25-b70772d39dc8","name":"Groceries","curve_category_id":10},"percentage":1}]}}
6] Now change the response body with below JSON content and turn off the burp interception
{"success":true,"data":{"merchants":[]}}
7] Now you can again select any three new retailers and click on "Confirm" 8] You have now successfully updated/changed the retailers and can use the cashback on all the retailers associated with curve application.
For better understanding I've attached video POC below.
Impact
A non premium user can miss-use the business logic and can use cashback's with all the merchants associated with the curve application.
Mitigation:
Make sure to validate the responses and user based authorization for each endpoint on the server-side.
Regards, Praseudo
Context
Curve is a card product with an Android application that talks to api.imaginecurve.com. One of the app's features is called "Earn curve cash": the user picks a set of retailers, and purchases made at those retailers earn cashback. The number of retailers a user may select depends on their plan. A non premium user can select only 3 retailers, whereas a premium user can select 6 or more at a time.
The report describes a business logic flaw in the endpoint that serves the retailer list for this feature. By manipulating the response returned to the app, a non premium user can get past the 3 retailer limit and, according to the researcher, use cashback with all the retailers associated with Curve.
Setup
- A non premium Curve user account.
- The Curve Android application, version 2.9.0, running on a Genymotion emulator ("Custom Phone").
- An intercepting proxy (Burp is named in the steps) to capture and modify the request and response.
- No special role or privilege is required beyond a normal non premium account.
The precondition is simply that the account has already selected its 3 retailers, because the app offers no way to edit or update them afterwards.
Finding it
The researcher was testing the Android application and noticed that the retailer selection for "Earn curve cash" is limited by plan: 3 retailers for a non premium user, 6 or more for a premium user. After confirming the 3 retailers, the app gives no option to edit or update the added retailers.
That raised the question of where the limit is enforced. The app fetches the retailer list from the API, and the researcher captured that call. The researcher captured that call and altered the response in transit, which allowed another round of picks.
Exploitation
Step 1: log in as a non premium user
Log in to a non premium user account in the Android application.
Step 2: open "Earn curve cash"
Navigate to "Earn curve cash". Because the account is non premium, only 3 retailers can be selected.
Step 3: confirm the selection
Select the retailers and click "Confirm".
Step 4: note the missing edit option
At this point 3 retailers are added to the account, and there is no option in the app to edit or update the added retailers.
Step 5: capture the request and response
Go back to the "Earn curve cash" functionality and capture the request and response. The captured request is:
GET /v1/rewards/users/programs/e329e463-7f5d-4358-9109-4f97c9f86abd/merchants HTTP/1.1
Accept: application/json
Curve-UserAgent: Android;Genymotion;Custom Phone
Curve-AppAndVersion: Curve Android 2.9.0
crv-user-agent: Android 2.9.0/20900
Authorization: [redacted]
crv-idempotency-key: a161ccfc-077c-4099-a180-ebbbacb50da6
crv-request-id: 88fb2296-46f4-49e4-858f-8aff312a9587
crv-correlation-id: android-98600fe2-6b09-48d8-94b1-cecf73094c43
Host: api.imaginecurve.com
Connection: close
Accept-Encoding: gzip, deflate
User-Agent: okhttp/3.12.2
The request is a GET against the rewards program identified by e329e463-7f5d-4358-9109-4f97c9f86abd, asking for the merchants available to the user. It carries the bearer-style Authorization header, several Curve-specific headers identifying the client (Curve-UserAgent, Curve-AppAndVersion, crv-user-agent), an idempotency key, request and correlation identifiers, and the standard OkHttp user agent. The response was:
HTTP/1.1 200 OK
Date: Tue, 13 Aug 2019 14:55:30 GMT
Content-Type: application/json
Connection: close
server: envoy
cache-control: no-cache, private
set-cookie: device_view=full; expires=Fri, 13-Sep-2019 14:55:30 GMT; Max-Age=2678400; path=/; HttpOnly
x-envoy-upstream-service-time: 48
Content-Length: 734
{"success":true,"data":{"merchants":[{"id":"7603f8b7-407c-4234-9153-7fe3b29863ed","name":"Waitrose","alias":"waitrose","hidden":false,"countries":["GBR"],"category":{"id":"0856b35f-ea59-479a-8f25-b70772d39dc8","name":"Groceries","curve_category_id":10},"percentage":1},{"id":"ca6daefd-f772-4286-9d70-504b094a98b8","name":"Whole Foods","alias":"wholefoods","hidden":false,"countries":["GBR"],"category":{"id":"0856b35f-ea59-479a-8f25-b70772d39dc8","name":"Groceries","curve_category_id":10},"percentage":1},{"id":"efb47f27-d905-4047-889c-f4da68e5a9b3","name":"Tesco","alias":"tesco","hidden":false,"countries":["GBR"],"category":{"id":"0856b35f-ea59-479a-8f25-b70772d39dc8","name":"Groceries","curve_category_id":10},"percentage":1}]}}
The body lists the merchants in data.merchants, each with an id, name, alias, hidden flag, supported countries, a category object and a percentage (1 in each entry shown). The response is served through envoy and sets a device_view cookie.
Step 6: replace the response body
With interception still on, change the response body to the following JSON and turn off Burp interception:
{"success":true,"data":{"merchants":[]}}
This returns an empty merchant list to the app while keeping the success flag true.
Step 7: select three new retailers
With the list empty, the app allows any three new retailers to be selected again. Click "Confirm".
Step 8: the selection has been changed
The retailers have now been updated/changed, and the researcher reports that cashback can be used on all the retailers associated with the Curve application.
The video proof of concept shows the flow end to end:
Root cause
The flaw is a business logic error: by emptying data.merchants in the response, the researcher was able to change the selection. By emptying data.merchants, the app is convinced that no retailers are selected, so it offers the selection screen again and accepts another three picks.
The report does not show the submission request, so the exact server-side check that is missing is not documented.
Impact
A non premium user can misuse the business logic to obtain cashback with all the merchants associated with the Curve application, which is a benefit reserved for premium users. The report rates this as medium severity (CVSS 4.3). The user gains cashback on retailers they should not be eligible for.
Fix
The researcher's mitigation is to validate the responses and enforce user-based authorisation for each endpoint on the server side.
Variants to test
- Empty-list response tampering on other selection endpoints. Intercept the response that lists a user's current selections (retailers, saved cards, favourite categories) and replace the list with an empty array. A positive result is the client offering the selection screen again and the server accepting a new selection beyond the plan limit.
- Plan-limit bypass on submission. Capture the request that submits the selection and add extra merchant IDs beyond the allowed count. A positive result is a
200response and the extra merchants appearing in the user's account. - Repeated selection cycles. After each successful change, repeat the response tampering to see whether the server accumulates selections rather than replacing them. A positive result is a growing set of merchants with cashback, rather than a fixed set of three.
- Cross-account program IDs. Change the program identifier in the path (
e329e463-7f5d-4358-9109-4f97c9f86abdin the captured request) to another user's or another program's identifier. A positive result is a200with merchant data that should not be visible to the current user. - Client header manipulation. Alter the
Curve-AppAndVersionorcrv-user-agentheaders to a premium build string. A positive result is the server returning a larger merchant list or accepting more than three selections.
What happened, in plain words
Curve is a card product: you get a card and an Android app, and the app talks over the internet to Curve's servers at api.imaginecurve.com. One of the app's features is called "Earn curve cash". You pick a set of shops (the report calls them retailers or merchants), and when you spend money at those shops you get a small amount of money back, called cashback. How many shops you may pick depends on your plan. A non premium user may pick only 3 shops. A premium user may pick 6 or more at a time.
The researcher found a business logic flaw in the part of Curve's system that gives the app the list of shops for this feature. By changing the answer the server sends back to the app while it is travelling, the researcher got past the 3 shop limit and, according to the report, could earn cashback at all the shops associated with Curve.
"Business logic flaw" means the software does exactly what it was programmed to do, but the rules of the business (here: only 3 shops for a non premium user) are not enforced in the right place. Nothing crashes and no password is stolen. The program simply trusts something it should not trust.
A useful everyday comparison: imagine a form at a shop that says "you may choose three free samples". The rule exists, but it is checked against a piece of paper you control.
The pieces you need to understand first
- API: the way the app and the server talk to each other. The app sends a request ("give me the list of shops"), and the server sends back a response ("here is the list"). Think of a waiter taking your order to the kitchen and bringing back a plate.
- Endpoint: one specific address on the server that does one specific job. The endpoint in this report is the one that returns the shop list for the rewards program.
- Request and response: the message the app sends, and the message the server sends back. Both have a header part (metadata, like who is asking) and often a body (the actual content).
- Header: a line of metadata attached to a request or response, such as
Accept: application/json("I would like JSON back") orAuthorization: ...("here is proof of who I am"). - Token / Authorization header: a long string that proves the app is logged in as a particular user. It works like a wristband at an event: show it and you are let in, without giving your password again. In this report the value is a secret, so it is replaced with
[redacted]below. - Cookie: a small piece of data the server asks the app to keep and send back next time, often used to remember something about the session. The response here sets one called
device_view. - JSON: a text format for structured data, made of names and values in curly braces.
{"success":true}means "the field named success has the value true". - Intercepting proxy: a tool that sits between the app and the server, like a post office that opens every letter, shows it to you, lets you rewrite it, and then sends it on. Burp is the tool named in the steps. The researcher ran the Android app on a Genymotion emulator, which is an Android phone simulated on a computer, so the traffic could be routed through the proxy.
- Idempotency key: a unique value attached to a request so that if the same request is accidentally sent twice, the server can recognise the duplicate and not do the action twice. Like a numbered ticket for a single transaction.
- Correlation ID / request ID: identifiers added so that logs on different systems can be matched to the same request later.
- Envoy: a piece of server software that sits in front of the application and forwards traffic to it. The response header
server: envoyshows it was in the path. - OkHttp: a common library that Android apps use to make HTTP requests. Its name appears in the
User-Agentheader.
Setup
To follow the same path you would need:
- A non premium Curve user account.
- The Curve Android application, version 2.9.0, running on a Genymotion emulator ("Custom Phone").
- An intercepting proxy (Burp is named in the steps) to capture and modify the request and response.
- No special role or privilege beyond a normal non premium account.
The only precondition is that the account has already picked its 3 shops, because the app offers no way to edit or update them afterwards. That last point is the interesting one: if the app will not let you change your picks, where is the limit actually enforced?
Finding it
The researcher was testing the Android application and noticed that the shop selection for "Earn curve cash" is limited by plan: 3 shops for a non premium user, 6 or more for a premium user. After confirming the 3 shops, the app gives no option to edit or update them.
That raised the question of where the limit lives. The app fetches the shop list from the API, and the researcher captured that call. The reasoning is: if the app simply trusts the list it receives, and the server does not re-check the user's plan or the current selection when the list is submitted, then altering the response on its way to the app could make the app believe nothing is selected, and allow another round of picks.
Exploitation
Step 1: log in as a non premium user
Log in to a non premium user account in the Android application. The plan matters because it is the thing the limit is supposed to depend on.
Step 2: open "Earn curve cash"
Navigate to "Earn curve cash". Because the account is non premium, only 3 shops can be selected. This is the normal, intended behaviour.
Step 3: confirm the selection
Select the shops and click "Confirm". This stores the selection on the account.
Step 4: note the missing edit option
At this point 3 shops are added to the account, and there is no option in the app to edit or update the added shops. The app has closed the door on changes, which is exactly why the next step is interesting: the researcher wants to see whether the server has closed the door too, or only the app has.
Step 5: capture the request and response
Go back to the "Earn curve cash" functionality and capture the request and response. The captured request is:
GET /v1/rewards/users/programs/e329e463-7f5d-4358-9109-4f97c9f86abd/merchants HTTP/1.1
Accept: application/json
Curve-UserAgent: Android;Genymotion;Custom Phone
Curve-AppAndVersion: Curve Android 2.9.0
crv-user-agent: Android 2.9.0/20900
Authorization: [redacted]
crv-idempotency-key: a161ccfc-077c-4099-a180-ebbbacb50da6
crv-request-id: 88fb2296-46f4-49e4-858f-8aff312a9587
crv-correlation-id: android-98600fe2-6b09-48d8-94b1-cecf73094c43
Host: api.imaginecurve.com
Connection: close
Accept-Encoding: gzip, deflate
User-Agent: okhttp/3.12.2
Line by line:
GET /v1/rewards/users/programs/e329e463-7f5d-4358-9109-4f97c9f86abd/merchants HTTP/1.1is the request line.GETmeans "give me something, I am not changing anything". The path points at the merchants (shops) belonging to one rewards program, identified by the long codee329e463-7f5d-4358-9109-4f97c9f86abd.HTTP/1.1is the version of the language being spoken.Accept: application/jsontells the server the app would like the answer in JSON.Curve-UserAgent,Curve-AppAndVersionandcrv-user-agentare Curve's own headers describing the client: an Android app, version 2.9.0, running on a Genymotion emulator shown as "Custom Phone".Authorization: [redacted]is the proof that the request comes from a logged-in user. It is a secret, so it is hidden here.crv-idempotency-key,crv-request-idandcrv-correlation-idare unique identifiers for this one request, used for duplicate protection and for matching log entries.Host: api.imaginecurve.comsays which server is being asked.Connection: closeasks to close the connection after the answer.Accept-Encoding: gzip, deflatesays the app can accept compressed answers.User-Agent: okhttp/3.12.2names the library the app uses to make the request.
The response was:
HTTP/1.1 200 OK
Date: Tue, 13 Aug 2019 14:55:30 GMT
Content-Type: application/json
Connection: close
server: envoy
cache-control: no-cache, private
set-cookie: device_view=full; expires=Fri, 13-Sep-2019 14:55:30 GMT; Max-Age=2678400; path=/; HttpOnly
x-envoy-upstream-service-time: 48
Content-Length: 734
{"success":true,"data":{"merchants":[{"id":"7603f8b7-407c-4234-9153-7fe3b29863ed","name":"Waitrose","alias":"waitrose","hidden":false,"countries":["GBR"],"category":{"id":"0856b35f-ea59-479a-8f25-b70772d39dc8","name":"Groceries","curve_category_id":10},"percentage":1},{"id":"ca6daefd-f772-4286-9d70-504b094a98b8","name":"Whole Foods","alias":"wholefoods","hidden":false,"countries":["GBR"],"category":{"id":"0856b35f-ea59-479a-8f25-b70772d39dc8","name":"Groceries","curve_category_id":10},"percentage":1},{"id":"efb47f27-d905-4047-889c-f4da68e5a9b3","name":"Tesco","alias":"tesco","hidden":false,"countries":["GBR"],"category":{"id":"0856b35f-ea59-479a-8f25-b70772d39dc8","name":"Groceries","curve_category_id":10},"percentage":1}]}}
Line by line:
HTTP/1.1 200 OKis the status line.200means "success, here is your answer".Dateis when the server produced the response.Content-Type: application/jsonsays the body is JSON.Connection: closeconfirms the connection will be closed.server: envoyshows the answer passed through Envoy, the forwarding software mentioned above.cache-control: no-cache, privatetells any cache not to store this answer and that it is specific to this user.set-cookie: device_view=full; ...; HttpOnlyasks the app to remember a cookie nameddevice_viewwith the valuefull, with an expiry date and a path.HttpOnlymeans scripts inside a web page cannot read it; it is a safety measure for cookies.x-envoy-upstream-service-time: 48is how long, in milliseconds, the application behind Envoy took to answer.Content-Length: 734is the size of the body in bytes.- The body is the JSON.
successistrue, anddata.merchantsis a list of three shops: Waitrose, Whole Foods and Tesco. Each entry has anid(a unique code for the shop), aname, analias(a short machine-friendly name), ahiddenflag, thecountrieswhere it applies (GBR), acategoryobject (here "Groceries") and apercentageof 1, which is the cashback rate.
So the server is telling the app: "these three shops are the ones this user has picked". The app uses that list to decide what to show on the selection screen.
Step 6: replace the response body
With interception still on, change the response body to the following JSON and turn off Burp interception:
{"success":true,"data":{"merchants":[]}}
This returns an empty shop list to the app while keeping the success flag true. In plain words: the note handed to the assistant now says "zero samples taken". The app has no reason to doubt it, because the answer still claims to be a success.
Step 7: select three new shops
With the list empty, the app allows any three new shops to be selected again. Click "Confirm".
Step 8: the selection has been changed
The shops have now been updated or changed, and the researcher reports that cashback can be used on all the shops associated with the Curve application.
The video proof of concept shows the flow end to end:
Why it works
The flaw is a business logic error. The flaw is a business logic error: by emptying data.merchants in the response, the researcher was able to change the selection. By emptying data.merchants, the app is convinced that no shops are selected, so it offers the selection screen again and accepts another three picks.
The report does not show the submission request, so the exact server-side check that is missing is not documented.
Impact
A non premium user can misuse the business logic to obtain cashback with all the merchants associated with the Curve application, which is a benefit reserved for premium users. The report rates this as medium severity (CVSS 4.3). The user gains cashback on shops they should not be eligible for.
Fix
The researcher's mitigation is to validate the responses and enforce user-based authorisation for each endpoint on the server side.
Variants to test
- Empty-list response tampering on other selection endpoints. Intercept the response that lists a user's current selections (shops, saved cards, favourite categories) and replace the list with an empty array. A positive result is the client offering the selection screen again and the server accepting a new selection beyond the plan limit.
- Plan-limit bypass on submission. Capture the request that submits the selection and add extra merchant IDs beyond the allowed count. A positive result is a
200response and the extra merchants appearing in the user's account. - Repeated selection cycles. After each successful change, repeat the response tampering to see whether the server accumulates selections rather than replacing them. A positive result is a growing set of merchants with cashback, rather than a fixed set of three.
- Cross-account program IDs. Change the program identifier in the path (
e329e463-7f5d-4358-9109-4f97c9f86abdin the captured request) to another user's or another program's identifier. A positive result is a200with merchant data that should not be visible to the current user. - Client header manipulation. Alter the
Curve-AppAndVersionorcrv-user-agentheaders to a premium build string. A positive result is the server returning a larger merchant list or accepting more than three selections.
Glossary
- API: the agreed way for two programs to talk to each other over a network; the app asks, the server answers.
- Endpoint: one specific address on a server that performs one specific job.
- Request: the message an app sends to a server.
- Response: the message a server sends back.
- Header: a line of metadata attached to a request or response, such as
AcceptorAuthorization. - Body: the main content of a request or response, often JSON.
- JSON: a text format for structured data using names and values in curly braces.
- Token: a secret string that proves who you are, used instead of sending a password each time.
- Authorization header: the header that carries that proof.
- Cookie: a small piece of data a server asks the client to store and send back later.
- Session: the period during which a client is recognised as logged in.
- Intercepting proxy: a tool placed between app and server that can show and modify traffic; Burp is one.
- Emulator: software that imitates a phone on a computer; Genymotion imitates Android.
- Idempotency key: a unique value that lets a server recognise a repeated request and avoid doing the action twice.
- Correlation ID / request ID: identifiers used to match log entries belonging to the same request.
- Envoy: server software that forwards traffic to the application behind it.
- OkHttp: a library Android apps use to make HTTP requests.
- User-Agent: a header naming the client software.
- HTTP status code: a number in the response saying how it went;
200means success. - Business logic flaw: a weakness where the software works as programmed but the rules of the business are not enforced in the right place.
- Cashback: money returned to the customer as a small percentage of a purchase.
- Premium user: a user on a paid plan with more features or higher limits.
- Server-side validation: checking the rules on the server, where the user cannot change them, rather than trusting the app.
- Authorisation: deciding whether a logged-in user is allowed to do a particular thing.
- CVSS: a standard scoring system for the severity of a security issue; 4.3 is in the medium range.
- Proof of concept (POC): a demonstration that the issue really works, often a video or screenshots.