Broken Authentication - Security token gets captured via man in the middle attack
The password reset links sent by Instagram Brand used an HTTP scheme instead of HTTPS, so the reset token was transmitted in clear text. An attacker who could intercept network traffic could steal the token and take over accounts.
- Paid in 19 days
- Disclosed after 2.3 years
Product / URL
http://en.instagram-brand.com/register/reset/<the security token here>?email=<email address here>
Description and Impact
The password reset links issues by Instagram Brand gets delivered to users inbox with a http scheme and NOT https scheme.
This causes an attacker stealing those links and performing mass account takeovers and security compromises.
The link that gets delivered in inbox is:
http://mandrillapp.com/track/click/30956340/instagram-brand.com?p=<the very long security token here>
On requesting the above link in browser, it sends back the password reset token in clear text: http://en.instagram-brand.com/register/reset/<the security token here>?email=<the email of user here>
Solution: This issues has a very easy solution. I have myself performed this and it worked !!. Whenever the code responsible for sending password reset link makes those links, just add https as scheme instead of http. And you will observe that now all the accounts are safe and data cannot be stolen.
Reproduction Instructions / Proof of Concept
- Request for you password reset link.
- Go to inbox.
- Right click that link and paste it on notepad and observe the scheme.
- You can also start Wireshark to capture the traffic and observe that security token can be compromised.
I have attached the screenshot of Wireshark as a proof of concept. F161119
Attachments

Context
Instagram Brand (en.instagram-brand.com) is a registration and account management site. Like most such sites it has a password reset feature: a user asks for a reset, the site emails a link, and following the link lets the user set a new password. The link carries a security token that identifies the reset request, plus the user's email address.
The report concerns the scheme used in those emailed links. The reset link is delivered over plain HTTP rather than HTTPS, and the token is exposed in clear text along the way.
Setup
No special accounts, roles or tool versions are described. The researcher needed only:
- An account on the site, so that a password reset could be requested.
- Access to the inbox that receives the reset email.
- A browser to follow the link.
- Wireshark, to capture the traffic and show the token in transit.
The precondition is simply that the reset flow is reachable and that the email is delivered through the usual mail infrastructure.
Finding it
The researcher requested a password reset and looked at the link that arrived in the inbox. The link was not the site's own URL but a tracking URL on the mail provider's domain, and it used the http scheme:
http://mandrillapp.com/track/click/30956340/instagram-brand.com?p=<the very long security token here>
Following that tracking link in a browser returned the actual password reset URL, again over http, with the token and the user's email address in the query string and path:
http://en.instagram-brand.com/register/reset/<the security token here>?email=<the email of user here>
The product URL given at the top of the report is the same shape:
http://en.instagram-brand.com/register/reset/<the security token here>?email=<email address here>
Two things looked wrong. First, a credential-bearing link was issued with a http scheme, so every hop between the mail provider, the user's network and the site could see it in clear text. Second, the tracking redirect hands back the reset token in clear text, so the token is not protected by TLS at any point in the chain.
Exploitation
Step 1: request the reset link
Request a password reset for the account. The site sends the reset email to the inbox.
Step 2: inspect the link in the inbox
Open the inbox, right-click the link and paste it into a text editor. The scheme is http, and the URL is the mail provider's tracking URL shown above, carrying the token in the p parameter.
Step 3: follow the link and observe the redirect target
Requesting the tracking URL in a browser returns the password reset token in clear text:
http://en.instagram-brand.com/register/reset/<the security token here>?email=<the email of user here>
The token sits in the path and the email address in the email query parameter, both over http.
Step 4: capture the traffic
Start Wireshark and repeat the flow. Because the scheme is http, the reset token is visible in the captured traffic. The researcher attached a Wireshark screenshot as proof of concept.

