Skip to content
CSRF Disclosed report Beginner

CSRF when unlocking lenses leads to lenses being forcefully installed without user interaction

The Snapchat lens unlock URL accepted a different type parameter that skipped the confirmation prompt, so opening a crafted link unlocked and applied a lens without the user agreeing. An attacker could force lens unlocks on victims, inflating a lens's popularity and leaving unwanted lenses on the account.

sdushantha Follow

Originally disclosed on HackerOne

Bounty$250 Low View original
  • Triaged in 4 days
  • Fixed in 6 months
  • Paid in 11 days
  • Disclosed after 6 months

Summary by the program

By sending a message containing a specially crafted link using the SNAPCHAT_NO_PROMPT type, a CSRF attack can be performed, causing the victim to unlock a Lens for their snapchat account without the prompt appearing.

The report

Hi,

The url below allows a user to unlock a particular lens. Once they have opened the URL on their phone, Snapchat opens up and prompts the user to unlock this lens.

https://www.snapchat.com/unlock/?type=SNAPCODE&uuid=6ff5a565fca249a1948b1963ee2881b4&metadata=01

By changing the value of type in the URL above, from SNAPCODE to SNAPCODE_NO_PROMPT, we can bypass the prompt mentioned earlier, and instead forcefully unlock the lens and make them use it, hence why this is a CSRF:

https://www.snapchat.com/unlock/?type=SNAPCODE_NO_PROMPT&uuid=6ff5a565fca249a1948b1963ee2881b4&metadata=01

This issue also happens to Snapchat's deeplink on Android:

snapchat://unlock/?type=SNAPCODE_NO_PROMPT&uuid=6ff5a565fca249a1948b1963ee2881b4&metadata=01

I do not have an iOS device but I am certain that this issue also occurs on the iOS version of Snapchat.

Impact

A Snapchat lens developer can abuse this bug and increase the number of people who use their lens by making people opening the URL to the lens and replacing SNAPCODE with SNAPCODE_NO_PROMPT. This can cause false popularity for that lens as it is being unlocked without the user wanting to do so. This would then lead to the user having to manually delete the lense that was automatically added.

The original report as published on HackerOne, by sdushantha. 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. 3 min read.

Context

Snapchat Lenses are augmented-reality effects that users can unlock and add to their account. A Lens can be unlocked through a URL on www.snapchat.com or through the Android deeplink scheme snapchat://. Normally, when a user opens such a URL, the Snapchat app opens and shows a prompt asking the user to confirm that they want to unlock the Lens. The report describes a way to skip that prompt and unlock a Lens without any user interaction, which turns the unlock flow into a cross-site request forgery (CSRF) vector.

The affected asset is the Android application com.snapchat.android, and the report was disclosed on HackerOne on 2021-07-29 with a low severity and a bounty of 250 USD.

Setup

No special accounts, roles or tools are described. The only precondition is that the victim opens a crafted link, either a web URL or the Android deeplink, on a device where Snapchat is installed.

Finding it

The researcher started from a legitimate unlock URL that contains a type parameter set to SNAPCODE:

Text
https://www.snapchat.com/unlock/?type=SNAPCODE&uuid=[redacted]&metadata=01

Opening this URL on a phone causes Snapchat to open and prompt the user to unlock the Lens identified by the uuid and metadata parameters. The prompt asks the user to confirm the unlock.

The researcher noticed that changing the value of the type parameter from SNAPCODE to SNAPCODE_NO_PROMPT changes the behaviour: the prompt is bypassed and the Lens is unlocked and made available for use immediately. Because the action is performed without the user's consent, the researcher classified it as a CSRF.

Exploitation

Step 1: Craft the web URL without the prompt

The researcher modified the type parameter in the original URL:

Text
https://www.snapchat.com/unlock/?type=SNAPCODE_NO_PROMPT&uuid=[redacted]&metadata=01

When this URL is opened on a phone with Snapchat installed, the app opens and unlocks the Lens identified by uuid=[redacted] and metadata=01 without showing the confirmation prompt. The user then has to manually delete the Lens that was automatically added.

Step 2: Use the Android deeplink

The same behaviour occurs with Snapchat's Android deeplink:

Text
snapchat://unlock/?type=SNAPCODE_NO_PROMPT&uuid=[redacted]&metadata=01

The same issue also occurs with Snapchat's Android deeplink.

Step 3: Delivery

The report states that the attack is performed by sending a message containing a specially crafted link using the SNAPCODE_NO_PROMPT type. The victim only has to open the link; no further interaction is required.

Root cause

The unlock flow accepts a client-supplied type parameter that controls whether the confirmation prompt is shown. When the value is SNAPCODE_NO_PROMPT, the app skips the prompt and performs the unlock directly.

Impact

