This website uses cookies

To provide the highest level of service we use cookies on this site.
Your continued use of the site means that you agree to their use in accordance with our terms and conditions.

Pentest Chronicles

From an AWS Cognito Misconfiguration to Full Account Takeover

Securitum

December 30, 2024


Issues with AWS Cognito configuration can expose applications to significant abuse, including privilege escalation attacks. The discovered vulnerability allows users to modify their attributes, potentially granting access to resources belonging to other entities in the system. Description of the vulnerability The tested application implements AWS Cognito as its authentication mechanism. However, a misconfiguration of this mechanism permits any user with an active account to modify their attributes within Cognito. This allows them to assume the identity of another merchant (business entity) in the system. Consequently, the attacker could perform actions on behalf of the compromised entity, such as creating business relationships.

Also, this issue affects both the web and mobile versions of the application due to their shared API.
Technical details The attack leverages AWS Cognito's authentication process and requires a network traffic analysis tool, such as Burp Suite, along with the AWS CLI toolkit.

1. Intercept Application Traffic: Configure the application to route its network traffic through a proxy server.

2. Log in to the Application

During the login process, intercept a request sent to AWS Cognito, which includes the Access Token.
Example request: 3. Retrieve User Attributes

Using the Access Token, the attacker can retrieve their own attributes in AWS Cognito with the following command: Example user attributes: 4. Modify Attributes:
The attacker modifies the custom:m_id attribute, which identifies the merchant associated with the account, using the following command: After relogging, the user gains access to resources belonging to the other merchant.
Recommendations To prevent exploitation, it is recommended to:

1. Restrict Attribute Modifications Disable the ability for users to modify sensitive attributes such as custom:m_id e.g. by using pre-token generation Lambda triggers to validate and restrict attribute changes.

2. Implement Backend Validation Ensure the backend verifies whether a user is authorized to modify specific attributes.

3. Conduct a Security Audit Regularly review AWS Cognito configuration as well as, both authenticated and unauthenticated user permissions to identify potential misconfigurations.



#Cybersecurity #WebSecurity #SessionFixation #PenTesting #SecureApplications



Next Pentest Chronicles

When Usernames Become Passwords: A Real-World Case Study of Weak Password Practices

Michał WNękowicz

9 June 2023

In today's world, ensuring the security of our accounts is more crucial than ever. Just as keys protect the doors to our homes, passwords serve as the first line of defense for our data and assets. It's easy to assume that technical individuals, such as developers and IT professionals, always use strong, unique passwords to keep ...

SOCMINT – or rather OSINT of social media

Tomasz Turba

October 15 2022

SOCMINT is the process of gathering and analyzing the information collected from various social networks, channels and communication groups in order to track down an object, gather as much partial data as possible, and potentially to understand its operation. All this in order to analyze the collected information and to achieve that goal by making …

PyScript – or rather Python in your browser + what can be done with it?

michał bentkowski

10 september 2022

PyScript – or rather Python in your browser + what can be done with it? A few days ago, the Anaconda project announced the PyScript framework, which allows Python code to be executed directly in the browser. Additionally, it also covers its integration with HTML and JS code. An execution of the Python code in …

Any questions?

Happy to get a call or email
and help!