見習いフォレンジッカーのメモ

デジタルフォレンジックに関することを書いていこうと思います。誤りを含む可能性も高いので、信じるか信じないかはあなた次第です。。

macOS上に現存するappの痕跡?-appList.datについて- [Trace of app path on macOS -About appList.dat-]

※This is a very simple first report, there is the possibility of including mistakes.
 We need further verification.

ご存知の方もいらっしゃるかもしれませんが、今回も調査に役立つかもしれないアーティファクトを見つけたので、今わかっていること(こうだと思っていること)や私がこれを見つけた経緯、ちょっとした検証や考察などについて書きます。

Some of you may know, I found an artifact that might be useful for investigation.
So I wrote about what I know now (what I am thinking), how I found this, some verifications, and considerations.

 

【解析対象ファイルの場所】[Location of files to be analyzed]
/Users/$USER/Library/Application Support/com.apple.spotlight/appList.dat

 

【わかること】[What we can know]
現存するappのパス。

The app path. 

 

【意義】[How it can be useful for investigation]
このアーティファクトは、アプリインストールに関わる既存のアーティファクトとして知られる"/Library/Receipts/InstallHistory.plist"と比較すると、より多くの.appの情報を保持している可能性があります。
InstallHistory.plistは、インストーラで「インストールを行ったapp」の情報を保持している様ですが(ただし、何らかの条件によりインストーラでインストールしてもここに残らない場合もあるように思えます)、appList.datでは単純に「appのパス」を記録している様に見えます。
その為、Visual Stadio Codeの様なappをApplicationsディレクトリに配置するだけのタイプのアプリだとInstallHistory.plistには記録が残されていないのですが、appList.datには残されているというパターンもありそうです。
ただし、残念ながら手元の検証では、appを削除した場合このアーティファクトの該当レコードも削除される為、app削除による証拠隠滅の影響を受けるかもしれません。

This artifact may hold more .app information than "/Library/Receipts/InstallHistory.plist", known as an existing artifact related to app install.
InstallHistory.plist seems to hold the information of the app that "installed" via installer(However, it seems that it may not remain here even if installed via installer due to some other condition), but appList.dat seems to record "app path".
Therefore, if it is a type of app that simply places an app such as "Visual Stadio Code" in the Applications directory, it is not left in InstallHistory.plist, but there is also a pattern that it is left in appList.dat.
However, unfortunately, in the verification at hand, if the app is deleted, the corresponding record of this artifact is also deleted, so it may be affected by the destruction of the evidence by deleting the app.

 

【見つけた経緯・検証】[Background and verification found]
JSACのCFP応募に向けて作成中だったMac Forenscisのツールの作成課程において、appList.datという名前的にアプリケーションリストではないかと思われる、ファイルがあったので、中身を見てみることにしました。
まずはじめに、fileコマンドでファイルの形式を確認します。その結果、このファイルはApple binary property listであることがわかりました。

In the process of creating a Mac Forenscis tool that was being created for JSAC's CFP, there was a file named appList.dat, which seems to be an application list, so I decided to take a look inside .
First, check the file format with the file command. As a result, this file was found to be an Apple binary property list.

f:id:kasasagi_f:20190916165810p:plain

 Apple binary property listはいわゆるplist(Mac OSの設定ファイルの様なもので、Windowsでいうレジストリのキーがバラバラになって散っているイメージ)のバイナリ形式のもので、「plutil -p "file"」で中身を表示することができます。このコマンドで中身を見てみます。

Apple binary property list is a binary format of plist (like a Mac OS configuration file, an image in which Windows registry keys are  scattered),
"plutil -p file“ The contents can be displayed with. Let's look at the contents with this command.

f:id:kasasagi_f:20190916173637p:plain

f:id:kasasagi_f:20190916173922p:plain

この形式は、見たところデータ冒頭(上の画像)の赤枠内にある通り「NSKeyedArchiver format」と呼ばれる形式ではないかと考えられます。詳細なデータの辿り方は、既にまとめられているサイトがあるのでこちらをご参照ください。(今回のものは少し参考サイトと雰囲気が違うようですが)
https://www.mac4n6.com/blog/tag/ccl_bplist.py  

This format seems to be a format called “NSKeyedArchiver format” as shown in the red frame at the beginning of the data (top image).
For details on how to follow the data, please refer to the site.(This time is a little different from the reference site)

