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

Few steps on how to take over a whole application.

Sebastian Jeż

June 14, 2024

In a recent penetration test, I found a vulnerability in the password reset tokens within a system's audit trail functionality. This flaw can lead to arbitrary account takeover, allowing attackers to hijack user accounts, including those with high-level privileges.
Vulnerability Overview The issue begins with the system's audit trail logging every account activity. When examining this log, we found sensitive password reset tokens embedded within the JSON data. These tokens are generated whenever a password reset request is made. The lack of effective access control mechanisms directly compounds this exposure.
A notable weakness in the token generation process is its predictability. Specifically, the last six characters of the token, which are hexadecimal values (e.g., 0022CB56110000000012EF8B), show consistent variation. This predictability allows attackers to generate reset tokens for any account, enabling even low-privileged users to reset passwords of higher-privileged accounts, such as administrators.
Exploitation Showcase As exploitation is a bit complex, here’s how the exploitation process went step by step to take over the whole application:
1. GET request and token identification: attackers intercept the GET request to the audit trail functionality and identify the insecure token.
2. Data analysis: by analyzing the JSON data within the audit trail, they find stored password reset tokens among other information.
3. Token pattern recognition: the attackers recognize a pattern in the token generation, revealing a predictable sequence.
4. Targeted brute-force attack: instead of a broad brute-force attack, they focus on the six-character hexadecimal variation, significantly narrowing the attack scope.
5. Account access: within a short time, attackers can access multiple accounts, including administrator accounts, through the targeted brute-force method.
6. Admin token unveiling: while finding an admin token takes longer, it remains feasible (for example, hexadecimal 12EF8B converting to decimal 1240971).
7. Audit trail data exposure: with the acquired token, attackers access other users' audit trail data, extracting sensitive information like email addresses.
8. Initiating password reset: using the extracted email addresses, attackers initiate password reset requests.
9. Obtaining fresh reset token: they then request the admin's audit trail endpoint again to obtain a new password reset token.
10. URL token substitution: attackers replace their own reset token with the newly acquired admin token within the password reset URL.
11. Admin password overwrite: this allows them to reset the administrator’s password using the substituted token.
12. System compromise: with admin-level access, the attackers achieve full system compromise.
Conclusion and Best Practices The explained exploitation process highlights a significant security concern regarding the handling of sensitive data, even in secure functionalities like audit trails. This vulnerability shows the need for stringent access control and secure token generation mechanisms.
To mitigate such vulnerabilities, it is crucial to follow cybersecurity best practices. This includes:
• Ensuring secure token handling and generation.
• Minimizing data exposure in logs.
• Implementing strict access control mechanisms to protect sensitive data and functionalities.
• By adhering to these practices, organizations can better safeguard their systems against similar security threats.




#CyberSecurity #PenetrationTesting #NetworkSecurity #Infosec #VulnerabilityManagement #TechInsights #PentestChronicles


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!

Terms and conditions
© 2023 Securitum. All rights reserved.