Skip to content
Access control Write-up Beginner

[Writeup][Bug Bounty][Instagram] Instagram Still Send New DMs and Video Calls to Device After Logout [ID][EN]

After a user ended an attacker's session from Login Activity, the attacker's device still received push notifications for new messages and video calls sent to the victim's account. An attacker with prior access could therefore keep learning about incoming messages after being logged out.

Muhammad Thomas Fadhila Yahya Follow

Published on fadhilthomas.github.io

Bounty$750 View original

Setelah pengguna melakukan logout akunnya, session seharusnya di invalidate untuk menghentikan aksi yang membutuhkan otentikasi seperti menerima notifikasi pesan yang masuk. Pada postingan ini membahas tentang Instagram yang menampilkan notifikasi pesan masuk walaupun pengguna telah mengakhiri session akunnya.

fadhilthomas, on fadhilthomas.github.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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. 3 min read.

Context

Instagram, the photo and video sharing product operated by Facebook (now Meta), delivers notifications for incoming direct messages to a user's devices. When a user ends a session, that session should be invalidated so that actions requiring authentication, such as receiving notifications of incoming messages, stop working. This write-up describes a case where Instagram kept showing incoming message notifications on a device even though the user had ended that account session.

The report was submitted to the Facebook bug bounty programme and was rewarded with 750 USD.

Setup

The report does not describe any special tooling, versions or test accounts. The only precondition is a victim account that has been compromised: an attacker has successfully logged in to the victim's account, and the victim is aware that someone else has entered it. The victim then uses the Login Activity setting in Settings to end the attacker's session.

Finding it

The researcher's observation is simple: after the attacker's session was ended through Login Activity, the attacker's device still received notifications for new messages sent to the victim's account. A session that has been ended should no longer be able to receive notifications of incoming messages, so this behaviour looked wrong.

Exploitation

Step 1: Attacker logs in to the victim's account

The attacker succeeds in logging in to the victim's account. The report does not describe how the credentials were obtained.

Step 2: Victim notices the intrusion

The victim knows that someone else has entered her account.

Step 3: Victim ends the attacker's session

The victim opens the Login Activity setting in Settings and ends the session belonging to the attacker. The attacker's session is successfully ended.

Step 4: Attacker's device still receives message notifications

Although the attacker has been logged out of the victim's account, when a message arrives in the victim's account, the attacker's device still gets a notification of the incoming message.

alt text
alt text From the original on fadhilthomas.github.io

Root cause

The report offers a hypothesis rather than a confirmed cause: the FCM (Firebase Cloud Messaging) token from the attacker's device was still registered, so the device kept receiving notifications for new messages. The report suggests the FCM token from the attacker's device may still have been registered, so the device kept receiving notifications for new messages.

Impact

The attacker can still receive notifications of messages that arrive in the victim's account even though the session has been ended.

Fix

Based on the stated hypothesis, the expected behaviour would be to unregister or invalidate the device's FCM token when the corresponding session is ended, so that push notifications for that account stop being delivered to the device.

Variants to test

  1. End a session from Login Activity and then send a direct message to the account: a positive result is a notification arriving on the ended device.
  2. End all sessions at once rather than a single one: a positive result is any device that was logged out still receiving message notifications.
  3. Change the account password after ending the session: a positive result is notifications continuing to arrive on the old device.
  4. Log out normally from the app on one device and send a message from another: a positive result is the logged-out device still showing message notifications.

Timeline

  • 15 Nov 2019: reported to Facebook.
  • 19 Nov 2019: Facebook acknowledged the report and asked for more detailed information.
  • 27 Jan 2020: Facebook stated the report was valid and awarded 750 USD.

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.

What happened, in plain words

Instagram is a photo and video sharing app run by Facebook (now Meta). One of its features is direct messages (DMs): private messages that one user sends to another. When a DM arrives, Instagram shows a notification on the recipient's phone or computer, so the person knows a message is waiting.

To receive those notifications, a device has to be signed in to the account. Signing in creates a session: a period during which the app remembers that this device belongs to this account, so it does not ask for the password again on every action. When you sign out, or when you end a session from another device, that session is supposed to stop working. Anything that needs you to be signed in, such as receiving notifications for new messages, should stop too.

This report is about a case where that did not happen. An attacker had signed in to a victim's account. The victim noticed, went into the Login Activity setting and ended the attacker's session. The session was ended, yet the attacker's device kept receiving notifications whenever a new message arrived in the victim's account.

The report was sent to the Facebook bug bounty programme. A bug bounty programme is a scheme where companies pay people who report security problems to them, so the problems can be fixed before bad actors use them. Facebook paid 750 USD for this report.

alt text
alt text From the original on fadhilthomas.github.io

The image above is the table of contents of the write-up, linking to its Impact, Steps to Reproduce and Timeline sections.

The pieces involved

