Malware Scanning in Defender for Storage

Malware Scanning in Defender for Storage helps protect your storage accounts from malicious content by performing a full malware scan on uploaded content in near real time, using Microsoft Defenders Antivirus capabilities. It's designed to help fulfill security and compliance requirements to handle untrusted content.

The Malware Scanning capability is an agentless SaaS solution that allows simple setup at scale, with zero maintenance, and supports automating response at scale.

Diagram showing how malware scanning protects your data from malicious code.

Malware upload is a top threat on cloud storage

Content uploaded to cloud storage could be malware. Storage accounts can be a malware entry point into the organization and a malware distribution point. To protect organizations from this threat, content in cloud storage must be scanned for malware before it's accessed.

Malware Scanning in Defender for Storage helps protect storage accounts from malicious content

  • A built-in SaaS solution that allows simple enabling at scale with zero maintenance.

  • Comprehensive antimalware capabilities using Microsoft Defender Antivirus (MDAV), catching polymorphic and metamorphic malware.

  • Every file type is scanned (including archives like zip files) and a result is returned for every scan. The file size limit is 2 GB.

  • Supports response at scale – deleting or quarantining suspicious files, based on the blobs’ index tags or Event Grid events.

  • When the malware scan identifies a malicious file, detailed Microsoft Defenders for Cloud security alerts are generated.

  • Designed to help fulfill security and compliance requirements to scan untrusted content uploaded to storage, including an option to log every scan result.

Common use-cases and scenarios

Some common use-cases and scenarios for Malware Scanning in Defender for Storage include:

  • To protect storage accounts from malicious content, especially when content in the storage account is uploaded from untrusted sources (customers and partners, anonymous users, etc.)

  • To comply with compliance standards that require on-upload malware scanning for noncompute resources (NIST, SWIFT, UK GOV, and more), and collecting the necessary evidence for compliance audits.

Prerequisites

You can enable and configure Malware Scanning at scale for your subscriptions while maintaining granular control over configuring the feature for individual storage accounts. To set up and customize Malware Scanning in Defender for Storage, you can choose from various methods, including the Azure portal, Azure policy, ARM or Bicep templates, and REST API.

To enable and configure Malware Scanning, you must have Owner roles (such as Subscription Owner or Storage Account Owner) or specific roles with the necessary data actions. Learn more about the required permissions.

How does Malware Scanning work?

Set up of Malware Scanning

When Malware Scanning is enabled, the following actions automatically take place in your environment:

  • For each storage account you enable Malware Scanning on, an Event Grid System Topic resource is created in the same resource group of the storage account - used by the Malware Scanning service to listen on blob upload triggers. Removing this resource breaks the Malware Scanning functionality.

  • To scan your data, the Malware Scanning service requires access to your data. During service enablement, a new Data Scanner resource called StorageDataScanner is created in your Azure subscription and assigned with a system managed identity. This resource is granted Blob data owner role to access and change your data for Malware Scanning and Sensitive Data Discovery.

In case your storage account Networking configuration is set to Enable Public network access from selected virtual networks and IP addressed, the StorageDataScanner resource is added to the Resource instances section under storage account Networking configuration to allow access to scan your data.

In case you're enabling Malware Scanning on the subscription level, a new resource Security Operator resource called StorageAccounts/securityOperators/DefenderForStorageSecurityOperator is created in your Azure subscription and assigned with a system managed identity. This resource is used to enable and repairer Defender for Storage and Malware Scanning configuration on existing storage account in addition to check for new storage accounts created in the subscription to be enabled. This resource has role assignments that include the specific permissions needed to enable Malware Scanning.

Note

Removing these resources or changing the identity or networking will break the Malware Scanning functionality. To heal from such an issue, you can simply disable and re-enable Malware Scanning.

On-upload malware scanning

On-upload triggers

When a blob is uploaded to a protected storage account - a malware scan is triggered. All upload methods trigger the scan. Modifying a blob is an upload operation and therefore the modified content is scanned after the update.

Scan regions and data retention

The blob is read by the Malware Scanning service that uses Microsoft Defender Antivirus technologies. The malware scanning is regional, the scanned content stays within the same region. The content isn't saved by the service, it's scanned "in-memory" and immediately deleted afterward.

Latency

Scan are performed near-real time. The throughput for each storage account is 2GB/min, passing this results in a slowdown. The scanning process and its results don't interfere with or block access to the uploaded data. The scanning has minimal impact on storage IOPS. For every blob that is uploaded to the account, Malware Scanning adds a read operation and an index tag update operation. The limit on blob accounts is 20K transactions per second, so, depending on the workload of the application, the added operations in most cases are negligible.

Access customer data

To scan your data, the Malware Scanning service requires access to your data. During service enablement, a new Data Scanner resource called StorageDataScanner is created in your Azure subscription. This resource is granted Blob data owner role to access and change your data for Malware Scanning and Sensitive Data Discovery.

Providing scan results

