| ID | Technique | Tactic |
|---|---|---|
| T1027.006 | HTML Smuggling | Stealth |
| T1059.001 | PowerShell | Execution |
| T1105 | Ingress Tool Transfer | Command and Control |
Detection: Windows PowerShell Script Block Browser Cache Access
Description
This analytic detects PowerShell Script Block Logging events that enumerate or read browser cache directories. PowerShell inspecting Firefox, Chrome, Edge, Brave, or Chromium cache files can indicate cache smuggling, where web content disguised as an image is extracted and staged for execution. The analytic looks for browser cache paths together with file enumeration or read operations, rather than relying on cache markers or a specific payload name.
Search
1`powershell`
2EventCode=4104
3ScriptBlockText IN (
4 "*Copy-Item *",
5 "*gci *",
6 "*Get-ChildItem *",
7 "*Get-Content *",
8 "*ReadAllBytes*",
9 "*ReadAllText*",
10 "*ReadBytes*",
11 "*Select-String*",
12 "*WriteAllBytes*"
13)
14
15ScriptBlockText IN (
16 "*Cache_Data*",
17 "*cache2*entries*"
18)
19
20
21| eval script_block=lower(ScriptBlockText)
22
23
24| eval cache_family=case(
25 like(script_block, "%mozilla%firefox%profiles%") AND like(script_block, "%cache2%entries%"), "Firefox",
26 like(script_block, "%google%chrome%user data%") AND like(script_block, "%cache_data%"), "Chrome",
27 like(script_block, "%microsoft%edge%user data%") AND like(script_block, "%cache_data%"), "Edge",
28 like(script_block, "%bravesoftware%brave-browser%user data%") AND like(script_block, "%cache_data%"), "Brave",
29 like(script_block, "%user data%") AND like(script_block, "%cache_data%"), "Chromium"
30 )
31
32
33| where isnotnull(cache_family)
34
35
36| eval dest=coalesce(dest, Computer, dvc, host)
37
38| eval user=coalesce(user, UserID, User)
39
40
41| stats count min(_time) as firstTime
42 max(_time) as lastTime
43 values(cache_family) as cache_family
44 values(ScriptBlockText) as ScriptBlockText
45 values(Path) as Path values(Guid) as Guid
46
47 by dest user ScriptBlockId ProcessID signature signature_id
48
49
50| `security_content_ctime(firstTime)`
51
52| `security_content_ctime(lastTime)`
53
54| `windows_powershell_script_block_browser_cache_access_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Powershell Script Block Logging 4104 | 'XmlWinEventLog' |
'XmlWinEventLog:Microsoft-Windows-PowerShell/Operational' |
Macros Used
| Name | Value |
|---|---|
| security_content_ctime | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$) |
| windows_powershell_script_block_browser_cache_access_filter | search * |
windows_powershell_script_block_browser_cache_access_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
Default Configuration
This detection is configured by default in Splunk Enterprise Security to run with the following settings:
| Setting | Value |
|---|---|
| Disabled | true |
| Cron Schedule | 0 * * * * |
| Earliest Time | -70m@m |
| Latest Time | -10m@m |
| Schedule Window | auto |
| Creates Finding (Notable) | No |
| Creates Intermediate Finding (Risk Event) | Yes |
Implementation
To successfully implement this analytic, you will need to enable PowerShell Script Block Logging on some or all endpoints. Setup instructions can be found here, https://help.splunk.com/en/security-offerings/splunk-user-behavior-analytics/get-data-in/5.4.1/add-other-data-to-splunk-uba/configure-powershell-logging-to-see-powershell-anomalies-in-splunk-uba.
Known False Positives
Administrators or support scripts may inspect browser caches for troubleshooting, cleanup, or forensic analysis. Review the script content, user, host, and any subsequent file creation or script execution before disposition.
Associated Analytic Story
Intermediate Findings
| Message | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| PowerShell Script with block ID [$ScriptBlockId$] attempted to access or read the [$cache_family$] browser cache on [$dest$] | dest | system | 20 |
Threat Objects
| Field | Type |
|---|---|
| ScriptBlockId | signature |
References
Detection Testing
| Test Type | Status | Dataset | Source | Sourcetype |
|---|---|---|---|---|
| Validation | ✅ Passing | N/A | N/A | N/A |
| Unit | ✅ Passing | Dataset | XmlWinEventLog:Microsoft-Windows-PowerShell/Operational |
XmlWinEventLog |
| Integration | ✅ Passing | Dataset | XmlWinEventLog:Microsoft-Windows-PowerShell/Operational |
XmlWinEventLog |
Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
Source: GitHub |
Version: 1