Root cause
The code that builds the password reset link uses http as the scheme instead of https. The link is also wrapped in a mail provider tracking URL that is itself http, and that tracking URL redirects to the reset URL over http. The token therefore travels in clear text in the tracking URL and in the reset URL it returns.
The emailed link, the tracking redirect and the final reset URL were all issued as http. The report does not describe any HSTS behaviour or other mechanism that would have forced an upgrade.
Impact
An attacker who can steal the reset link can capture the token it carries. With a valid token the attacker can complete the reset and take over the account. Because the links are issued to every user who requests a reset, the researcher describes the consequence as mass account takeovers and security compromises, not a single-account issue.
The report does not quantify how many accounts are affected, and it does not show a completed takeover; the evidence is the captured token.
Fix
The researcher states the fix is simple and reports having tried it: when the code responsible for sending the password reset link builds those links, use https as the scheme instead of http. With that change, the researcher says, the accounts are safe and the data cannot be stolen.
Variants to test
- Other transactional emails. Request password resets, email confirmations, invitations and magic links, and check the scheme of every link. A positive result is any link that carries a token over http.
- Tracking redirects. Look at links wrapped by mail providers or marketing platforms. A positive result is a tracking URL over http that redirects to a token-bearing URL, so the token is exposed at the redirect.
- Token in the path or query. Check whether the token appears in the path or in a query parameter, as here, and whether the page that consumes it is served over http. A positive result is a reset page reachable over http with a live token.
- Scheme downgrade after the fix. If the site now issues https links, try the same reset URL with http substituted. A positive result is a redirect that preserves the token in clear text or a page that serves the token over http.
Hunting notes
This kind of bug hides in the code that generates outbound email: password resets, confirmations, invitations and any other message that carries a token. It is easy to miss because the site itself may be served over https while the link in the email is built from a hard-coded scheme or a configuration value that says http.
During recon, request a reset for your own account and read the raw email source rather than the rendered message. Check the scheme of the link, whether it is wrapped by a third-party tracking domain, and what the redirect returns. A tracking URL over http that resolves to a token-bearing URL is the signal.
To show impact, capture the traffic with a tool such as Wireshark and present the token visible in the capture, as the researcher did here. That demonstrates the token is exposed in transit without needing to take over another user's account.
What happened, in plain words
Instagram Brand (at en.instagram-brand.com) is a website where people register and manage an account. Like most sites with accounts, it has a "forgot my password" feature. You type in your email address, the site sends you an email containing a special link, and clicking that link lets you choose a new password.
That link is not just an ordinary web address. It carries a secret code, called a security token, that proves to the site that whoever clicked the link is allowed to reset the password for that particular account. The link also contains the user's email address.
The problem in this report is about how that link is delivered. The link uses a scheme called http instead of https. Think of http as sending a postcard: anyone who handles it along the way can read what is written on it. https is more like a sealed envelope: the contents are scrambled so that people in between cannot read them. Because the reset link travels as a postcard, the secret token inside it can be read by anyone who can watch the traffic. With that token, an attacker can reset the password and take over the account.
Background concepts
Before walking through the report, here are the ideas you need. Each one is explained from scratch.
- A URL (web address) is the text you type into a browser, like
http://example.com/page. It has parts: the scheme (thehttporhttpsat the start), the domain (the site name), the path (the part after the domain), and sometimes a query string (extra values after a?). - The scheme tells the browser how to talk to the site.
httpmeans the conversation is not encrypted.httpsmeans it is encrypted, so nobody in between can read it. - A security token is a long random string that acts like a temporary key. The site generates it, puts it in the link, and later checks it when you click. If someone else gets the token, they can pretend to be you for that one action.
- A query parameter is a named value in a URL after the
?, written asname=value. In this report the email address is passed as a query parameter calledemail. - A redirect is when one web address sends your browser on to another address automatically. Mail providers often wrap links in their own redirect address so they can count clicks.
- A mail provider tracking URL is a link on the mail company's domain that, when clicked, records the click and then forwards you to the real destination.
- Wireshark is a free program that records the network traffic going in and out of your computer, so you can look at what was sent and received.
- A man-in-the-middle attack is when someone sits between you and the site and can see (or change) the traffic. On an unencrypted http connection, this is easy.
- Account takeover means an attacker gains control of someone else's account, for example by resetting its password.
The product and the feature
Instagram Brand is a registration and account management site. The feature involved is the password reset flow: a user asks for a reset, the site emails a link, and following the link lets the user set a new password. The link carries a security token that identifies the reset request, plus the user's email address.
The report is about the scheme used in those emailed links. The reset link is delivered over plain http rather than https, and the token is exposed in clear text along the way.
What you need to reproduce it
No special accounts, roles or tool versions are described. The researcher needed only:
- An account on the site, so that a password reset could be requested.
- Access to the inbox that receives the reset email.
- A browser to follow the link.
- Wireshark, to capture the traffic and show the token in transit.
The only precondition is that the reset flow works and that the email arrives through the usual mail infrastructure.
Finding it
The researcher requested a password reset and looked at the link that arrived in the inbox. The link was not the site's own address but a tracking URL on the mail provider's domain, and it used the http scheme:
http://mandrillapp.com/track/click/30956340/instagram-brand.com?p=<the very long security token here>
Line by line:
http://is the scheme. It means the connection is not encrypted, so anyone watching the network can read the request.mandrillapp.comis the mail provider's domain, not Instagram Brand's. The link has been wrapped so the provider can track clicks./track/click/30956340/instagram-brand.comis the path on the provider's site. It identifies this particular tracking link and the destination site.?p=<the very long security token here>is the query string. The parameterpcarries the very long security token. Because the scheme is http, this token is sent in clear text.
Following that tracking link in a browser returned the actual password reset URL, again over http, with the token and the user's email address in the path and query string:
http://en.instagram-brand.com/register/reset/<the security token here>?email=<the email of user here>
Line by line:
http://again means unencrypted.en.instagram-brand.comis the site's own domain./register/reset/<the security token here>is the path. The token sits right in the path, so it is part of the address the browser requests.?email=<the email of user here>is the query string, carrying the user's email address.
The product URL given at the top of the report is the same shape:
http://en.instagram-brand.com/register/reset/<the security token here>?email=<email address here>
This is the same structure as the line above, just with the placeholders written slightly differently.
Two things looked wrong. First, a link that carries a credential (the token) was issued with a http scheme, so every hop between the mail provider, the user's network and the site could see it in clear text. Second, the tracking redirect hands back the reset token in clear text, so the token is not protected by encryption at any point in the chain.
Exploitation
Step 1: request the reset link
Request a password reset for the account. The site sends the reset email to the inbox. This step is taken because the bug lives in the link that the site generates, so you need a real link to inspect.
Step 2: inspect the link in the inbox
Open the inbox, right-click the link and paste it into a text editor. The scheme is http, and the URL is the mail provider's tracking URL shown above, carrying the token in the p parameter. Pasting into a text editor rather than clicking lets you see the raw address, including the scheme and the token, without the mail client hiding anything.
Step 3: follow the link and observe the redirect target
Requesting the tracking URL in a browser returns the password reset token in clear text:
http://en.instagram-brand.com/register/reset/<the security token here>?email=<the email of user here>
Line by line:
http://shows the final reset page is also unencrypted./register/reset/<the security token here>shows the token is in the path, so it is visible in the address bar and in any network capture.?email=<the email of user here>shows the email address is in the query string, also visible.
This step is taken to show that the tracking redirect does not upgrade the connection to https. The token is exposed at the redirect as well as at the final page.
Step 4: capture the traffic
Start Wireshark and repeat the flow. Because the scheme is http, the reset token is visible in the captured traffic. The researcher attached a Wireshark screenshot as proof of concept.

