Skip to content

Commit d951b5b

Browse files
Update T1083.yaml (#3222)
Co-authored-by: Hare Sudhan <code@0x6c.dev>
1 parent f6ef319 commit d951b5b

File tree

1 file changed

+72
-5
lines changed

1 file changed

+72
-5
lines changed

atomics/T1083/T1083.yaml

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ atomic_tests:
9191
- name: Simulating MAZE Directory Enumeration
9292
auto_generated_guid: c6c34f61-1c3e-40fb-8a58-d017d88286d8
9393
description: |
94-
This test emulates MAZE ransomware's ability to enumerate directories using Powershell.
95-
Upon successful execution, this test will output the directory enumeration results to a specified file, as well as display them in the active window.
94+
This test emulates MAZE ransomware's ability to enumerate directories using Powershell.
95+
Upon successful execution, this test will output the directory enumeration results to a specified file, as well as display them in the active window.
9696
See https://www.mandiant.com/resources/tactics-techniques-procedures-associated-with-maze-ransomware-incidents
9797
supported_platforms:
9898
- windows
@@ -108,7 +108,7 @@ atomic_tests:
108108
Get-ChildItem -Path $env:programfiles -erroraction silentlycontinue | Out-File -append #{File_to_output}
109109
Get-ChildItem -Path "${env:ProgramFiles(x86)}" -erroraction silentlycontinue | Out-File -append #{File_to_output}
110110
$UsersFolder = "$env:homedrive\Users\"
111-
foreach ($directory in Get-ChildItem -Path $UsersFolder -ErrorAction SilentlyContinue)
111+
foreach ($directory in Get-ChildItem -Path $UsersFolder -ErrorAction SilentlyContinue)
112112
{
113113
foreach ($secondarydirectory in $folderarray)
114114
{Get-ChildItem -Path "$UsersFolder/$directory/$secondarydirectory" -ErrorAction SilentlyContinue | Out-File -append #{File_to_output}}
@@ -176,7 +176,7 @@ atomic_tests:
176176
cli_script:
177177
description: Path to script with file discovery commands
178178
type: path
179-
default: PathToAtomicsFolder\T1083\src\esxi_file_discovery.txt
179+
default: PathToAtomicsFolder\T1083\src\esxi_file_discovery.txt
180180
dependency_executor_name: powershell
181181
dependencies:
182182
- description: |
@@ -201,4 +201,71 @@ atomic_tests:
201201
executor:
202202
command: |
203203
findmnt -t nfs
204-
name: sh
204+
name: sh
205+
- name: Recursive Enumerate Files And Directories By Powershell
206+
description: |
207+
Adversary attempting to discover and collect sensitive documents and archives
208+
from a user’s system. The test recursively enumerates common user folders
209+
(Documents, Downloads, Desktop, OneDrive) for file types of interest such as .pdf, .doc,
210+
.docx, .xls, .xlsx, .txt, .zip, .rar, and .7z.
211+
This behavior is similar to malware like LOSTKEYS used by COLDRIVER in January 2025,
212+
where attackers perform targeted file discovery to support strategic intelligence collection https://www.zscaler.com/blogs/security-research/coldriver-updates-arsenal-baitswitch-and-simplefix.
213+
supported_platforms:
214+
- windows
215+
input_arguments:
216+
output_file:
217+
description: File to output results.
218+
type: string
219+
default: '$env:TEMP\T1083-Enumerate-net.txt'
220+
executor:
221+
name: powershell
222+
command: |
223+
$out = "#{output_file}"
224+
$dirsFilter = @('Documents','Downloads','Desktop','OneDrive')
225+
$exts = @('.pdf','.doc','.docx','.xls','.xlsx','.txt','.zip','.rar','.7z')
226+
$userProfile = [Environment]::GetFolderPath('UserProfile')
227+
$tr = [System.Collections.Generic.List[string]]::new()
228+
229+
function MatchesExtension($path) {
230+
try {
231+
$e = [System.IO.Path]::GetExtension($path).ToLower()
232+
return $exts -contains $e
233+
} catch { return $false }
234+
}
235+
236+
function Scan-Dir($root) {
237+
try {
238+
$match = $false
239+
foreach ($f in $dirsFilter) { if ($root -like "*$f*") { $match = $true; break } }
240+
if (-not $match) { return }
241+
242+
[System.IO.Directory]::EnumerateFiles($root) | ForEach-Object {
243+
if (MatchesExtension $_) {
244+
$fi = [System.IO.FileInfo]::new($_)
245+
$tr.Add("[File] $_ Size:$($fi.Length) LastWrite:$($fi.LastWriteTime)")
246+
}
247+
}
248+
249+
[System.IO.Directory]::EnumerateDirectories($root) | ForEach-Object {
250+
Scan-Dir $_
251+
}
252+
} catch [System.UnauthorizedAccessException] {
253+
$tr.Add("[AccessDenied] $root")
254+
} catch {
255+
$tr.Add("[Error] $root => $($_.Exception.Message)")
256+
}
257+
}
258+
259+
[System.IO.Directory]::EnumerateDirectories($userProfile) | ForEach-Object { Scan-Dir $_ }
260+
261+
# Ensure output dir exists
262+
$outDir = [System.IO.Path]::GetDirectoryName($out)
263+
if (-not [string]::IsNullOrEmpty($outDir) -and -not (Test-Path $outDir)) {
264+
New-Item -Path $outDir -ItemType Directory -Force | Out-Null
265+
}
266+
267+
# Write results
268+
$tr | Out-File -FilePath $out -Encoding UTF8
269+
Write-Output "Enumeration complete. Results written to: $out"
270+
cleanup_command: |
271+
Remove-Item -Path "#{output_file}" -ErrorAction SilentlyContinue

0 commit comments

Comments
 (0)