Blog Post

Microsoft Defender for Cloud Blog
6 MIN READ

How-to use Microsoft Defender for Cloud Ransomware alerts to preserve Azure Backup recovery points

Vasavi_Pasula's avatar
Vasavi_Pasula
Icon for Microsoft rankMicrosoft
Dec 09, 2022

CreditsThis blog post has been co-authored by Chaya AishwaryaAutomation samples developed by Akhil NampellyRajath Ranganath and Vasavi Pasula. ReviewersSrinath Vasireddy, Anshul Ahuja, Neeraj Jain, Pratik JoshiKalyan Karri, Sivasubramanian Narayanan, Yuri Diogenes

 

Introduction 

Ransomware attacks deliberately encrypt or tamper data to force your organization to pay money to attackers. These attacks can target your data and your backups. The best way to prevent falling victim to ransomware is to implement preventive measures and have tools that protect your organization from every step that attackers take to infiltrate your systems. You can leverage Azure native ransomware protection capabilities and implement the best practices to ensure your organization is optimally positioned to prevent, protect, and detect potential ransomware attacks on your Azure assets. 

 

One of the most important steps you can take to protect your data is to have a reliable backup infrastructure. But it's just as important to ensure that your data is backed up in a secure fashion, and that your backups are always protected. Azure Backup provides several security capabilities to help you protect your backup data – Soft Delete is enabled by default, even if a malicious actor deletes a backup (or backup data is accidentally deleted), the backup data is retained for 14 additional days, allowing the recovery of that backup item with no data loss.  Immutable vault can help you protect your backup data by blocking any operations that could lead to loss of recovery points. You can configure Multi-user authorization (MUA) for Azure Backup as an additional layer of protection to critical operations on your Recovery Services vaults. Even if security best practices are not followed and notifications aren't configured for the Recovery Services vault, critical alert for destructive operation (such as stop protection with delete backup data) are still raised and an email is sent to subscription owners, admins, and co-admins (learn more).  

 

Microsoft Defender for Cloud is a Cloud Security Posture Management (CSPM) and Cloud Workload Protection Platform (CWPP) for all of your Azure, on-premises, and multicloud (Amazon AWS and Google GCP) resources. Defender for Cloud generates security alerts when threats are identified in your cloud, hybrid, or on-premises environment. It is available when you enable enhanced security features. Each alert provides details of affected resources along with the information you need to quickly investigate the problem and steps to take to remediate an attack. In the event of a malware or a ransomware attack on an Azure Virtual Machine, Microsoft Defender for Cloud detects suspicious activity and indicators associated with ransomware on an Azure VM and generates a Security Alert.

Here are the Defender for Cloud Alerts that trigger on a Ransomware detection: 

  • Detected Petya ransomware indicators 
  • Ransomware indicators detected 
  • Behavior similar to Fairware ransomware detected 
  • Behavior similar to ransomware detected 

Defender for Cloud provides threat intelligence reports containing information about detected threats. This helps incident response teams investigate and remediate threats. For more details: Microsoft Defender for Cloud threat intelligence report | Microsoft Learn

 

Solution details  

Assume Virtual Machine protected by both Defender and Azure Backup is breached. Defender detects the ransomware, raises an alert which includes details of the activity and suggested recommendations to remediate. As soon as a ransomware signal is detected from Defender, ensuring backups are preserved (i.e., paused from expiring) to minimize the data loss is top of our customers’ mind. This sample solution demonstrates integration of Azure Backup with Microsoft Defender for Cloud for detection and response to alerts to accelerate response. Sample illustrates following three uses cases: 1) ability to send email alerts to backup admin 2) SecOps admin triages and manually triggers logic app to secure backups and 3) Workflow to automatically respond to the alert by performing the Disable Backup Policy (Stop backup and retain data) operation. 

 

Step-by-Step instructions 

Prerequisites: 

Note: This sample solution is scoped to Azure Virtual Machines. The logic app can only be deployed at a subscription level, which means that all Azure VMs under the subscription can leverage the logic app for pausing expiry of recovery points in the event of a security alert.  

 

 

 

Step 1: Deploy the logic app 

Note: Owner access on the Subscription is needed to deploy the logic app.   

  • Visit Github and click on ‘Deploy to Azure’ as shown below: 

 

  1. Input the following values in the deployment page: 

 

Subscription: Select the Subscription whose Azure VMs the logic app should govern.  

Name: Input a suitable name for the logic app. 

Region: Choose the region with which the Subscription is associated.  

Email: Input the email address of the Backup admin for them to receive alerts when policy is suspended.   

Resource Group: Logic apps need to be associated with a Resource Group for deployment. Choose any Resource Group for the same.  