Capturing the traffic is how you prove the token is exposed in transit without needing to take over another person's account.
Root cause
The code that builds the password reset link uses http as the scheme instead of https. The link is also wrapped in a mail provider tracking URL that is itself http, and that tracking URL redirects to the reset URL over http. The token therefore travels in clear text in the tracking URL and in the reset URL it returns.
The emailed link, the tracking redirect and the final reset URL were all issued as http. The report does not describe any HSTS behaviour or other mechanism that would have forced an upgrade.
Impact
An attacker who can steal the reset link can capture the token it carries. With a valid token the attacker can complete the reset and take over the account. Because the links are issued to every user who requests a reset, the researcher describes the consequence as mass account takeovers and security compromises, not a single-account issue.
The report does not quantify how many accounts are affected, and it does not show a completed takeover; the evidence is the captured token.
Fix
The researcher states the fix is simple and reports having tried it: when the code responsible for sending the password reset link builds those links, use https as the scheme instead of http. With that change, the researcher says, the accounts are safe and the data cannot be stolen.
Variants to test
- Other transactional emails. Request password resets, email confirmations, invitations and magic links, and check the scheme of every link. A positive result is any link that carries a token over http.
- Tracking redirects. Look at links wrapped by mail providers or marketing platforms. A positive result is a tracking URL over http that redirects to a token-bearing URL, so the token is exposed at the redirect.
- Token in the path or query. Check whether the token appears in the path or in a query parameter, as here, and whether the page that consumes it is served over http. A positive result is a reset page reachable over http with a live token.
- Scheme downgrade after the fix. If the site now issues https links, try the same reset URL with http substituted. A positive result is a redirect that preserves the token in clear text or a page that serves the token over http.
Hunting notes
This kind of bug hides in the code that generates outbound email: password resets, confirmations, invitations and any other message that carries a token. It is easy to miss because the site itself may be served over https while the link in the email is built from a hard-coded scheme or a configuration value that says http.
During recon, request a reset for your own account and read the raw email source rather than the rendered message. Check the scheme of the link, whether it is wrapped by a third-party tracking domain, and what the redirect returns. A tracking URL over http that resolves to a token-bearing URL is the signal.
To show impact, capture the traffic with a tool such as Wireshark and present the token visible in the capture, as the researcher did here. That demonstrates the token is exposed in transit without needing to take over another user's account.
Glossary
- URL (web address): the text you type into a browser to reach a page, made up of a scheme, a domain, a path and sometimes a query string.
- Scheme: the
httporhttpspart at the start of a URL that tells the browser how to connect. - HTTP: the unencrypted way browsers and sites talk; anyone in between can read the traffic.
- HTTPS: the encrypted version of HTTP; traffic is scrambled so people in between cannot read it.
- Security token: a long random string that acts as a temporary key proving you are allowed to perform an action, such as resetting a password.
- Query parameter: a named value in a URL after the
?, written asname=value. - Path: the part of a URL after the domain, such as
/register/reset/.... - Redirect: when one web address automatically sends your browser on to another address.
- Tracking URL: a link on a third party's domain that records the click and then forwards you to the real destination.
- Mail provider: the company that sends and delivers the email, whose domain may appear in the links inside it.
- Wireshark: a free program that records network traffic so you can inspect what was sent and received.
- Man-in-the-middle attack: when someone sits between you and a site and can see or change the traffic.
- Account takeover: when an attacker gains control of someone else's account.
- Password reset flow: the sequence where a user asks for a reset, receives an emailed link, and follows it to set a new password.
- Proof of concept: evidence, such as a screenshot or capture, that demonstrates the bug is real.