上記の画像内のデータの見方を簡単に説明すると(多分こうだというものですが)、
「"displayName" => <CFKeyedArchiverUID 0x7fd9e9f08d60 [0x7fff9a11f8e0]>{value = 3}」とあるので、その下にある3をみると「3 => "iTerm.app"」とあり、「"displayName" = "iTerm.app"」となり、iTermというappの情報が記載されていることがわかります。
同じように「"URL" => <CFKeyedArchiverUID 0x7fd9e9f08d40 [0x7fff9a11f8e0]>{value = 5}」を辿っていくと、「"NS.relative" => <CFKeyedArchiverUID 0x7fc2fbf04100 [0x7fff9a11f8e0]>{value = 6}」から「 6 => "file:///Applications/iTerm.app/"」という箇所にたどり着き、"iTerm.app"は「"file:///Applications/iTerm.app/"」にあることを示すように見えます(実際には複数のappの情報が格納されているので、ちゃんと全てのデータを紐づけようとするともう少し複雑ですが)。

Briefly explaining the data in the above image.(Maybe like this)
You can see ["DisplayName"=> <CFKeyedArchiverUID 0x7fd9e9f08d60 [0x7fff9a11f8e0]> {value = 3}]".
So if you look at "3" below it, you can see [3 =>"iTerm.app"] .
It means ["displayName"= "iTerm.app"] .
So you can see that the app information is called iTerm.
In the same way, if you follow ["URL"=> <CFKeyedArchiverUID 0x7fd9e9f08d40 [0x7fff9a11f8e0]> {value = 5}, go to "NS.relative" => <CFKeyedArchiverUID 0x7fc2fbf04100 [0x7fff9a11f8e0]>{value = 6}, finaly you will reach [6 => "file: ///Applications/iTerm.app/]. 
"ITerm.app" appears to indicate that it was in "file: ///Applications/iTerm.app/".
(In fact, since multiple app information is stored, trying to link all the data properly is a bit more complicated)

「plutil -p "/Users/$USER/Library/Application Support/com.apple.spotlight/appList.dat" | grep -i file」というようにすれば、appのパスの一覧を取得できます。

"Plutil -p "/ Users / $ USER / Library / Application Support / com.apple.spotlight / appList.dat "| grep -i file" can be used to get a list of app paths.

f:id:kasasagi_f:20190916201529p:plain

ここから、上記仮説の妥当性やその他の挙動を検証していきます。
手順は下記の通りです。

・検証1(存在していなかったapp作成によるappList.datの変化を検証)
1.現在のappList.datのデータ出力を退避する
2.現在MacbookProに存在していないappであるBlockBlock(https://objective-see.com/products.html)のインストーラをDownloadし、unzipする
3.appList.datのデータ出力を1と比較する

・検証2(既にappList.datに追加されているappを別の場所にコピーした際のappList.datの変化及び、記録されているappを削除した際の挙動を検証)
1.現在のappList.datのデータ出力を退避する
2.既にappList.datにも記録があるKnockKnock.appをユーザのApplications(日本語だと「アプリケーション」)からDesktopにコピーし、Applications内のKnockKnock.appを削除する。
3.appList.datのデータ出力を1と比較する

From here, I will examine the validity of the above hypothesis and other behaviors.
The procedure is as follows.

・ Verification 1 (Verify appList.dat changes due to app creation that did not exist)
1. Save the current appList.dat data output.
2. Download the installer of BlockBlock (https://objective-see.com/products.html), an app that does not exist, and unzip it in the directory.
3.Compare the data output of appList.dat with 1. 

・ Verification 2 (Verify changes in appList.dat when copying an app that has already been added to appList.dat to another location, and verify the behavior when deleting the recorded app)
1. Save the current appList.dat data output.
2. Copy KnockKnock.app that is already recorded in appList.dat from Applications to the Desktop, and delete KnockKnock.app in Applications.
3.Compare the data output of appList.dat with 1.

 

検証1 [Verification 1]

検証用MacbookPro内に無いappであるBlockBlock(https://objective-see.com/products.html)のインストーラ(BlockBlock_0.9.9.4.zip)をダウンロードしてきます。
Downloadしてきてzipを解凍する前のappList.datの中には、blockを含むものはありません。

Download and unzip BlockBlock (https://objective-see.com/products.html) installer (BlockBlock_0.9.9.4.zip) which is an app that is not in MacbookPro for verification.
In appList.dat before downloading and unzipping zip, there is nothing that contains block.

f:id:kasasagi_f:20190916185642p:plain

BlockBlock_0.9.9.4.zipをunzipしBlockBlock Installer.appを取り出してから約1分後のappList.datの中には、BlockBlockのapp名やパスが追加されています。

After unzipping "BlockBlock_0.9.9.4.zip" and taking out "BlockBlock Installer.app", app name and path of BlockBlock are added in appList.dat about 1 minute after.

f:id:kasasagi_f:20190916185718p:plain

以上のことから、appのアプリ名やパスがappList.datに追加されていそうだということがわかりました。この他に別のappでも検証を行いましたが、同様の結果が得られました(検証数は多くないのでまだ注意は必要です)。

From the above, it was found that the app name and path of apps seems to have been added to appList.dat.
In additional verification, similar results were obtained (the number of verifications is not large, so attention is still needed).


検証2[Verification 2]
既にApplicationsディレクトリに追加して使用していたKnockKnock.appに関する、appList.dat内の現在のgrep結果を表示します。

Displays the current grep result in appList.dat for KnockKnock.app that was already added to the Applications directory.

f:id:kasasagi_f:20190916194330p:plain

このKnockKnock.appをDesktopにコピーします。
すると、1-2分経ってからDesktopにコピーしたKnockKnock.appに関する記述が新たに追加されました。この時点ではコピー前、コピー後どちらの情報も記録されています。

Copy this KnockKnock.app to your Desktop.
Then, after 1-2 minutes, a description about KnockKnock.app copied to Desktop was newly added to appList.dat. At this point, both pre-copy and post-copy information is recorded.

f:id:kasasagi_f:20190916195440p:plain

次に、ApplicationsディレクトリにあったKnockKnock.appを削除します。
すると、1-2分経ってからApplicationsディレクトリにあったKnockKnock.appの記述が消えました。

Next, remove KnockKnock.app from the Applications directory.
Then, after 1-2 minutes, the description of KnockKnock.app in the Applications directory disappeared.

f:id:kasasagi_f:20190916195856p:plain

以上のことから、appList.datには現存するappファイルのパスが残り、appを削除するとそのappファイルに関連するレコードは消えるという挙動をしているように見受けられました。

From the above, it seems that appList.dat has the path of the existing app file, and when app is deleted, the appList.dat record related to that app file disappears.

 

【その他の検証】[Other verification]
また、別途行った検証では、Visual Stadio Codeのようなインストーラによるインストールをしていないappにおいては、「/Library/Receipts/InstallHistory.plist」には情報が存在しないが、「appList.dat」には存在しているものがあることを確認しています。
更に、上記のBlockBlock Installer.appはインストーラでインストールを実施したのですが、InstallHistory.plistにはなぜか記録されていない様子でした。(従って、InstallHistory.plistの記録有無は単なるインストーラ使用の有無だけではなく、インストーラの形式にもよるのかもしれません)

Also, in the verification that I conducted separately, in the app that is not installed by the installer such as "Visual Stadio Code", although there is no information in “/Library/Receipts/InstallHistory.plist”, “appList.dat” seems to be information inside.
Furthermore, the above "BlockBlock Installer.app" was installed by the installer, but it seemed that it was not recorded for some reason in "InstallHistory.plist". (Therefore, whether or not InstallHistory.plist is recorded may depend not only on whether or not the installer is used, but also on the format of the installer.)

 

【感想など】[Impressions etc.]
各appの実行時間があったり、appが削除されていてもアーティファクトが残ればもっと有用だったのですが、残念です。。。
あと、今回は英語を添えたのですがもう少しまともな英語を書けるようにもなりたいですね。。。

It would be more useful if there was an all execution time and if the artifact remained even if the app was deleted.
I added English this time, but I want to be able to write more decent English.

このブログは1年度に1つは新しい発見をしてブログを書くぞというのが目標だったので、今年度も一応は達成できてよかったです。(とはいえまだ半年あるので時間を作ってもう少し役に立ちそうなものを見つけたいですが)

また、当初の検証ではappList.datには実行痕跡が残っていると思っており、某所のLTでそのように話したのですが、追加の検証から、実行しなくてもappが存在さえしていればパスが残るということがわかり、仮説をたてて検証する際に確証バイアスからどう逃れるか(そうじゃない可能性をどこまで検証できるか)ということの難しさを改めて認識しました。

 

【検証OS】 [Verification OS]
macOS 10.14.6(18G95)
macOS 10.15(19A602)