Protect important folders with controlled folder access
Applies to:
- Microsoft Defender for Endpoint Plan 1
- Microsoft Defender for Endpoint Plan 2
- Microsoft Defender XDR
- Microsoft Defender Antivirus
Applies to
- Windows
Want to experience Defender for Endpoint? Sign up for a free trial.
What is controlled folder access?
Controlled folder access helps protect your valuable data from malicious apps and threats, such as ransomware. Controlled folder access protects your data by checking apps against a list of known, trusted apps. Controlled folder access can be configured by using the Windows Security App, Microsoft Endpoint Configuration Manager, or Intune (for managed devices). Controlled folder access is supported on Windows Server 2012 R2, Windows Server 2016, Windows Server 2019, Windows Server 2022, Windows 10, and Windows 11,
Note
Scripting engines like PowerShell are not trusted by controlled folder access, even if you create an "allow" indicator by using certificate and file indicators. The only way to allow script engines to modify protected folders is by adding them as an allowed app. See Allow specific apps to make changes to controlled folders.
Controlled folder access works best with Microsoft Defender for Endpoint, which gives you detailed reporting into controlled folder access events and blocks as part of the usual alert investigation scenarios.
Tip
Controlled folder access blocks don't generate alerts in the Alerts queue. However, you can view information about controlled folder access blocks in the device timeline view, while using advanced hunting, or with custom detection rules.
How does controlled folder access work?
Controlled folder access works by only allowing trusted apps to access protected folders. Protected folders are specified when controlled folder access is configured. Typically, commonly used folders, such as those used for documents, pictures, downloads, and so on, are included in the list of controlled folders.
Controlled folder access works with a list of trusted apps. Apps that are included in the list of trusted software work as expected. Apps that are not included in the list are prevented from making any changes to files inside protected folders.
Apps are added to the list based upon their prevalence and reputation. Apps that are highly prevalent throughout your organization and that have never displayed any behavior deemed malicious are considered trustworthy. Those apps are added to the list automatically.
Apps can also be added manually to the trusted list by using Configuration Manager or Intune. Additional actions can be performed from the Microsoft Defender portal.
Why controlled folder access is important
Controlled folder access is especially useful in helping to protect your documents and information from ransomware. In a ransomware attack, your files can get encrypted and held hostage. With controlled folder access in place, a notification appears on the computer where an app attempted to make changes to a file in a protected folder. You can customize the notification with your company details and contact information. You can also enable the rules individually to customize what techniques the feature monitors.
The protected folders include common system folders (including boot sectors), and you can add more folders. You can also allow apps to give them access to the protected folders.
You can use audit mode to evaluate how controlled folder access would impact your organization if it were enabled.
Windows system folders are protected by default
Windows system folders are protected by default, along with several other folders:
The protected folders include common system folders (including boot sectors), and you can add additional folders. You can also allow apps to give them access to the protected folders. The Windows systems folders that are protected by default are:
c:\Users\<username>\Documents
c:\Users\Public\Documents
c:\Users\<username>\Pictures
c:\Users\Public\Pictures
c:\Users\Public\Videos
c:\Users\<username>\Videos
c:\Users\<username>\Music
c:\Users\Public\Music
c:\Users\<username>\Favorites
Default folders appear in the user's profile, under This PC, as shown in the following image:
Note
You can configure additional folders as protected, but you cannot remove the Windows system folders that are protected by default.
Requirements for controlled folder access
Controlled folder access requires enabling Microsoft Defender Antivirus real-time protection.
Review controlled folder access events in the Microsoft Defender portal
Defender for Endpoint provides detailed reporting into events and blocks as part of its alert investigation scenarios in the Microsoft Defender portal; see Microsoft Defender for Endpoint in Microsoft Defender XDR.
You can query Microsoft Defender for Endpoint data by using Advanced hunting. If you're using audit mode, you can use advanced hunting to see how controlled folder access settings would affect your environment if they were enabled.
Example query:
DeviceEvents
| where ActionType in ('ControlledFolderAccessViolationAudited','ControlledFolderAccessViolationBlocked')
Review controlled folder access events in Windows Event Viewer
You can review the Windows event log to see events that are created when controlled folder access blocks (or audits) an app:
Download the Evaluation Package and extract the file cfa-events.xml to an easily accessible location on the device.
Type Event viewer in the Start menu to open the Windows Event Viewer.
On the left panel, under Actions, select Import custom view....
Navigate to where you extracted cfa-events.xml and select it. Alternatively, copy the XML directly.
Select OK.
The following table shows events related to controlled folder access:
Event ID | Description |
---|---|
5007 |
Event when settings are changed |
1124 |
Audited controlled folder access event |
1123 |
Blocked controlled folder access event |
1127 |
Blocked controlled folder access sector write block event |
1128 |
Audited controlled folder access sector write block event |
View or change the list of protected folders
You can use the Windows Security app to view the list of folders that are protected by controlled folder access.
On your Windows 10 or Windows 11 device, open the Windows Security app.
Select Virus & threat protection.
Under Ransomware protection, select Manage ransomware protection.
If controlled folder access is turned off, you'll need to turn it on. Select protected folders.
Do one of the following steps:
- To add a folder, select + Add a protected folder.
- To remove a folder, select it, and then select Remove.
Important
Do not add local share paths (loopbacks) as protected folders. Use the local path instead. For example, if you have shared
C:\demo
as\\mycomputer\demo
, do not add\\mycomputer\demo
to the list of protected folders. Instead addC:\demo
.
Windows system folders are protected by default, and you cannot remove them from the list. Subfolders are also included in protection when you add a new folder to the list.
Tip
Do you want to learn more? Engage with the Microsoft Security community in our Tech Community: Microsoft Defender for Endpoint Tech Community.