Defense evasion · Windows
icacls.exe
icacls
Shows and changes file and folder permissions. Granting broad rights to a protected file, or resetting ACLs, is used to tamper with protected data and clear the way for other actions.
Legitimate use
Admins use it to view, grant, remove and back up NTFS permissions.
Switches
Grants permissions. grant:r replaces existing rights for the account.
MediumRemoves an account's permissions.
MediumAdds a deny entry, which can lock others out of a file.
MediumResets permissions to those inherited from the parent, removing explicit entries.
MediumChanges the owner of the object.
MediumApplies the change to the whole folder tree.
LowSaves ACLs to a file.
InfoCommand lines to worry about
- Medium
Full control granted to a broad group
Granting full control to Everyone or Users on a file weakens its protection. Check which file and why.
Detection regex
icacls(\.exe)?\s+.*\/grant\s+\S*(everyone|users|authenticated users)\S*:\S*f
Where it is recorded
- Security4688Process creation with the full command line, when command-line auditing is enabled.
- Sysmon1Process creation with command line, hashes and parent process.
Community detections
1 SigmaHQ rule for icacls.exe. The explainer checks every pasted command line against all of them.
- MediumUse Icacls to Hide File to Everyone
Detect use of icacls to deny access for everyone in Users folder sometimes used to hide malicious files
T1564.001by frack113
Rules from SigmaHQ (rules/windows/process_creation), Detection Rule License (DRL) 1.1. Each rule links to its source and credits its authors.