A Snapchat Lens developer can abuse this bug to increase the number of people who use their Lens by making people open the URL with SNAPCODE replaced by SNAPCODE_NO_PROMPT. This can create false popularity for that Lens, because it is unlocked without the user wanting to do so. The report does not describe any other impact, such as access to user data or account takeover.

Fix

The report does not state what fix was applied. A reasonable fix would be to remove the SNAPCODE_NO_PROMPT behaviour or to require an explicit user confirmation for every unlock, regardless of the type parameter.

Variants to test

  • Try other values of the type parameter on the same unlock endpoint, such as SNAPCODE, SNAPCODE_NO_PROMPT and any other values that appear in the app or in documentation. A positive result is a Lens being unlocked without a prompt.
  • Test the same parameter on other Snapchat deeplinks or web endpoints that perform actions, looking for similar _NO_PROMPT suffixes or flags that skip confirmation. A positive result is an action performed without user interaction.
  • Check whether the uuid and metadata parameters can be changed to target arbitrary Lenses, and whether the unlock is tied to the victim's account. A positive result is an arbitrary Lens being added to the victim's account.

Hunting notes

This kind of bug tends to hide in mobile deeplinks and web-to-app bridges where a parameter controls a confirmation step. During recon, look for parameters named type, prompt, confirm or similar that change behaviour when their value changes. The report describes the Lens being unlocked without user interaction and the user having to delete it manually.

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

Snapchat has a feature called Lenses: augmented-reality effects that you can add to your account and use when you take photos or videos. Some Lenses are unlocked by opening a special link. When you open that link on your phone, the Snapchat app opens and asks you a question: do you want to unlock this Lens? You have to tap to confirm.

That confirmation question is a safety check. It exists so that a Lens cannot be added to your account unless you actually said yes. The researcher found that the link contains a small piece of text, a parameter called type, and that changing its value from SNAPCODE to SNAPCODE_NO_PROMPT makes the app skip the question entirely. The Lens is unlocked straight away, with no tap from you.

Because an action happens on your account without your consent, just by opening a link, this is called cross-site request forgery, or CSRF. The practical effect is that a Lens developer could send people a link and quietly inflate the number of people using their Lens, and each victim would then have to delete the Lens by hand.

The report was sent to Snapchat through the HackerOne bug bounty platform. It was rated low severity, a bounty of 250 USD was paid, and it was disclosed publicly on 2021-07-29. The affected asset named in the report is the Android app, com.snapchat.android.

Background you need

A few ideas come up again and again below, so here they are from zero.

URL and parameters. A URL is a web address. The part after a question mark is a list of parameters: little name-and-value pairs separated by &. In ?type=SNAPCODE&uuid=..., the parameter type has the value SNAPCODE, and the parameter uuid has some long identifier. Parameters are how a link can carry instructions to the page or app that opens it.

Deeplink. A deeplink is a link that opens an app instead of a website. It looks like a URL but starts with the app's name, for example snapchat://. When your phone sees that, it hands the link to the Snapchat app rather than to the browser.

Prompt. A prompt here means a confirmation dialog: a box that asks "do you want to do this?" and waits for you to tap yes or no. It is a security control, because it forces a human decision before something changes on your account.

CSRF (cross-site request forgery). Imagine someone mails you a form that says "cancel my magazine subscription" and you sign it without reading, thinking it is a birthday card. The action is real and it happens under your name, but you never meant to do it. CSRF is the same idea on the web: a link or page causes your account to perform an action you did not intend. The key ingredient is that the action needs no confirmation from you.

Bug bounty. A bug bounty programme is a scheme where a company pays independent researchers for reporting security problems responsibly instead of exploiting them. HackerOne is one of the platforms that runs such programmes.

Setup

No special accounts, roles or tools are described. The only precondition is that the victim opens a crafted link, either a web URL or the Android deeplink, on a device where Snapchat is installed.

Finding it

The researcher started from a normal, legitimate unlock link. , and it contains a type parameter set to SNAPCODE:

Text
https://www.snapchat.com/unlock/?type=SNAPCODE&uuid=[redacted]&metadata=01

Line by line:

  • ? starts the list of parameters.
  • &uuid=[redacted] identifies which Lens is being unlocked. The uuid is a unique identifier for that Lens.

Opening this URL on a phone causes Snapchat to open and prompt the user to unlock the Lens identified by the uuid and metadata parameters. The prompt asks the user to confirm the unlock.

The researcher then changed one thing only: the value of the type parameter, from SNAPCODE to SNAPCODE_NO_PROMPT. The behaviour changed. The prompt was bypassed, and the Lens was unlocked and made available for use immediately. Because the action now happens without the user's consent, the researcher classified it as a CSRF.

