自動的にOS Xのキーチェーンアクセスの許可ボタンを押させる「BrokenChain」脆弱性の詳細。

記事内に広告が含まれています。
スポンサーリンク
スポンサーリンク
スポンサーリンク

 自動的にOS Xのキーチェーンアクセスの許可ボタンを押させる「BrokenChain」脆弱性の詳細と注意点ををMalwarebytes社の主任研究員Thomas Reedさんが公開しています。詳細は以下から。


Script-Editor-access-Hero


 9月初め、MackeeperやVSearchなどを同梱し目的のアプリと同時にこれらのアプリをインストールさせる”Genieo”インストーラーに「キーチェーンアクセスの[許可]ボタンを自動的に押させる」新機能が加えられていたことが分かり、Appleは9月4日にOS Xのウィルス定義データベースXProtectをアップデートしました。

関連リンク

 新たなGenieoインストーラーの第一発見者であり、Malwarebytes社の主任研究員Thomas Reedさんはこの脆弱性を”BrokenChain”と名付け、その詳細を以下の様に説明しています。


BrokenChainの進化とAppleScript

 BrokenChainの原型は2011年に流行したOSX.DevilRobberマルウェアの中にも発見されており、これはAppleScriptを利用してキーチェーンへのアクセス[許可]ボタンを押させるコードを実装していますが、


Keychain-Access-Prompt-Accept-Hero

Back in 2011, a trojan called DevilRobber appeared. It used a simple AppleScript to help it “click” the Allow button in that alert.
This works, but on a modern version of OS X, there’s a fairly significant problem with this. In order for this script to work, the app running the script must have been granted “access for assistive devices.” If you try to run this script in the Script Editor, OS X will prompt you to do that:

[A look at the OS X “BrokenChain” vulnerability – Malwarebytes Unpacked]

 Appleは既に最近のOS Xの中で、Scriptを実行する許可を「アクセシビリティ」に統合し、許可がない限りこの古いBrokenChainコードは実行できないようになっています。実際に試してみましたが、以下の様にApple Scriptを実行するとアクセシビリティの許可を求めるプロンプトが表示され、拒否すればこのコードは実行されることはなく、許可を求めたコードやアプリはシステム環境設定.appの[プライバシー] > [アクセシビリティ]に表示されます。




MyKi の研究者が公開したPoC

 パスワード管理アプリ”MyKi”を開発している2人の開発者Antoine Vincent Jebaraさんと Raja Rahbaniさんが公開したBrokenChainのPoCは「キーチェーンへのアクセス許可を求めるプロンプトが現れてから200ミリ秒以下で[許可ボタンをすことが出来、SMSなどへパスワードを送ることが可能である」と主張しており、Thomasさんはこの手法は管理者パスワードもアクセシビリティの許可も必要無い”MouseTool”や”Cliclick“の様なコマンドラインユーティリティを利用しているのではないかと予想していますが、



Another technique was described on Tuesday by a couple developers from Myki, according to an article on CSO Online. Their method was to create what was identified as a shell script that “wrapped” an image file.
[…]
I’d guess that app probably calls a shell script, which in turn calls a command-line utility like MouseTool or Cliclick. These utilities are capable of moving and clicking the mouse, and therefore can be used to click the Allow button. In my testing, these utilities do not require any kind of admin password to be entered, nor do they need to be given access for assistive devices.

[A look at the OS X “BrokenChain” vulnerability – Malwarebytes Unpacked]

 Mykiの2人の開発者が主張する「[許可]ボタンはMacの画面中央から右に10%, 下に7%の位置に表示される」というのは一部のMacでは利用できるでしょうが、プロンプトの現れる位置は使用しているMacの画面の大きさにより変化するため、この手法では全てのMacに対応させることは不可能です。


Keychain-Access-Prompt-Accept6

According to the folks from Myki, they are able to click the Allow button by assuming it to be “10 percent to the right of the centre of the screen and 7 percent below it.” Although that may work on some machines, in my testing, that’s definitely not where it appears on my iMac.

[A look at the OS X “BrokenChain” vulnerability – Malwarebytes Unpacked]

最新のGenieoインストーラーは何をしているのか?

 それでは最新のGenieoインストーラーはどの様に[許可]ボタンをクリックしているのでしょうか?Thomasさんの研究では新しいGenieoインストーラーはAppleが提供しているCGWindowListCopyWindowInfo(サンプルコード:Son of Grad)という特別な権限の必要無く全ウィンドウの情報を提供してくれるAPIを利用しているそうで、これによってアクセシビリティの許可ボタンが表示される”SecurityAgent”プロンプトの位置情報を取得し、[許可]ボタンの位置を特定、マウスイベントを実行し確実に[許可]ボタンをクリックしているそうです。


Son-of-Grab-output

I located some sample code on Apple’s site for an app called “Son of Grab,” which does something very interesting… it parses the output from CGWindowListCopyWindowInfo, just as the Genieo installer did. The information it’s able to gather about open windows, without any need for special privileges, is telling:

Topping the list is the keychain access request window on my system, with its exact position plainly exposed. Add the offset to the middle of the button to the coordinates of the window and you have exactly the right on-screen position at which to simulate a click.

[A look at the OS X “BrokenChain” vulnerability – Malwarebytes Unpacked]

まとめ

 以上の様な方法を合わせれば、悪意のあるインストーラーやアプリがキーチェーンの[許可]ボタンを押すのに特別な権限やアクセシビリティの変更を必要としませんが、ThomasさんはCSO Onlineに記事でJebaraさんらが主張していたiCloudキーチェーンへのアクセスが可能である点や画像ファイルへの埋め込みなどは不可能で、この方法は以下の様なプロンプトが必ず表示されるため、不審なアプリなどを実行しないようにと注意を促しています。


Script-Editor-access-Hero

So, what does all this mean? Essentially, it means that it actually is possible for a rogue app to access items from the keychain using this vulnerability, without any need for special permissions. That means no admin password request or change to the access for assistive devices settings is necessary.

[…]
Thus, although this is definitely a concerning issue, the sky is not falling.
Exploiting this issue cannot be done without the potential for alerting the user, and far worse can be done without alerting the user in any way at all.

[A look at the OS X “BrokenChain” vulnerability – Malwarebytes Unpacked]

関連リンク:

コメント

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