Before walking through the steps, here are the ideas you need. None of them require any security background.

  • Account and session. Think of a session like a wristband you get at an event. You show your ticket once at the door, and the wristband then lets you come and go without showing the ticket again. The session is that wristband: the app stores something on your device that proves you already signed in. Ending a session is like the organiser cutting the wristband off. After that, the door should not open for you any more.
  • Login Activity. This is a settings screen in Instagram that lists the devices currently signed in to your account, and lets you end any of them. It exists so that if you think someone else has your account, you can throw them out without changing your password.
  • Notification. A short alert, such as a banner on a phone, telling you something happened. For a DM, the alert usually says who wrote and maybe a preview of the message.
  • Push notification and FCM. Phones do not keep every app running all the time, so apps cannot simply watch for new messages themselves. Instead, a delivery service run by the phone's platform carries the alert to the device. On Android, that service is Firebase Cloud Messaging (FCM). When an app wants to send alerts to a particular device, it needs an address for that device, called an FCM token. Think of the token as a mailing address label: the server posts the notification to that label, and the delivery service drops it on the right phone. If the label stays on the mailing list, the letters keep arriving, even if the person has moved out.
  • Invalidation. Making a session invalid means marking it as no longer usable. The app should then refuse anything that requires being signed in.

The report does not mention any special tools, app versions or test accounts. The only starting point is a victim account that an attacker has already signed in to, with the victim aware of it.

Finding it

The observation behind the report is simple. After the attacker's session was ended through Login Activity, the attacker's device still received notifications for new messages sent to the victim's account. A session that has been ended should no longer be able to receive notifications of incoming messages, so this behaviour looked wrong.

Steps to reproduce

Step 1: The attacker signs in to the victim's account

The attacker succeeds in logging in to the victim's account. The report does not describe how the attacker obtained the credentials. This step is the setup: without a signed-in attacker device there is nothing to end later.

Step 2: The victim notices

The victim knows that someone else has entered her account. This matters because the next step depends on the victim acting deliberately: she has to go and end the intruder's session herself.

Step 3: The victim ends the attacker's session

The victim opens the Login Activity setting in Settings and ends the session belonging to the attacker. The attacker's session is successfully ended. From the victim's point of view the problem is now solved: the intruder has been thrown out.

Step 4: The attacker's device still gets message notifications

Although the attacker has been logged out of the victim's account, when a message arrives in the victim's account, the attacker's device still gets a notification of the incoming message.

alt text
alt text From the original on fadhilthomas.github.io

Why it probably happened

The report offers a hypothesis rather than a confirmed cause. In the author's words, the FCM token from the attacker's device was probably still registered, so the device kept receiving notifications for new messages.

Put in everyday terms: ending the session cancelled the wristband, but nobody removed the phone's address label from the notification mailing list. The report suggests the FCM token from the attacker's device was probably still registered, so the device kept receiving notifications for new messages.

Impact

The attacker can still receive notifications of messages that arrive in the victim's account even though the session has been ended.

Fix

Based on the stated hypothesis, the expected behaviour would be to unregister or invalidate the device's FCM token when the corresponding session is ended, so that push notifications for that account stop being delivered to the device. In the wristband comparison: when you cut the wristband off, also take the person's address label off the mailing list.

Variants to test

These are follow-up checks in the same area, each with a clear sign that the problem is present:

  1. End a session from Login Activity and then send a direct message to the account. A positive result is a notification arriving on the ended device.
  2. End all sessions at once rather than a single one. A positive result is any device that was logged out still receiving message notifications.
  3. Change the account password after ending the session. A positive result is notifications continuing to arrive on the old device.
  4. Log out normally from the app on one device and send a message from another. A positive result is the logged-out device still showing message notifications.

Timeline

  • 15 Nov 2019: reported to Facebook.
  • 19 Nov 2019: Facebook acknowledged the report and asked for more detailed information.
  • 27 Jan 2020: Facebook stated the report was valid and awarded 750 USD.

Glossary

  • Session: the period during which an app remembers that a device is signed in to an account, so the password is not needed for every action.
  • Invalidate a session: mark a session as no longer usable, so actions that require being signed in are refused.
  • Logout / sign out: the action of ending a session, either from the device itself or from a settings screen.
  • Login Activity: an Instagram settings screen that lists signed-in devices and lets you end their sessions.
  • Direct message (DM): a private message sent from one user to another inside the app.
  • Notification: a short alert telling a user that something happened, such as a new message arriving.
  • Push notification: a notification delivered to a device by the phone platform's delivery service rather than by the app itself.
  • FCM (Firebase Cloud Messaging): Google's service for delivering push notifications to Android devices.
  • FCM token: the address label that identifies one device to FCM, so notifications can be delivered to it.
  • Register / unregister a token: adding a device's token to the notification list, or removing it so notifications stop being delivered.
  • Bug bounty programme: a scheme where a company pays people who report security problems so they can be fixed.
  • Impact: the harm a security problem can cause if it is not fixed.
  • Root cause: the underlying reason a problem happens, as opposed to its visible symptom.
  • Variant: a related version of the same test, changed slightly to see whether the problem appears in other situations too.

More by Muhammad Thomas Fadhila Yahya

View all

2 more disclosed reports, best first.

More from Meta

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.