Malware Scanning scan results are available through four methods. After setup, you'll see scan results as blob index tags for every uploaded and scanned file in the storage account, and as Microsoft Defender for Cloud security alerts when a file is identified as malicious.

You may choose to configure extra scan result methods, such as Event Grid and Log Analytics, which require extra configuration. In the next section, you'll learn about the different scan result methods.

Scan results

Blob index tags

Blob index tags are metadata fields on a blob. They categorize data in your storage account using key-value tag attributes. These tags are automatically indexed and exposed as a searchable multi-dimensional index to easily find data. The scan results are concise, displaying Malware Scanning scan result and Malware Scanning scan time UTC in the blob metadata. Other result types (alerts, events, logs) provide more information on the malware type and file upload operation.

Screenshot showing how Blob index tags are shown in the Azure portal.

Malware Scanning Index Tags Keys added:

  • Malware Scanning scan result possible values:

    • No threats found
    • Malicious
    • SAM259210: Scan aborted - <message> Correlation Id: <correlation-id-guid>
    • SAM259210: Scan failed - <message> Correlation Id: <correlation-id-guid>
    • SAM259210: Scan timed out - <message> Correlation Id: <correlation-id-guid> If there are issues, you can provide this <correlation-id-guid> to Microsoft support for troubleshooting.
  • Malware Scanning scan time UTC possible values:

    • The time and date of the scan. Format: yyyy-MM-dd HH:mm:ssZ

Note

  • blob index tags are not tamper-resistant. Blob index tags can be edited by anyone with the Storage Blob Data Owner built-in role, or anyone with the blob/tags/write permission. All other result types are tamper-proof (can only be changed by Microsoft Defender)
  • Index tags are not supported for premium block blobs and ADLS Gen2.

Blob index tags can be used by applications to automate workflows. Read more on setting up response.

Defender for Cloud security alerts

When a malicious file is detected, Microsoft Defender for Cloud generates a Microsoft Defender for Cloud security alert. To see the alert, go to Microsoft Defender for Cloud security alerts. The security alert contains details and context on the file, the malware type, and recommended investigation and remediation steps. To use these alerts for remediation, you can:

  1. View security alerts in the Azure portal by navigating to Microsoft Defender for Cloud -> Security alerts
  2. Configure automations based on these alerts.
  3. Export security alerts to a SIEM. You can continuously export security alerts Microsoft Sentinel (Microsoft’s SIEM) using Microsoft Sentinel connector, or another SIEM of your choice.

Learn more about responding to security alerts.

Event Grid event

Event Grid is useful for event-driven automation. It's the fastest method to get results with minimum latency in a form of events that you can use for automating response.

Events from Event Grid custom topics can be consumed with multiple endpoint types. The most useful for Malware Scanning scenarios are:

  • Function App (previously called Azure Function) – use a serverless function to run code for automated response like move, delete or quarantine.
  • Web Hook – to connect an application.
  • Event Hubs & Service Bus Queue – to notify downstream consumers.

For each scan result, an event is sent using the below schema where the <scanResultType> field contains the scan result of the uploaded blob <blobUri> and are used as part of your response automation logic.

Learn more about setting up Event Grid.

Logs Analytics

You may want to log your scan results for compliance evidence or investigating scan results. By setting up a Log Analytics Workspace destination, you can store every scan result in a centralized log repository that is easy to query. You can view the results by navigating to the Log Analytics destination workspace and looking for the StorageAntimalwareScanResults table.

Screenshot showing how Log Analytics results are shown in the Azure portal.

Learn more about setting up Log Analytics results.

Cost control

Malware Scanning is billed per GB scanned. To provide cost predictability, Malware Scanning supports setting a cap on the amount of GB scanned in a single month per storage account. This setting can be set at the subscription level to apply to each storage account in the subscription, or you can set it for a specific storage account. The default value for each storage account is 5000GB per month, and after crossing this limit, blobs won't be scanned (with up to a 20-GB confidence interval). Learn about how to configure scan limits.

Handling possible false positives

If you have a file that you suspect might be malware or is being incorrectly detected, you can submit it to us for analysis through the sample submission portal. Select “Microsoft Defender for Storage” as the source.

Malware Scanning doesn't block access or change permissions to the uploaded blob, even if it's malicious.

Limitations

  • Legacy v1 storage accounts aren't supported
  • Azure Files isn't supported for Malware Scanning
  • Client-side encrypted blobs aren't supported (they can't be decrypted before scan by the service). [data encrypted at rest by CMK is supported].
  • File size limit is 2 GB
  • The “capping” mechanism is currently not functional. You can set your limitations now, and they'll set in when “capping” starts working.
  • Malware Scanning scan throughput rate limit per-storage-account – 2GB/min
  • Uploading in a higher rate results in a slow-down scan – files are scanned later
  • Index tag scan result isn't supported in storage account with Hierarchical namespace enabled (Azure Data Lake Storage Gen2)
  • Append and Page blobs aren't supported for Malware Scanning.

Next steps

In this article, you learned about Microsoft Defender for Storage.