Windows File and Directory Permission Tampering via icacls.exe
Adversaries, including those using Amadey malware, utilize Windows utilities like icacls.exe to modify file permissions, facilitating defense evasion and persistence by hindering security analysis.
This threat involves the use of native Windows administrative utilities - specifically icacls.exe, cacls.exe, and xcacls.exe - to alter the security descriptors of files and directories on compromised endpoints. Attackers leverage these built-in tools to manipulate Access Control Lists (ACLs), effectively granting themselves privileged access, restricting security software from accessing malicious artifacts, or impeding incident response efforts.
This activity is commonly observed during the execution phase of campaigns, such as those employing Amadey malware, where adversaries aim to protect their persistence mechanisms and data exfiltration tools from administrative discovery. By modifying permissions, actors can prevent security tools from reading, deleting, or remediating malicious files, thereby maintaining control over the compromised system. Monitoring for these specific command-line execution patterns is critical for identifying unauthorized modifications of system security posture.
Attack Chain
- Initial access is established on the victim endpoint (e.g., via phish or exploit).
- Malware payload (e.g., Amadey) is executed on the target system.
- The attacker drops secondary components or malicious artifacts into a directory.
- The attacker executes
icacls.exeto modify the security descriptor of the directory or file. - The command includes flags such as /grant, /deny, /P, or /E to change the access rights.
- The modified permissions restrict access to the file for administrative or system accounts.
- The attacker maintains persistence while protecting the malicious payload from investigation.
Impact
Successful manipulation of file permissions can lead to a total loss of visibility for security operations teams and automated detection platforms. Attackers can prevent the deletion of malware, block forensic software from reading critical files, and preserve malicious persistence mechanisms. This technique is frequently observed across various campaigns, particularly where coinminers or infostealers are deployed, impacting the integrity of the endpoint and complicating recovery efforts for system administrators.
Recommendation
- Deploy the provided Sigma rule to detect the execution of
icacls.exeorcacls.exewith permission modification flags. - Ingest Sysmon Event ID 1 or Windows Security Event 4688 logs into the SIEM to ensure command-line visibility.
- Enable process creation logging globally to capture the full command-line arguments used during permission changes.
- Tune detections against legitimate administrative activities, such as software installers or backup scripts, that may legitimately modify ACLs.
Immediate actions
Deploy detection rule for icacls permission changes
Threat Hunt
Search for instances of icacls.exe, cacls.exe, or xcacls.exe executing with /grant, /deny, or /P flags in historical logs.
Data: Process creation logs with command lines
Detection coverage 1
Detect Windows File Access Rights Modification via icacls
mediumDetects the use of icacls, cacls, or xcacls with command-line flags indicative of security permission modification
Detection queries are available on the platform. Get full rules →