Dutch
English
Dit artikel is alleen beschikbaar in het English
azure
cloud security
pentesting

An Introductory Guide to Pentesting Azure: Part 1

Gray Oshin
09 April, 2024

Azure Pentesting

Microsoft Azure is one of the most versatile public cloud infrastructure solutions. With nearly
1 billion users worldwide and a 29% growth in Q1 2024, it’s clear that both individuals and enterprises value Azure for their cloud infrastructure needs. This makes it crucial to understand the pen testing process in Azure. 

If you’re new to pentesting in Azure environments or want to improve your knowledge as a professional, this detailed guide will cover the procedures, especially for different types of cloud testing. We’ll also discuss the benefits of pen testing Azure for businesses, as well as best practices and popular tools.

What is Azure Pentesting?

Azure penetration testing or pen-testing involves analyzing the security of Azure-based infrastructure and applications by simulating real-world threats. This means a Penetration Tester tries to find security vulnerabilities and misconfigurations in Azure environments before a malicious actor or hacker exploits them. 

Currently, 95% of Fortune 500 companies use Azure in their cloud environments. By conducting Azure pen tests, enterprises can improve the security posture of their Azure-based apps and ensure the confidentiality, integrity, and availability of their data on Azure.

Conducting Azure Pentesting in Different Cloud Environments

As a professional conducting pen testing in Azure, there are a few distinct approaches to consider, especially when it’s across various cloud environments. 

Testing on the Cloud

Testing on the cloud involves testing traditional systems hosted within a cloud environment. This could be testing virtualized systems migrated from on-premises to the cloud (also called rehosting) or web applications hosted on the cloud, where only the applications are assessed and not the supporting infrastructure.

One thing to note here is the importance of securing the database and using encryption methods. In Azure, enterprises generally store their data in MS-SQL databases, protected by Microsoft’s security measures across multiple layers. Several security tools and techniques like database firewalls, data masking, Azure Web Application Firewall, and Microsoft’s Always Encrypted feature all add a robust layer of protection.

For network-level security, remember to ensure the effectiveness of both the server and database-level firewalls. Server-level firewalls govern access to servers hosting multiple databases, while database-level firewalls provide granular security for individual databases. 

Overall, you can configure these firewalls through a whitelist approach for safe IPs, which is more proactive than blacklisting. Keep in mind that the Azure SQL firewall configuration should done at the server level and not the database level.

Additionally, encrypting data in Azure often involves generating an encryption key that can be stored on-premise or on Azure. While the latter offers convenience and seamless integration, relinquishing control over key backup and rotation could be a trade-off.

Ultimately, the decision to manage encryption keys on-premise or with Azure Key Vault depends on your enterprise’s capability and security requirements. Azure Key Vault allows controlled access for Azure services, but potential risks arise if attackers gain access to the vault and exploit encryption keys to decrypt sensitive data.

Testing in the Cloud

In this case, the focus is on testing cloud-hosted systems that are not publicly accessible. This may involve evaluating application servers or systems with restricted access, such as those with a firewall, and determining whether they require a bastion host for access. The assessment will also consider the potential impact of compromised applications on backend infrastructure security.

It’s recommended that you first introduce the Azure Deployment Models, which control how systems are deployed into an Azure environment. The initial focus after deploying Azure should be access management. 

To do this, you can use the Azure Resource Manager (ARM) model. This effectively means you assess the Azure web portal and review the Azure Active Directory (recently renamed to Microsoft Entra ID) to manage and identify users with access to Azure services. Then, remove unauthorized users from the access list and implement multi-factor authentication (MFA) for logins. 

You can also consider other access methods like PowerShell or RestAPIs. These ensure that connections are encrypted and you avoid storing credentials across different systems.

Implementing appropriate access controls for different user roles is essential to safeguarding your application against unauthorized access. Azure offers three distinct rolesreader, contributor, and owner – with the owner having the highest privileges, followed by contributor and reader. 

Adhere to the principle of least privilege for all users, and during penetration testing, thoroughly examine for any privilege escalation vulnerabilities that could potentially allow users to elevate their permissions beyond their assigned roles.

Testing the Cloud Console

Here, we’re testing the cloud console configuration itself. Key activities in this configuration review involve assessing user permissions, access controls, and configuration policies. 

You should also check accounts without MFA, assess how secrets are stored within the environment, and identify vulnerabilities in network security groups (NSGs). An NSG comprises security rules that allow or block inbound and outbound network traffic to and from various Azure resources. Remember that you can define the source and destination, port, and protocol for each rule.

