Dissect(Forensic Framework)のインストールと使用方法

フォレンジック
この記事は約30分で読めます。

つい先日、新しいデジタルフォレンジック系ツールとしてDissectというものが発表された。

簡単に使って見たのでインストール方法の備忘録&感想をメモメモ。

Dissectとはなにか

Fox-ITから公開されたオープンソースのデジタルフォレンジックツールで、インシデントレスポンスフレームワーク。

一つのツールで情報の収集から解析の実施までを行えるというもので、統合型のフォレンジックツールのようなもの。

https://www.fox-it.com/nl-en/dissect/

なによりすごいのは、Githubで公開されているってところ。

GitHub - fox-it/dissect.evidence: A Dissect module implementing a parsers for various forensic evidence file containers, currently: AD1, ASDF and EWF.
A Dissect module implementing a parsers for various forensic evidence file containers, currently: AD1, ASDF and EWF. - GitHub - fox-it/dissect.evidence: A Disse...

稼働要件

とりあえずPython3.9があれば動く。

他に要件は書いていない。

Dissectの機能

Dissectはデータ抽出の機能や、ディスクイメージに対するファイルアクセスの機能など複数機能がある。(参照

ToolDescription
acquireForensic artefact collection tool.
target-queryExport artefacts (plugin outputs) from targets to stdout or a record file.
target-shellInteract with targets using a virtual shell.
target-fsInteract with a single target’s filesystem via the command line.
target-regInteract with the registry of a Windows based target.
target-dumpExport artefacts in bulk to record files.
target-ddExport raw bytes from a target to stdout or a file.
target-mountMount a target using FUSE.
rdumpDump, transform, and manipulate records from stdin or a file.

インストール方法

今回はLinuxMint(好み)にインストールした。
まじでpipするだけでインストールできるので、どれでもいいと思う。

まずはpip自体のアップグレード。

$sudo pip install --upgrade pip

つぎに、python3.9のインストール。
私の手元のLinuxMintにはデフォルトでpython3.8が入っていたので、とりあえずインストール。

そのままだとgccあたりのエラーを吐き出すことがあるので、devキットも必要。

$sudo apt install python3.9
$sudo apt install python3.9-dev

続けて、pipでDissectのインストール。

$python3.9 -m pip install dissect

以上でインストール終了。

公式マニュアルによると、Dockerコンテナ版も配布されているとのことだが、実際にDockerにいれてもDissectが動かなかった…なぜ?

Build software better, together
GitHub is where people build software. More than 94 million people use GitHub to discover, fork, and contribute to over 330 million projects.

解析の実施

前述のようにいくつもの機能があるが、やっぱり気になるのはアーティファクトのパース。
ということで今回は解析を行ってみる。
別のPC(Windows10Home)のE01ディスクイメージがあったので、それを読み込んでみる。
diskimageというフォルダに、E01の分割ディスクイメージがいくらか入っているという想定で進める。

target-queryのオプション

今回はtarget-queryを使ってみる。
これは、Dissectの機能の一つでアーティファクトのパースを行うためのもの。

簡単にオプション一覧を出してみよう。

$target-query

オプションは説明不足甚だしいので、公式ドキュメントを参照してみる。
必須は-fでこれはfunction=解析プラグインを指定するもの。
Volatility Frameworkでいうところのpslistみたいな感じ。

あとはとりあえずいらん。

target-query optional arguments
  • -f FUNCTION--function FUNCTION – function to execute (default: None)
  • --child CHILD – load a specific child path or index (default: None)
  • --children – include children
  • -l--list – list available plugins and loaders
  • -s--strings – print output as string
  • -d ','--delimiter ',' (default: )
  • -j--json – output records as json
  • --limit LIMIT – limit number of produced records (default: None)
  • --no-cache--ignore-cache – do not use file based caching
  • --only-read-cache – only read cache files, never write them (has no effect if –no-cache is specified
  • --rewrite-cache – force cache files to be rewritten (has no effect if either –no-cache or –only-read-cache are specified)
  • --cmdb
  • --hash – hash all uri paths in records
  • --report-dir REPORT_DIR – write the query report file to the given directory (default: None)
  • -K KEYCHAIN_FILE--keychain-file KEYCHAIN_FILE – keychain file in CSV format (default: None)
  • -Kv KEYCHAIN_VALUE--keychain-value KEYCHAIN_VALUE – passphrase, recovery key or key file path value (default: None)
  • -v--verbose – increase output verbosity (default: 0)
  • -q--quiet – do not output logging information
  • --plugin-path PLUGIN_PATH – a file or directory containing plugins and extensions (default: None)
https://docs.dissect.tools/en/latest/tools/target-query.html

有効化されたプラグインの確認

$target-query -l

-lオプションを使えば一覧表示可能。
ここで表示されるプラグインを-fオプションで指定して解析を行うことになる。

OS基本情報の解析

$target-query diskimage/ -f hostname,os,domain,version

シンプルに抽出可能

Activitiescacheの解析

Activitiescacheとは、Windows固有のタイムラインデータベースのこと。アプリの起動やファイル操作のログが残っていて、調査で重宝する。

$target-query diskimage/ -f activitiescache

ワンポイントだが、このままパイプをつないでgrepをしても、文字化けしてうまいことできないので、-sオプションが必須になる。(これは標準出力をテキストに出力するにしてもそう)

Usnjrnlの解析

UsnjrnlはWindows用HDDのファイルシステムNTFSに備わる機能の一つで、ファイルシステムアクセスのジャーナルのこと。
$jとか$secureとかフォレンジック界隈でよく見かけることだろう。

$target-query diskimage/ -f usnjrnl

自動起動の解析

常駐化されたマルウェアがあるかどうかは調査の時に最も気になるところの一つ。
Dissectの初期プラグインである程度調べられる。

$target-query diskimage/ -f runkeys

まだまだたくさんあるが今回はこの程度で。

ちょっと触ってみての感想

ちょっと触った段階での感想。
(後で変わる可能性あり)

Dissectの特徴として、イメージデータの形式が何であろうと解析できるというものがある。
RawやE01、vmdkやvhdx。KAPEでトリアージしたエビデンスファイルも解析可能。

これは結構すごいと思っていて、こういったエビデンスまるごとなんでもコマンドで一撃解析しますっていうのは、調査のスケーラビリティや手順の汎用性の面ですごい効果があるんだと思う。

ただ、反面インターフェースはわかりづらく、インストールも一癖あって使い勝手はよくない。

また、検査結果のデータの出力も柔軟ではなく、これで実際にインシデント調査をできるかというとまだまだ難しそう。出力されたデータの横断的な分析方法がいまいちわからないからだ。(これはドキュメントの読み込み不足もあるだろうが、自力で開発を行えという意味なのかもしれない)

さらに、パース結果内容においても不足を感じた。
例えば、自動起動調査用プラグインのrunkeysでは、レジストリはちゃんと見ていても、WMIやスタートアップまでは見ていないだろう。
他にもPrefetchのパースもその他の個別解析ツールのようにきれいにパースされているわけではない。

人間の感覚を使った分析を行うには、やはりまだ既存のツールのほうが優れているように感じた。

まとめ

新しいフォレンジック用フレームワークが登場したのでちょっと触ってみた。
簡単にインストールできるので試してみるのもオススメ。

他の機能もいろいろ使っていこうと思う。また備忘録にするかも。

おまけ

2023年1月時点、target-queryにデフォルトで入っているプラグイン一覧。(-lオプションの出力結果)

Available plugins:
apps:
remoteaccess:
anydesk:
anydesk.remoteaccess – Return the content of the AnyDesk logs. (output: records)
remoteaccess:
remoteaccess.remoteaccess – Return Remote Access records from all Remote Access Tools. (output: records)
teamviewer:
teamviewer.remoteaccess – Return the content of the TeamViewer logs. (output: records)
browsers:
browser:
browser.history – Return browser history records from all browsers installed. (output: records)
chrome:
chrome.history – Return browser history records from Chrome. (output: records)
edge:
edge.history – Return browser history records from Edge. (output: records)
firefox:
firefox.history – Return browser history records from Firefox. (output: records)
iexplore:
iexplore.history – Return browser history records from Internet Explorer. (output: records)
filesystem:
acquire_hash:
acquire_hashes – Return file hashes collected by Acquire. (output: records)
icat:
icat – Output the contents of a file based on its MFT segment or inode number. Supports Alternate Data Streams (output: no output)
ntfs:
mft:
mft – Return the MFT records of all NTFS filesystems. (output: records)
mft_timeline:
mft_timeline – Return the MFT records of all NTFS filesystems in a human readable format (unsorted). (output: lines)
usnjrnl:
usnjrnl – Return the UsnJrnl entries of all NTFS filesystems. (output: records)
unix:
capability:
capability_binaries – Find all files that have capabilities set. (output: records)
suid:
suid_binaries – Return all SUID binaries. (output: records)
walkfs:
walkfs – Walk a target’s filesystem and return all filesystem entries. (output: records)
yara:
yara – Scan files up to a given maximum size with a local YARA rule file. (output: records)
general:
example:
example – Example plugin function. (output: text)
example_none – Example plugin with no return value. (output: no output)
example_record – Example plugin that generates records. (output: records)
example_user_registry_record – Example plugin that generates records with registry key and user information. (output: records)
example_yield – Example plugin that yields text lines. (output: lines)
loaders:
loaders – List the available loaders. (output: no output)
plugins:
plugins – No documentation (output: no output)
users:
get_all_records – Return the records of all exported methods. (output: records)
os:
unix:
bashhistory:
bashhistory – Return bash history for all users. (output: records)
cronjobs:
cronjobs – Return all cronjobs. (output: records)
generic:
activity – Return last seen activity based on filesystem timestamps. (output: text)
linux:
debian:
dpkg:
dpkg.log – Yield records for actions logged in dpkg’s logs (output: records)
dpkg.status – Yield records for packages in dpkg’s status database (output: records)
log:
audit:
audit – Return information stored in /var/log/audit. (output: records)
btmp:
btmp – Return failed login attempts stored in the btmp file. (output: records)
lastlog:
lastlog – Return last logins information from /var/log/lastlog. (output: records)
messages:
messages – Return contents of /var/log/messages. (output: records)
wtmp:
wtmp – Return the content of the wtmp log files. (output: records)
services:
services – Return information about all installed services. (output: records)
ssh:
ssh.authorized_keys – Yields the content of the authorized_keys files on a Unix target per user. (output: records)
ssh.known_hosts – Yields the content of the known_hosts files on a Unix target per user. (output: records)
ssh.private_keys – No documentation (output: records)
windows:
activitiescache:
activitiescache – Return ActivitiesCache.db database content. (output: records)
adpolicy:
adpolicy – Return all AD policies. (output: records)
amcache:
amcache.application_files – Return InventoryApplicationFile records from Amcache hive. (output: records)
amcache.applications – Return InventoryApplication records from Amcache hive. (output: records)
amcache.device_containers – Return InventoryDeviceContainer records from Amcache hive. (output: records)
amcache.drivers – Return InventoryDriverBinary records from Amcache hive. (output: records)
amcache.shortcuts – Return InventoryApplicationShortcut records from Amcache hive. (output: records)
files – Return File records from Amcache hive. (output: records)
programs – Return Programs records from Amcache hive. (output: records)
catroot:
catroot – Return the content of the catalog files in the CatRoot folder. (output: records)
cim:
cim.consumerbindings – Return all __FilterToConsumerBinding queries. (output: records)
clfs:
clfs – Parse the containers associated with a valid BLF file. (output: records)
defender:
defender.evtx – Parse Microsoft Defender evtx log files (output: records)
env:
environment_variables – Return all environment variables on a Windows system. (output: records)
path_extensions – Return all found path extensions. (output: records)
exchange:
exchange:
exchange.transport_agents – Return the content of the config file for Transport Agents for Microsoft Exchange. (output: text)
generic:
activity – Return last seen activity based on filesystem timestamps. (output: text)
alternateshell – Return the AlternateShell registry key value. (output: records)
appinit – Return all available Application Initial (AppInit) DLLs registry key values. (output: records)
bootshell – Return the BootShell registry key entry. (output: records)
commandprocautorun – Return all available Command Processor (cmd.exe) AutoRun registry key values. (output: records)
domain – Return the domain name. (output: text)
filerenameop – Return all pending file rename operations. (output: records)
knowndlls – Return all available KnownDLLs registry key values. (output: records)
ndis – Return network registry key entries. (output: records)
ntversion – Return the Windows NT version. (output: text)
nullsessionpipes – Return the NullSessionPipes registry key value. (output: records)
pathenvironment – Return the content of the Windows PATH environment variable. (output: lines)
sessionmanager – Return interesting Session Manager (Smss.exe) registry key entries. (output: records)
winrar – Return all available WinRAR history registry key values. (output: records)
winsocknamespaceprovider – Return available protocols stored in the Winsock catalog database. (output: records)
iis:
iis.logs – Return contents of IIS (v7 and above) log files. (output: records)
lnk:
lnk – Parse all .lnk files in /ProgramData, /Users, and /Windows or from a specified path in record format. (output: records)
log:
amcache:
amcache_install – Return the contents of the Amcache install log. (output: records)
etl:
etl.boot – Return the contents of the ETL files created at last boot. (output: records)
etl.etl – Return the contents of the ETL files generated at last boot and last shutdown. (output: records)
etl.shutdown – Return the contents of the ETL files created at last shutdown. (output: records)
evt:
evt – Parse Windows Eventlog files (.evt). (output: records) scraped_evt – Yields EVT log file records scraped from target disks (output: records) evtx: evtx – Return entries from Windows Event log files (.evtx). (output: records)
scraped_evtx – Return EVTX log file records scraped from target disks (output: records)
pfro:
pfro – Return the content of sysvol/Windows/PFRO.log (output: records)
notifications:
notifications.wpndatabase – Returns Windows Notifications from wpndatabase.db (post Windows 10 Anniversary). (output: records)
powershell:
powershell_history – Return PowerShell command history for all users. (output: records)
prefetch:
prefetch – Return the content of all prefetch files. (output: records)
recyclebin:
recyclebin – Return files located in the recycle bin ($Recycle.Bin). (output: records)
regf:
7zip:
sevenzip – Return 7-Zip history information from the registry. (output: records)
auditpol:
auditpol – Return audit policy settings from the registry. (output: records)
bam:
bam – Parse bam and dam registry keys. (output: records)
cit:
cit.cit – Return CIT data from the registry for executed executable information. (output: records)
cit.dp – Parse CIT DP data from the registry. (output: records)
cit.modules – Parse CIT tracked module information from the registry. (output: records)
cit.puu – Parse CIT PUU (Post Update Usage) data from the registry. (output: records)
cit.telemetry – Parse CIT process telemetry answers from the registry. (output: records)
clsid:
clsid.machine – Return only the machine CLSID registry keys. (output: records)
clsid.user – Return only the user CLSID registry keys. (output: records)
firewall:
firewall – Return firewall rules saved in the registry. (output: records)
mru:
mru.acmru – Return the ACMru (Windows Search) data. (output: records)
mru.lastvisited – Return the LastVisitedMRU data. (output: records)
mru.msoffice – Return MS Office MRU keys. (output: records)
mru.mstsc – Return Terminal Server Client MRU data. (output: records)
mru.networkdrive – Return MRU of mapped network drives. (output: records)
mru.opensave – Return the OpenSaveMRU data. (output: records)
mru.recentdocs – Return the RecentDocs data. (output: records)
mru.run – Return the RunMRU data. (output: records)
muicache:
muicache – Iterate various MUIcache key locations. (output: records)
nethist:
network_history – Return attached network history. (output: records)
recentfilecache:
recentfilecache – Parse RecentFileCache.bcf. (output: records)
regf:
regf – Return all registry keys and values. (output: records)
runkeys:
runkeys – Iterate various run key locations. See source for all locations. (output: records)
shellbags:
shellbags – Return Windows Shellbags. (output: records)
shimcache:
shimcache – Return the shimcache. (output: records)
trusteddocs:
trusteddocs – Return Microsoft Office TrustRecords registry keys for all Office applications. (output: records)
usb:
usb – Return information about attached USB devices. (output: records)
userassist:
userassist – Return the UserAssist information for each user. (output: records)
sam:
sam – Return the content of SAM hive registry keys. (output: records)
services:
services – Return information about all installed services. (output: records)
sru:
sru.application – Return the contents of Application Resource Usage table from the SRUDB.dat file. (output: records)
sru.application_timeline – Return the contents of App Timeline Provider table from the SRUDB.dat file. (output: records)
sru.energy_estimator – Return the contents of Energy Estimator table from the SRUDB.dat file. (output: records)
sru.energy_usage – Return the contents of Energy Usage Provider table from the SRUDB.dat file. (output: records)
sru.energy_usage_lt – Return the contents of Energy Usage Provider Long Term table from the SRUDB.dat file. (output: records)
sru.network_connectivity – Return the contents of Windows Network Connectivity Usage Monitor table from the SRUDB.dat file. (output: records)
sru.network_data – Return the contents of Windows Network Data Usage Monitor table from the SRUDB.dat file. (output: records)
sru.push_notification – Return the contents of Windows Push Notification Data table from the SRUDB.dat file. (output: records)
sru.sdp_cpu_provider – Return the contents of SDP CPU Provider table from the SRUDB.dat file. (output: records)
sru.sdp_network_provider – Return the contents of SDP Network Provider table from the SRUDB.dat file. (output: records)
sru.sdp_physical_disk_provider – Return the contents of SDP Physical Disk Provider table from the SRUDB.dat file. (output: records)
sru.sdp_volume_provider – Return the contents of SDP Volume Provider table from the SRUDB.dat file. (output: records)
sru.vfu – Return the contents of vfuprov table from the SRUDB.dat file. (output: records)
startupinfo:
startupinfo – Return the contents of StartupInfo files. (output: records)
syscache:
syscache – Parse the objects in the ObjectTable from the Syscache.hve file. (output: records)
tasks:
tasks – Return all scheduled tasks on a Widows system. (output: records)
thumbcache:
thumbcache.iconcache – No documentation (output: records)
thumbcache.thumbcache – No documentation (output: records)
ual:
ual.client_access – Return client access data within the User Access Logs. (output: records)
ual.domains_seen – Return DNS data within the User Access Logs. (output: records)
ual.role_access – Return role access data within the User Access Logs. (output: records)
ual.system_identities – Return system identity data within the User Access Logs. (output: records)
ual.virtual_machines – Return virtual machine data within the User Access Logs. (output: records)
wer:
wer – Return information from Windows Error Reporting (WER) files. (output: records)

Failed to load:
None
Available loaders:
AsdfLoader
DirLoader
EwfLoader
ITunesLoader
KapeLoader
LocalLoader
OvfLoader
PhobosLoader
RemoteLoader
TaniumLoader
TarLoader
TargetLoader
VBLoader
VBoxLoader
VmaLoader
VmcxLoader
VmxLoader
XvaLoader

コメント

タイトルとURLをコピーしました