@port139 Blog

基本的にはデジタル・フォレンジックの技術について取り扱っていますが、記載内容には高確率で誤りが含まれる可能性があります。

Turla の自動起動手口

下記レポート『New Pacifier APT Components Point to Russian-Linked Turla Group』では、マルウェアを起動する為の自動起動の手口として 6 種類が報告されている。

幾つかは Windows XP を対象とした古い手法のようだが、自動起動を確認するツールとして、Autoruns がどのように反応するか、いくつかサンプルを作成し確認してみる。

https://media.scmagazine.com/documents/314/bitdefender-whitepaper-pacifie_78483.pdf

ShellAutorun: adds the malware’s path to the “HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell” key in the registry, so that the malware is executed at logon. It takes care to add “explorer.exe” as well, if the key did not exist prior to infection.
HiddenTaskAutorun: creates a hidden scheduled task that triggers at logon, using the ITaskScheduler COM interface. This method is only
used on Windows XP.
ScreenSaverAutorun: replaces the current screensaver from the registry with the malware
StartupAutorun: copies the malware to the startup folder
TaskScheduler20Autorun: creates a scheduled task that triggers at logon using the ITaskService COM interface. This method is only used
on Windows Vista, 7 or 8.
LinkAutorun: infects .lnk files by changing their target application to: “cmd.exe /q /c start “OriginalPathOfLnk” && start “MalwarePath””

 

This analyzed sample uses the ShellAutorun feature with path “%HOMEPATH%\ntuser.dat.LOG3”, and the TaskScheduler20Autorun
configured to disguise itself as an Adobe Updater task with path: “%homepath%\AppData\Local\Adobe\AdobeUpdater.exe”, name: “User
registry integrity check task”, and description “This task was automatically generated by Microsoft Windows. To remove contact your
system administrator”.

ShellAutorun

自動起動の方法としてレジストリキー 「HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon」を利用する方法、ESET から出ているレポートでは登録方法として下記の記述を確認できる。

https://www.welivesecurity.com/wp-content/uploads/2017/08/eset-gazer.pdf

0: ShellAutorun
Persistence is achieved through the Windows registry by setting the value “Shell” with “explorer.exe, %malware_pathfile%” under the following key:
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon

Shell 値としてカンマで区切って登録している部分を、Autoruns がどのように扱うか?という部分があるので、メモ帳を登録し Autoruns の実行結果を確認。

カンマで区切られた内容を 2行で表示しており、どちらも Image Path の対象として確認できている。

f:id:hideakii:20170902204948p:plain

ScreenSaverAutorun

既存のスクリーンセイバーのパスをマルウェアに変更するのであれば、Autorunsであれば Winlogon タブから値を確認できる。(下記は正規のスクリーンセイバー)

f:id:hideakii:20170902205832p:plain

StartupAutorun

マルウェア自体をスタートアップへ配置するのか、LNK ファイルを配置しマルウェアを参照させるのか特定できなかったが、これは普通にチェックが可能と思われる。

TaskScheduler20Autorun

上記引用部分にあるように、タスクとして \AppData\Local\Adobe\AdobeUpdater.exe のようなプログラムを登録する。

ESETのレポート「Gazing at Gazer Turla’s new second stage backdoor」では下記の記述となっている。

https://www.welivesecurity.com/wp-content/uploads/2017/08/eset-gazer.pdf

4: TaskSchedulerAutorun4: TaskSchedulerAutorunThis method is used to achieve persistence by creating a scheduled task.The task is created and set up through COM interfaces related to tasks (ITaskService, ITaskSettings, …).Some information such as the task name and its description is retrieved from the resource.For example, in one of the sample’s resources, the persistency mode is set to 04 (TaskSchedulerAutorun) with the persistency data: %APPDATA%\Adobe\adobeup.exe Adobe Acrobat Reader Updater. This task was generated by Adobe Systems, Inc to keep your Adobe Software up-to-data. \Adobe\AcrobatReader.AdobeIn this example, a scheduled task will be created and set up thus:• Task name: “Adobe Acrobat Reader Updater”• Executable: “%APPDATA%\Adobe\adobeup.exe”• The orchestrator will copy the loader received through the named pipe to this location• Task description: “This task was generated by Adobe Systems, Inc to keep your Adobe Software up-to-data”• Task folder: “\Adobe\AcrobatReader.Adobe”Last but not least, the task is configured to be started by the task scheduler at any time afterits scheduled time has passed. The task will be triggered when the current user logs on.

タスクに登録されているプログラムがコード署名されているかは確認できていない。

LinkAutorun

既存のLNKファイルを変更する仕組みになっている。

“cmd.exe /q /c start “OriginalPathOfLnk” && start “MalwarePath””

ターゲットフォルダがどのように決まるかは確認できなかったが、仮にスタートアップに存在する LNK ファイルが変更されている場合は注意が必要になる。自動起動に LNK が登録されていない場合は、LNK ファイル内が変更されている事を Autoruns で確認する事は出来ない。

下記は「cmd.exe /q /c start C:\Windows\notepad.exe && start C:\Windows\system32\Calc.exe」をテストとして登録した LNK ファイルを、スタートアップに配置した場合の Autoruns の結果。CMD.EXE が登録されている事は確認できる。

f:id:hideakii:20170902211911p:plain

コマンドライン版の実行結果でも、CMD.EXE は確認できるがその先のパラメータまでは取得できない。

11/20/2010 2:00 AM,"C:\Users\IEUser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup","notepad - Shortcut.lnk",enabled,"Logon",IE11WIN7\IEUser,"Win
dows Command Processor","Microsoft Corporation","c:\windows\system32\cmd.exe",6.1.7601.17514,"C:\Users\IEUser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\notepad - Shortcut.lnk",AD7B9C14083B52BC532FBA5948342B98,EE8CBF12D87C4D388F09B4F69BED2E91682920B5,A942EA4413B0921C7A513B800A953A5325313F07,CFC5937B4DB3A1D5718FE144B621D50B0A337854AB3F5E2DF152B62627F6FD4A,17F746D82695FA9B35493B41859D39D786D32B23A9D2E00F4011DEC7A02402AE,CEEFB55F764020CC5C5F8F23349AB163 

Windows の監査設定において、イベントID 4688 の取得と、コマンドラインオプションを含めて取得している場合には、下記のようなログを確認できる。

f:id:hideakii:20170902213417p:plain

LNK ファイルから呼ばれていることも追跡できるのか?という辺りは十分確認できていない。

 

www.virustotal.com