Defense evasion · Windows
attrib.exe
Attrib
Shows and changes file attributes. Setting hidden and system on files conceals dropped tooling and staged data from a casual look at a folder.
Legitimate use
Used in scripts to set or clear read-only, hidden, system and archive attributes.
Switches
With +h, sets the hidden attribute, which keeps a file out of default views.
MediumWith +s, sets the system attribute, which hides a file further.
MediumSets or clears read-only.
InfoSets or clears the archive attribute.
InfoCommand lines to worry about
- Medium
File hidden with attrib
Setting hidden and system attributes conceals a file from default views. Check what file was hidden and when it was created.
Detection regex
attrib(\.exe)?\s+\+[a-z]*(h\+?s|s\+?h|h|s)\b
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
3 SigmaHQ rules for attrib.exe. The explainer checks every pasted command line against all of them.
- HighSet Suspicious Files as System Files Using Attrib.EXE
Detects the usage of attrib with the "+s" option to set scripts or executables located in suspicious locations as system files to hide them from users and make them unable to be deleted with simple rights. The rule limits the search to specific extensions and directories to avoid FPs
T1564.001by Nasreddine Bencherchali (Nextron Systems)
- MediumHackTool - Jlaive In-Memory Assembly Execution
Detects the use of Jlaive to execute assemblies in a copied PowerShell
T1059.003by Jose Luis Sanchez Martinez (@Joseliyo_Jstnk)
- MediumHiding Files with Attrib.exe
Detects usage of attrib.exe to hide files from users.
T1564.001by Sami Ruohonen
Rules from SigmaHQ (rules/windows/process_creation), Detection Rule License (DRL) 1.1. Each rule links to its source and credits its authors.