The name of the value is a strong hint about what it does: NO_PROMPT literally says "do not ask". A parameter that switches off a confirmation step is exactly the kind of thing a CSRF hunter looks for, because it removes the one thing standing between a link and an unwanted action.

Exploitation

Step 1: Craft the web URL without the prompt

The researcher modified the type parameter in the original URL:

Text
https://www.snapchat.com/unlock/?type=SNAPCODE_NO_PROMPT&uuid=[redacted]&metadata=01

Line by line:

  • The address and the uuid and metadata values are identical to the legitimate link. Nothing about which Lens is targeted has changed.
  • type=SNAPCODE_NO_PROMPT is the only difference. This value tells the unlock flow to skip the confirmation question.

When this URL is opened on a phone with Snapchat installed, the app opens and unlocks the Lens identified by uuid=[redacted] and metadata=01 without showing the confirmation prompt. The user then has to manually delete the Lens that was automatically added.

Step 2: Use the Android deeplink

The same behaviour occurs with Snapchat's Android deeplink:

Text
snapchat://unlock/?type=SNAPCODE_NO_PROMPT&uuid=[redacted]&metadata=01

Line by line:

  • snapchat:// is the deeplink scheme. Instead of asking a web server for a page, it asks the phone's operating system to open the Snapchat app directly.
  • The parameters are the same as in the web URL: type=SNAPCODE_NO_PROMPT disables the prompt, and uuid and metadata choose the Lens.

The same issue also occurs with Snapchat's Android deeplink. The researcher noted that they did not have an iOS device but were certain the issue also occurs on the iOS version of Snapchat. That is a statement of expectation, not a tested result.

Step 3: Delivery

The report states that the attack is performed by sending a message containing a specially crafted link using the SNAPCODE_NO_PROMPT type. The victim only has to open the link; no further interaction is required.

Root cause

When the value is SNAPCODE_NO_PROMPT, the app skips the prompt and performs the unlock directly.

In other words, the safety check could be switched off by the very input an attacker controls.

Impact

A Snapchat Lens developer can abuse this bug to increase the number of people who use their Lens by making people open the URL with SNAPCODE replaced by SNAPCODE_NO_PROMPT. This can create false popularity for that Lens, because it is unlocked without the user wanting to do so. The report does not describe any other impact, such as access to user data or account takeover.

Fix

The report does not state what fix was applied. A reasonable fix would be to remove the SNAPCODE_NO_PROMPT behaviour or to require an explicit user confirmation for every unlock, regardless of the type parameter.

Variants to test

  • Try other values of the type parameter on the same unlock endpoint, such as SNAPCODE, SNAPCODE_NO_PROMPT and any other values that appear in the app or in documentation. A positive result is a Lens being unlocked without a prompt.
  • Test the same parameter on other Snapchat deeplinks or web endpoints that perform actions, looking for similar _NO_PROMPT suffixes or flags that skip confirmation. A positive result is an action performed without user interaction.
  • Check whether the uuid and metadata parameters can be changed to target arbitrary Lenses, and whether the unlock is tied to the victim's account. A positive result is an arbitrary Lens being added to the victim's account.

Hunting notes

This kind of bug tends to hide in mobile deeplinks and web-to-app bridges, where a parameter controls a confirmation step. During recon, look for parameters named type, prompt, confirm or similar that change behaviour when their value changes. The report describes the Lens being unlocked without user interaction and the user having to delete it manually.

Glossary

  • API: a defined way for one piece of software to ask another to do something, like a menu of requests a program accepts.
  • Asset: the specific product or component a bug bounty report is filed against, here the Android app com.snapchat.android.
  • Bug bounty: a programme that pays researchers for responsibly reporting security flaws.
  • Confirmation prompt: a dialog that asks the user to approve an action before it happens.
  • CSRF (cross-site request forgery): making a victim's account perform an action through a link or page, without the victim intending it.
  • Deeplink: a link that opens a mobile app directly instead of a web page, for example snapchat://.
  • Endpoint: a specific address or handler that accepts a particular kind of request.
  • HackerOne: a platform that hosts bug bounty programmes for companies.
  • Lens: a Snapchat augmented-reality effect that users can unlock and add to their account.
  • Metadata: extra descriptive data attached to something; here the metadata parameter carries a value of 01 alongside the Lens identifier.
  • Parameter: a name-and-value pair in a URL after the ?, used to pass instructions.
  • Prompt bypass: skipping a confirmation dialog so an action happens without the user agreeing.
  • Recon: the research phase where you look around a target for interesting behaviour before testing.
  • Severity: a rating of how serious a vulnerability is; this report was rated low.
  • UUID: a long unique identifier, here used to name a specific Lens.
  • Web-to-app bridge: the mechanism by which a web link causes a mobile app to open and act.

More by sdushantha

View all

2 more disclosed reports, best first.

More from Snapchat

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.