The goal of testing the cloud console is to identify security gaps and potential loopholes for unauthorized access or privilege escalation within Azure’s administrative environment.

Azure Penetration Testing Best Practices

To ensure successful penetration testing in Azure environments, it's recommended that you follow industry best practices and ethical standards. Here are some:

  • Always Outline the Scope and Objectives of the Pen Test

Like any activity in security assessment, it's important always to define the scope and objective of the pen test. This allows you to focus the evaluation on the right areas of concern and also helps you manage expectations with the enterprise. 

  • Seek the Necessary Authorization

It goes without saying, but it’s absolutely critical that you seek formal permission from the organization or system owner before conducting a pen test. After all, this is what differentiates us Ethical Hackers from malicious actors. 

Here, you should define the Rules of Engagement (ROE), which allows you to conduct tests in an ethical and controlled way. The ROE should specify your limitations and restrictions, such as defining the target systems, allowed testing methods, and timing of the tests.

Seeking authorization will also prevent legal troubles in the future and ensure you have a cooperative process.

  • Document Findings and Recommendations

As a rule of thumb, you must always document all findings, such as vulnerabilities, exploitation methodologies, and risk mitigation recommendations. This documentation will become a good reference for the organization to understand its security posture, prioritize remediation efforts, and track progress over time.

  • Combine Automated and Manual Testing Methods

When pen testing in Azure, combining automated tools and manual testing methodologies can provide rigorous coverage, ensuring the pentest is effective. 

Firstly, automated tools help you to identify common vulnerabilities and misconfigurations quickly. Secondly, manual testing allows deeper analysis, helping you identify complex issues and understand the context of each finding within the specific environment.

  • Regularly Update and Patch Systems

Outdated systems are often more susceptible to attacks and exploitations. So, staying current with updates and patches ensures organizations can significantly reduce exposure to security threats and ensure overall resilience. 

  • Integrate Internal Staff

Although your pen testing efforts provide an external and unbiased assessment, always carry the internal Azure pen testers, developers, and engineers along. They know the organization better, and some of their key insights and familiarity with the system will make the tests much more of a breeze. Moreover, they'll likely implement the remediation measures for identified vulnerabilities.

Do’s and Don’ts of Microsoft Azure Pentesting

Here are some rules of engagement for penetration testing in Azure.

Actions not permitted by Microsoft include:

  • Conducting scans or tests on assets belonging to other Azure customers.
  • Accessing data that is not owned entirely by the tester.
  • Performing intensive network fuzzing on Azure virtual machines.
  • Executing tests that generate excessive traffic through automated methods.
  • Attempting phishing or social engineering attacks targeting Microsoft employees.
  • Initiating Distributed Denial of Service (DDoS) attacks.

Microsoft encourages the following steps for Azure penetration testing:

  • Running vulnerability scanning tools, port scans, or fuzzing tests on designated virtual machines.
  • Creating multiple test or trial accounts to assess cross-account access vulnerabilities while refraining from accessing other customers' data.
  • Testing for potential breaches that could allow access to assets of other Azure customers and promptly reporting any vulnerabilities to Microsoft for resolution.
  • Simulating expected traffic patterns, including regular working periods and surge capacity, to evaluate account performance.

Finally, note that although you’re encouraged to notify Microsoft before conducting penetration tests on Azure resources, pre-approval is no longer a requirement

Conclusion

As Microsoft Azure’s users grow and more technologies emerge, cyberattacks will undoubtedly grow. This makes it critical to continually conduct regular security assessments and penetration tests in Azure environments. Ensure you understand what works best for the enterprise, follow industry best practices, and adhere to Microsoft's guidelines.

At WebSec, we conduct penetration tests for organizations of all sizes to ensure you don’t incur massive losses due to cyberattacks. Our expert security team keeps you steps ahead of hackers, ensuring your business's success is safeguarded. Ready to find weaknesses or have questions? Contact us today.

Authored By
Gray Oshin

A Team Member at Websec

Deel met de wereld!

Beveiligingsbehoeften?

Bent u er echt zeker van dat uw organisatie veilig is?

Bij WebSec helpen we u deze vraag te beantwoorden door geavanceerde beveiligingsbeoordelingen uit te voeren.

Wil je meer weten? Plan een gesprek in met een van onze experts.

Afspraak Inplannen
Authored By
Gray Oshin

A Team Member at Websec