# Tampering User Attributes In AWS Cognito User Pools

DevFeed: [Tampering User Attributes In AWS Cognito User Pools](<https://devfeed.tech/articles/tampering-user-attributes-in-aws-cognito-user-pools-92026.md>)

Original publisher: [Read original article](<https://blog.doyensec.com/2023/01/24/tampering-unrestricted-user-attributes-aws-cognito.html>)

Published: 2023-01-23T23:00:00Z

Content type: article

Language: en

Sources: [Doyensec](<https://devfeed.tech/sources/doyensec.md>)

Topics: [Amazon Cognito](<https://devfeed.tech/topics/amazon-cognito.md>), [Amazon Web Services](<https://devfeed.tech/topics/aws.md>), [identity and access management](<https://devfeed.tech/topics/identity-and-access-management.md>), [Access Control](<https://devfeed.tech/topics/access-control.md>), [Security, Identity, & Compliance](<https://devfeed.tech/topics/security-identity-compliance.md>)

Tags: [amazon-cognito](<https://devfeed.tech/tags/amazon-cognito.md>), [auditing](<https://devfeed.tech/tags/auditing.md>), [automation](<https://devfeed.tech/tags/automation.md>), [aws](<https://devfeed.tech/tags/aws.md>), [aws-cognito](<https://devfeed.tech/tags/aws-cognito.md>), [doyensec](<https://devfeed.tech/tags/doyensec.md>), [doyensecurity](<https://devfeed.tech/tags/doyensecurity.md>), [exploit](<https://devfeed.tech/tags/exploit.md>), [hacking](<https://devfeed.tech/tags/hacking.md>), [infosec](<https://devfeed.tech/tags/infosec.md>), [offensive](<https://devfeed.tech/tags/offensive.md>), [pentest](<https://devfeed.tech/tags/pentest.md>), [pentester](<https://devfeed.tech/tags/pentester.md>), [reverse-engineering](<https://devfeed.tech/tags/reverse-engineering.md>), [security](<https://devfeed.tech/tags/security.md>), [vulnerability](<https://devfeed.tech/tags/vulnerability.md>)

## AI overview

AWS Cognito app clients can have default read/write access to user attributes, so a user with an access token may change their own attributes through the user pool APIs. In the described platform, a custom X_platform_user_id attribute was trusted as an immutable database key for retrieving a third-party refresh token; changing it caused another user's data to appear in the attacker's account. The article recommends removing write access from platform-critical attributes, configuring explicit read/write lists in the Cognito app client (which suppress default permissions for unspecified attributes), and managing that policy in IaC. It also advises requiring verification before email or phone updates. The excerpt notes that editable attributes alone are not a vulnerability; impact depends on how the application trusts and uses them.

## Source excerpt

From The Previous Episode... Did you solve the CloudSecTidbit Ep. 1 IaC lab? Solution The challenge for the data-import CloudSecTidbit is basically reading the content of an internal bucket. The frontend web application is using the targeted bucket to store the logo of the app. The name of the bucket is returned to the client by calling the /variable endpoint: $.ajax({ type: 'GET', url: '/variable', dataType: 'json', success: function (data) { let source_internal = `https://${data}.s3.amazonaws.com/public-stuff/logo.png?${Math.random()}`; $(".logo_image").attr("src", source_internal); }, error: function (jqXHR, status, err) { alert("Error getting variable name"); } }); The server will return something like: "data-internal-private-20220705153355922300000001" So the schema should be clear now. Let's use the data import functionality and try to leak the content of the data-internal-private S3 bucket: Extracting data from the internal S3 bucket Then, by visiting the Data Gallery section, you will see the keys.txt and dummy.txt objects, which are stored within the internal bucket. Tidbit No. 2 - Tampering User Attributes In AWS Cognito User Pools Amazon Web Services offer a complete solution to add user sign-up, sign-in, and access control to web and mobile applications: Cognito. Let's first talk about the service in general terms. From AWS Cognito's welcome page: "Using the Amazon Cognito user pools API, you can create a user pool to manage directories and users. You can authenticate a user to obtain tokens related to user identity and access policies." Amazon Cognito collects a user's profile attributes into directories called pools that an application uses to handle all authentication related tasks. Pool Types The two main components of Amazon Cognito are: User pools: Provide sign-up and sign-in options for app users along with attributes association for each user. Identity pools: Provide the possibility to grant users access to other AWS services (e.g., DynamoDB or Ama