マルウェア
VPNサービスを装った不正広告により拡散されるマルウェア「OpcJacker」
トレンドマイクロは、新しいマルウェア「OpcJacker」を発見しました。「OpcJacker」は、暗号資産のハイジャックを主目的とし、特徴的なオペコードを備えています。
トレンドマイクロは、新しいマルウェア「OpcJacker」を発見しました。当名称「OpcJacker」は、このマルウェアのオペコード(Opcode)設定及び暗号資産のハイジャック(Hijack)能力に由来しています。2022年後半から、本マルウェアの感染が観測されています。「OpcJacker」の特徴は、設定ファイルがカスタムファイル形式で情報窃取ツール(Stealer)の挙動を定義している点です。当カスタムファイル形式はカスタム仮想マシンコードに類似しており、設定ファイル内に存在する16進数の識別子を用いることにより、攻撃者が選択する関数の実行を可能とします。このような設計を攻撃者が採用する目的は、研究者がマルウェアのコードフローを解析することを困難にするためと考えられます。
「OpcJacker」の主な機能は、キーロギング、スクリーンショットの撮影、ブラウザからの機密データの窃取、追加モジュールのロード、資産窃取を目的とするクリップボード内の暗号資産アドレスの差し替え等です。
「OpcJacker」は複数の偽装Webサイトで配布されているのが観測されていますが、いずれの場合も暗号資産関連のアプリやその他の正規ソフトウェアであるかのように偽装されて配布されていました。「OpcJacker」が関与した最新の攻撃(2023年2月)の感染チェーンは、イランのユーザに対するジオフェンス(位置情報を利用して仮想的なフェンスを設定)を利用した不正広告(Malvertisement)から始まりました。この不正広告は、正規のVPNサービスとして偽装され、被害者を騙し「OpcJacker」を含むアーカイブファイルをダウンロードさせるものでした。
このマルウェアは、インストールされたアプリ内の正規DLLライブラリを修正することでロードされ、結果的に別の不正なDLLライブラリがロードされます。そして、このDLLライブラリは、WAV (Waveform Audio File Format)やCHM(Microsoft Compiled HTML Help)等の様々な形式のデータファイルとして格納されたデータチャンクから、シェルコード(別の不正な実行ファイルのローダ及びランナー)及び「OpcJacker」を構築し、実行に移ります。なお、このローダはBabadeda crypterと呼ばれているもので、すでに一年程度に渡って使用が確認されており、解説も存在します。この攻撃の背後にいるグループは、このクリプタに複数の変更を加え、新しいペイロード(情報窃取ツール、クリッパ、キーロガー)を追加します。
トレンドマイクロは、「OpcJacker」を用いた攻撃の大半において「NetSupport RATもしくはhVNC(Hidden Virtual Network Computing)」の亜種である追加モジュールを作成またはダウンロードすることを確認しています。これらのモジュールはリモートアクセスツールです。また、ランサムウェア「Phobos」を読み込む際に使用されるPhobos Crypterと呼ばれるローダについて言及しているレポートも存在しますが、このローダは「OpcJacker」と同じマルウェアであることを確認しています。
デリバリ
トレンドマイクロは、「OpcJacker」が複数の異なる攻撃を介して拡散されていることを確認しました。これらの攻撃では、一見すると正規のソフトウェアや暗号資産関連のアプリを宣伝するWebサイトのような外観を装っていますが、実際にはこれらのサイトにはマルウェアが配置されています。また、「OpcJacker」以外にも複数の異なるマルウェアが拡散されていることから、「OpcJacker」の背後にいる攻撃グループが複数の有料インストールサービスをマルウェアの拡散のために利用していると推測されます。
2023年2月以降の攻撃では、イランをジオターゲット(位置情報を利用し地域に特化した広告や情報の配信を行う)とする不正広告を介して感染が拡大しています。これらの不正広告は、正規のVPNソフトウェアのWebサイトを装った不正なサイトに繋がっています。このサイトのコンテンツは、正規の商用VPNサービスのWebサイトを複製していましたが、サイト内のリンクは不正なコンテンツを配布するWebサイトに接続するように変更されていました。
不正なWebサイトは、まずクライアントのIPアドレスを確認し、被害者がVPNサービスを使用しているか否かを判断します。IPアドレスがVPNサービスのものでない場合、被害者を2つ目の不正なWebサイトにリダイレクトし、「OpcJacker」を含むアーカイブファイルをダウンロードさせるように誘導します。なお、対象者がVPNサービスを利用している場合は、この攻撃は実行されません。
さらに、多数のISOイメージやRAR/ZIPアーカイブが発見されましたが、これらには「OpcJacker」のロードを誘導するために使われる様々なソフトウェアのインストーラを改変したものが含まれていました。これらのインストーラはこれまでに他の攻撃でも使用が確認されていますが、いずれもハッキングされたWordPressを用いたWebサイトやGitHub等のソフトウェア開発用プラットフォームにおいてホストされていました。攻撃者がISOファイルの使用を選択する理由は、Mark-of-the-Web警告を回避するためであると推測されます。
以下は、トレンドマイクロが確認した不正なファイル名です。
- CLF_security.iso
- Cloudflare_security_setup.iso
- GoldenDict-1.5.0-RC2-372-gc3ff15f-Install.zip
- MSI_Afterburner.iso
- tigervnc64-winvnc-1.12.0.rar
- TradingViewDesktop.zip
- XDag.x64.rar
Babadedaクリプタ
この章で挙げているファイル名は、インストーラにより名称が異なります。しかし、これらのファイルの全般的な機能はいずれも同じです。
インストーラは必要なファイルを全て作成した後、メイン実行ファイル(RawDigger.exe)を読み込みます。これは、感染していない正規のファイルです。
実行ファイルは、修正されたインポートを含むDLLライブラリ(librawf.dll)をロードします。
修正されたDLL(RAW画像解析アプリRawDiggerに接続しているlibrawf.dll)のインポートアドレステーブルは、2つの追加DLLライブラリを組み込むように、さらに修正が施されています。下の図では、新たに追加されたライブラリのFirstThunkアドレスが、元ライブラリのFirstThunkアドレスで使用されていた0012xxxxではなく、001Dxxxxから始まっています。
その後、図5でハイライトされているライブラリ(libpushpp.dll)がロードされ、実行されます。その主なタスクは、データファイルの1つ(hm)を開き、内部に格納されている第1段階のシェルコードをロードすることです。
第1段階のシェルコードのオフセット及びサイズは、DLLライブラリにハードコードされています。
新しいバージョンのBabadeda クリプタでは、別のDLLライブラリ(偽造されたVPNインストーラのmdb.dll)がメモリにロードされます。その後、ハードコードされ、ランダムに選択されたメモリブロックが第1段階のシェルコードにより上書きされます。これは些細な変更に過ぎず、第1段階のシェルコードの総合的機能には影響を及ぼしません。
第1段階のシェルコードの最後には、暗号化されたデータチャンクのオフセット及びそれぞれのデータサイズを含むコンフィグレーションテーブルが存在します。そして、第1段階のシェルコードは、全てのチャンクを復号化し結合します。この過程により、第2段階のシェルコード(ローダ)及びメインマルウェア(追加の不正モジュールをロードする機能を持つ「OpcJacker」)を形成します。
コンフィグレーションテーブルは、少なくとも8つの同じ文字(図9では赤色の*が用いられているが、他の検体では異なる文字が使用される可能性あり)で始まり、データファイルの全長(緑色:hmの長さ=0x1775e0=1537504バイト)、暗号化キー(黄色:0x18)、第2段階のシェルコードのチャンク数(茶色:0x07)、そしてメインマルウェアのチャンク数(白色:0x08)の順番で列挙されます。0x07(赤括弧)及び0x08(青括弧)のリストは、各チャンクの15個のアドレスとサイズに相当します。
データファイル(hm)の冒頭には、WAVEファイル形式を模倣している(WAV)ファイルヘッダが確認できます。なお、CHMが使用されることもあるため、データファイルは別のファイル形式となる可能性があります。
情報窃取のメインコンポーネント、OpcJacker
メインのマルウェアコンポーネント(OpcJacker)は、まず設定ファイルを復号化しロードする独特な情報窃取ツールです。設定ファイルの形式は、カスタム機械語(Machine Language)で書かれたバイトコードに類似しています。ここでは、各命令がパースされ、個々のオペコードを取得します。その後、特定のハンドラが実行されます。
カスタムバイトコードを解析したところ、以下のパターンが確認できました。
ASCII文字列は、01 xx xx xx xx <string bytes>としてエンコードされます。xx xx xx xxは、文字列の長さを示します。
同様に、ワイド文字列はバイト02から始まり、バイナリ配列はバイト03から始まります。
設定ファイルは、3つの4バイト・リトルエンディアン(DWORD)数値で始まる命令列です。最初の数値は、仮想プログラムカウンタです。2番目はおそらく親(Parent)命令の仮想プログラムカウンタであり、そして3番目はハンドラID(仮想マシンで実行されるコード)です。その後、データバイトまたは追加のハンドラIDが続きます。
上記の観察に基づき、トレンドマイクロは命令(Instruction)パーサを作成しました。その結果として、以下の出力(Output)が表示されました。残念ながら、仮想マシンの内部実装に関して完全に把握することはできませんでしたが、このパーサにより設定ファイル内におけるマルウェアの挙動定義について確認することができました。
復号化により解読された設定ファイルは、特定のシステム変数の初期化から始まります。こここでは、test及びrikが攻撃用IDである可能性が高いと推測されます。以下のハッシュ値の設定ファイルは、攻撃用IDとして異なるキーワードtest及びilkを含みます。
SHA256 c5b499e886d8e86d0d85d0f73bc760516e7476442d3def2feeade417926f04a5
一方、2023年2月以降の攻撃で作成された以下のハッシュ値の設定ファイルには、キーワード test_installs及びyorikが含まれます。
SHA256 565EA7469F9769DD05C925A3F3EF9A2F9756FF1F35FD154107786BFC63703B52
次に、クリップボード交換機能(クリッピング)の初期化を行います。
その後、exe変数は実行ファイルのバイトにより初期化されます(4d 5a 90 = MZマーカー参照)。この実行ファイルは、リモートアクセスツールです。
このマルウェアは、レジストリの実行及びタスクスケジューラメソッドを介してパーシステンス(永続性)を設定します。現プロセスのファイル名を保持するために、$itself_exe変数を使用します。
その後、マルウェアはクリッパ関数を起動します。これは、クリップボードにおける暗号資産アドレスの有無を確認し、攻撃者が管理する暗号資産アドレスに置き換えることを意味します。
最後に、virtual_launch_exe関数が、先に組み込まれた実行ファイルを起動します。この実行ファイルは、NetSupport RAT、NetSupport RAT ダウンローダ、またはhVNCのいずれかのRATです。
カスタム仮想マシンのハンドラID
上記スクリーンショットの3列目または、デコードされたコマンド変数に見られるように、仮想マシンは多数の内部ハンドラを実装しています。これらは、様々なデータの操作に関与しています。表1では、特定の高水準関数を持つハンドラを複数列挙しています。具体的には、クリッピング(クリップボードのコンテンツ置換)、キーロギング、ファイルの実行及びリスト化、プロセスの強制終了、Chromium認証情報の窃取、アイドル状態の検知、仮想マシンの検知等が示されています。なお、トレンドマイクロのテストシナリオでは、情報窃取ツールはパーシステンスを設定する方法のみで追加モジュール(リモートアクセスツール)を展開していることを確認しました。
埋め込まれたモジュール
NetSupport RATモジュール
一部の埋め込まれたモジュールは、NetSupport RAT の以下のいずれかの ハッシュ値のファイルclient32.exe を含みます。
SHA256 18DF68D1581C11130C139FA52ABB74DFD098A9AF698A250645D6A4A65EFCBF2D
SHA256 49A568F8AC11173E3A0D76CFF6BC1D4B9BDF2C35C6D8570177422F142DCFDBE3
しかし、この1つのファイルだけでは不十分であり、NetSupportツールは追加のDLLライブラリ及び設定ファイルを必要とします。これらのファイルは、変更されたインストーラによって、インストールディレクトリに既に作成されています。
研究者にとって最も重要なファイルは、client32.iniです。このファイルには、ゲートウェイアドレス、ゲートウェイキー(GSK)、ポート等の重要な設定が含まれています。
NetSupport RATダウンローダ モジュール
埋め込まれたモジュールの一部は、以下のハッシュ値のダウンローダNetSupport RAT を含みます。このダウンローダは、URLペイロードを復号化したうえで、ダウンロードし、実行に移ります。
SHA256 C68096EB0A655924CA840EA1C71F9372AC055F299B52335AD10DDFA835F3633D
復号化された設定ファイルには2つのURLが含まれ、1つ目は上記モジュールと同様にNetSupport RATを含むアーカイブと繋がっています。一方、2つ目は複数のバッチスクリプトが含まれており、図23に示されているようなメッセージを表示します。その後、これらのバッチスクリプトの1つは、追加の情報窃取ツールをダウンロードします。
hVNCモジュール
埋め込まれたモジュールの一部は、修正された以下のhVNCモジュールを含みます。このモジュールには、標準的なリモートデスクトップ機能に加えて、以下の暗号資産関連のGoogle Chrome、Microsoft Edge、Mozilla Firefoxの拡張機能(ウォレット)の有無を確認するルーチンも含まれています。
F772B652176A6E40012969E05D1C75E3C51A8DB4471245754975678F04DEDAAA
解析した検体では、C&C(コマンド&コントロール)通信は以下のマジックで始まっています。
以下のスニペットは、いくつかの値(Value)が実行ファイルにハードコードされることを示しています。一方、その他の値はMachineGuidから生成、もしくはランダムに生成されます。図25に “7.7”と表示された箇所がありますが、これは修正されたhVNCのバージョンと推測されます。
まとめ
このマルウェアの第一の目的はウォレットから暗号資産を窃取することであるため、「OpcJacker」の背後に存在する攻撃グループの主な動機は、金銭的な利益を得ることであると推測できます。一方で、この多機能なマルウェアは、情報窃盗の手段やマルウェアローダとしても機能します。そのため、暗号資産の窃取以外でも様々な用途に応用することが可能です。
この検体で発見された攻撃用IDには「test」や「test_installs」等の文字列が見られることから、「OpcJacker」は未だ開発・テスト段階である可能性もあります。また、このマルウェアは、VM(仮想マシン)のような様々な機能を併せ持つ独自のデザインを採用しています。そのため、今後も様々な攻撃者によって攻撃に使用される可能性があるといえます。
IOC(痕跡情報)
IOC(痕跡情報)の全リストは、こちらをご覧ください。
参考記事
New OpcJacker Malware Distributed via Fake VPN Malvertising
By: Jaromir Horejsi, Joseph C Chen
翻訳:新井 智士(Core Technology Marketing, Trend Micro™ Research)