Managed Identity: Create and assign a Managed Identity (for guidance on creating a User-defined Managed Identity, visit here ) with the below minimum permissions for the service to perform the operation of ‘Stop backup and retain data’ on the backup item automatically in the event of a malware alert.  

  • Virtual Machine Contributor on the subscription 
  • Backup Operator on the subscription 
  • Security Reader 

Note: To further tighten the security, we recommend you create a custom role and assign that to the Managed Identity instead of the above built-in roles. This will ensure that all the calls run with least privileges. For more details on custom role, visit Github article.  

 

Managed Identity Subscription: Input the name of a Subscription that the Managed Identity should reside in.  

Managed Identity Resource Group: Input the name of a Resource Group that the Managed Identity should reside in.  

 

Step 2: Authorize Office 365 for email alerts 

To authorize the API connection to Office 365: 

  • Go to the Resource Group you have used to deploy the template resources. 
  • Select the Office365 API connection (which is one of the resources you just deployed) and click on the error that appears at the API connection. 
  • Press Edit API connection. 
  • Press the Authorize button. 
  • Make sure to authenticate against Azure AD. 
  • Press Save. 

Step 3: Triggering the logic app 

The logic app deployed in step 1 can be triggered manually or automatically by leveraging workflow automation.  

 

Triggering manually: 

  • Visit Microsoft Defender for Cloud and navigate to Security Alerts in the sidebar.    
  • Click on the required alert to expand details.   
  • Click on ‘Take action’ and choose ‘Trigger automated response’ and click on ‘Trigger logic app’.  
  • Search the logic app deployed in step 1 by name and click ‘Trigger’.   

Note: The minimum RBAC permissions needed for triggering an action for the security alert are as follows: Logic app Operator, Security Admin role 

 

Triggering using workflow automation via Azure portal: 

Workflow automation will ensure that in the event of a security alert, your backups corresponding to the VM facing this issue will automatically reach ‘Stop backup and retain data’ state hence suspending policy and pause recovery point pruning. You can also use Azure Policy to deploy workflow automations. 

 

Note: Minimum roles of Logic app Operator and Security Admin are required to deploy the workflow automation.  

 

  • Visit Defender for Cloud's sidebar, select Workflow automation.  
  • Select Add workflow automation. The options pane for your new automation opens. 
  • Input the following values: 
    • Name and Description: Input a suitable name for the automation. 
    • Subscription: Define the scope of the automation, this should be the same as the scope of the logic app.  
    • Resource Group: Choose the RG in which the automation will reside.  
    • Defender for Cloud Data Type: Security Alert 
    • Alert name contains: ‘Malware’ or ‘ransomware’ 
    • Alert severity: High 
    • Logic app: Choose the logic app deployed in step 1 

Step 4: Email Alerts  

Upon disabling the backup policy on the backup item, the logic app also sends an email to the ID entered during deployment. The email ID should ideally be that of the Backup Admin. The alert can then be investigated, and the backups can be resumed once the issue is resolved or if it is a false alarm. 

 

Additional Resources:

 

Published Dec 09, 2022
Version 1.0
  • In addition to the preventive measures and tools mentioned above, here are some further suggestions to protect your organization from ransomware attacks:

    1. Train your employees on ransomware: Employees can be the weakest link in your organization's security, so it's important to educate them on how ransomware attacks work and what to look out for. Make sure they know not to open suspicious emails or attachments, and to report any unusual activity or messages to IT immediately.

    2. Use multi-factor authentication (MFA): MFA adds an extra layer of security to your login process, making it harder for attackers to gain access to your systems. It's recommended to enable MFA for all users who have access to sensitive data or critical systems.

    3. Regularly patch and update software: Ransomware attacks often exploit vulnerabilities in outdated software, so it's important to keep all software up to date with the latest security patches and updates.

    4. Implement a strong password policy: Passwords should be complex, unique, and changed regularly. Consider using a password manager to help users generate and store strong passwords.

    5. Limit user access: Only give users the access they need to perform their job functions. This can help minimize the impact of a ransomware attack by limiting the number of systems and data that could be affected.

    6. Monitor for unusual activity: Use tools like Azure Sentinel to monitor your environment for suspicious activity, such as unusual login attempts or data exfiltration.

    7. Develop a ransomware response plan: Have a plan in place for how your organization will respond in the event of a ransomware attack. This should include steps for isolating infected systems, notifying stakeholders, and restoring data from backups.

    By implementing these measures and leveraging the tools available in Azure, you can greatly reduce the risk of falling victim to a ransomware attack and minimize the impact if one does occur.

  • Dean_Gross's avatar
    Dean_Gross
    Silver Contributor

    Vasavi_Pasula Thanks for this example, what feature requires Defender for Servers Plan 2? how come this won't work with Plan 1?