Sysmon Event ID 11
Sysmon Event ID 11: File Created
FileCreate
- Log source
- Microsoft-Windows-Sysmon/Operational
- How to enable it
- Sysmon installed, with a FileCreate section in its configuration
- Category
- Persistence
- Priority
- Medium
- Typical volume
- High
- MITRE ATT&CK
What Sysmon Event ID 11 means
Sysmon event 11 is logged when a file is created or overwritten, with the program responsible. It does not say what is inside, but knowing which program wrote which path answers a surprising number of questions.
The pairing is everything. A .php file in a web folder written by an editor is work, and the same file written by the web server process is a web shell. A .dmp file made by a crash handler is routine, and one made by rundll32.exe in a temporary folder is probably LSASS.
Unlike 4663 it needs no SACL and covers the entire system, so a configuration with the right folders and extensions gives broad cover. Watch startup folders, task and service locations, web roots, temporary folders and script extensions.
Key fields to inspect
| Field | Meaning | Suspicious when |
|---|---|---|
Image | Program that wrote the file. | Office programs, script hosts, web servers, or System for files that arrive over SMB. |
TargetFilename | Full path of the file. | Startup folders, web roots, ADMIN$ locations, and .exe, .dll, .ps1, .lnk, .hta or .iso in user folders. |
CreationUtcTime | Creation time of the file. | A date in the past, which can mean that the timestamp was altered. |
ProcessGuid | Unique identifier of the writer. | Join it with event 1 for the command line. |
User | Account of the writer, on newer versions. | A service account writing programs. |
Detection queries
Find scripts written by web servers, files placed in startup folders, and programs written by office software. Adjust names and thresholds to your environment. About these queries.
Splunk SPL
index=windows source="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=11
| eval webshell=if(match(Image, "(?i)(w3wp|httpd|nginx|php-cgi|tomcat\d*|java)\.exe$") AND match(TargetFilename, "(?i)\.(aspx?|ashx|jsp|php)$"), 1, 0)
| eval startup=if(match(TargetFilename, "(?i)\\\\Start Menu\\\\Programs\\\\Startup\\\\"), 1, 0)
| eval office=if(match(Image, "(?i)(winword|excel|powerpnt|outlook)\.exe$") AND match(TargetFilename, "(?i)\.(exe|dll|ps1|vbs|js|hta|lnk|bat)$"), 1, 0)
| where webshell=1 OR startup=1 OR office=1
| table _time Computer Image TargetFilename webshell startup office Microsoft Sentinel KQL
Event
| where EventLog == "Microsoft-Windows-Sysmon/Operational" and EventID == 11
| extend Image = extract(@'Name="Image">([^<]*)<', 1, EventData)
| extend TargetFilename = extract(@'Name="TargetFilename">([^<]*)<', 1, EventData)
| extend WebShell = Image matches regex @"(?i)(w3wp|httpd|nginx|php-cgi|tomcat\d*|java)\.exe$" and TargetFilename matches regex @"(?i)\.(aspx?|ashx|jsp|php)$"
| extend Startup = TargetFilename has @"\Start Menu\Programs\Startup\"
| extend Office = Image matches regex @"(?i)(winword|excel|powerpnt|outlook)\.exe$" and TargetFilename matches regex @"(?i)\.(exe|dll|ps1|vbs|js|hta|lnk|bat)$"
| where WebShell or Startup or Office
| project TimeGenerated, Computer, Image, TargetFilename, WebShell, Startup, Office PowerShell
Get-WinEvent -FilterHashtable @{ LogName = 'Microsoft-Windows-Sysmon/Operational'; Id = 11; StartTime = (Get-Date).AddDays(-1) } |
ForEach-Object { $d = @{ Time = $_.TimeCreated }; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
Where-Object { $_.TargetFilename -match 'Startup\\|\.(aspx|ashx|jsp|php|hta|lnk)$' } |
Select-Object Time, Image, TargetFilename, CreationUtcTime | Format-Table -AutoSize Attack scenarios
Web shell upload
A vulnerability lets an attacker write a script through the web server. Image is w3wp.exe or java.exe, and the file has a script extension inside the web root. Commands follow as child processes.
Startup persistence
A shortcut or script appears in a Startup folder. It runs at the next logon without any service, task or registry change.
LSASS dump on disk
rundll32.exe with comsvcs.dll, Task Manager or a renamed ProcDump writes a .dmp file of tens of megabytes. The name may be disguised, so look at the writer and folder as well as the extension.
Investigation checklist
- Join with event 1 on ProcessGuid for the command line and parent.
- Collect the file and hash it before it is deleted.
- Check whether the file was executed (event 1) or loaded (event 7) later.
- For System as the writer, find the SMB session in 5145 and 4624.
- Search for the same name or hash on other hosts.
Common benign causes
- Installers, updaters and browsers, which write programs constantly.
- Deployment pipelines that publish to web folders, under known accounts.
- Office programs that write temporary files and add-ins.
Sysmon Event ID 11 FAQ
Does Sysmon event 11 log file modification?
It is logged when a file is created or overwritten. Writing to an existing file that is already open does not necessarily create it. Use event 2 for changed creation times, and 4663 with a SACL for detailed access.
Does Sysmon event 11 include a file hash?
No. Hash the file yourself, or look for event 1 or event 7 if it was executed or loaded. Event 29 reports newly created executable files with a hash on recent versions.
Why is Image shown as System?
The file was written by the kernel on behalf of a remote client, which usually means that it arrived over SMB. Match the time with 5145 and 4624 to find the source.