@port139 Blog

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

C2とWeb Storage

 「New Pacifier APT Components Point to Russian-Linked Turla Group」のレポート内には、Webブラウザのキャッシュを利用するマルウェアの話題が記載されています。 

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

2. Using Browser Cache to Evade Securityより引用

The website the Trojan connects to is perfectly legitimate, but it also contains a JavaScript (placed by the attacker) that uses a legitimate
method of writing in the browser’s local cache. Consequently, the JavaScript will write instructions from the C&C into the local browser
cache of Internet Explorer. Since the script is not malicious per se, this is the novelty of the Trojan that reveals a radically new attack avenue.
On the victim’s side, the backdoor simply checks if something new has been written in the browser’s cache, looking for instructions. The
Trojan doesn’t constantly scan the cache for new instructions, it only does so at various time intervals to avoid triggering security warnings.

マルウェアがC2と通信する手口として、Web Storageを利用する手口が解説されています。
マルウェアはブラウザのスタートアップの設定を変更し、ブラウザが起動するとスタートアップに登録されているサイトへアクセスします。

マルウェアは直接C2と通信するのではなく、Web ブラウザがC2と通信し、Web storageにコマンドが格納されます。
マルウェアはWebブラウザが保存したWeb storageの内容を読み込むことでコマンドを実行するという流れのようです。

Web Storage データの保存場所

Web Storage の仕組みについては、下記URLが参考になります 

https://www.w3.org/TR/2011/WD-webstorage-20110208/ 

W3C - 『Web Storage』日本語訳 - HTML5.JP

Windows 7 上 の IE 11 でテストしてみます。Web Storage のデータは下記フォルダ配下にXML形式のファイルとして保存されます。 

%userprofile%\AppData\LocalLow\Microsoft\Internet Explorer\DOMStore
%userprofile%\AppData\Local\Microsoft\Internet Explorer\DOMStore

レジストリにもパスが登録されているようです。

f:id:hideakii:20170910191509p:plain

テストデータの作成

 Web Storage をテスト出来るサイトは色々とありますが、今回は下記サイトを使わせていただきます。 

demo.agektmr.com

 localStorageに確認用のデータを書き込みます。

f:id:hideakii:20170910124144p:plain

f:id:hideakii:20170910124236p:plain

f:id:hideakii:20170910124328p:plain

 エクスプローラで XML ファイルを参照。

f:id:hideakii:20170910130237p:plain

  ESEDatabaseView を利用すれば、DOMStore の URL と Filename を確認できます。

f:id:hideakii:20170910191755p:plain

f:id:hideakii:20170910131348p:plain

マイクロソフトが公開しているサンプルアプリケーション。電卓に入力した値が Web Storage 内に保存されています。 

Offline Calculator

f:id:hideakii:20170910170627p:plain

f:id:hideakii:20170910170639p:plain

 マルウェアが Web Storage を利用している場合、どの様に調査すればそれを発見する事が出来るでしょうか?

 参考URL:

モダンブラウザのストレージ容量まとめ
https://www.html5rocks.com/ja/tutorials/offline/quota-research/

  qiita.com

 

f:id:hideakii:20170910130855j:plain