《Update:SSL バグについて知っておくべきこと》
[iOS 7 のバグ修正:image]
アップルの iOS 7 バグ修正がセキュリティ専門家の注目を浴びている・・・
Wired.com: “Behind iPhone’s Critical Security Bug, a Single Bad ‘Goto’” by Kevin Poulsen: 22 February 2014
* * *
アップルのバグ修正
昨日アップルは、SSL[注:Secure Sockets Layer、インターネット上で情報を暗号化して送受信するプロトコル]暗号化の実装に関するバグを修正する iOS 7.0.6 を公開した。SSL 暗号化は盗聴やウェブハイジャッキングを防止するインターネットの標準的防御メカニズムだ。このバグは基本的にはユーザーがパブリック Wi-Fi や NSA[National Security Agency:米国家安全保障局]が盗聴可能なネットワークを通じてEメール、ツイート、フェイスブックの利用、あるいは銀行口座のチェックなどを行なう際、アタッカーが盗聴し、あるいは iPhone や iPad に伝わる内容を悪意を持って修正できることを意味している。
Apple released iOS 7.0.6 yesterday to patch the bug in its implementation of SSL encryption — the internet’s standard defense against eavesdropping and web hijacking. The bug essentially means that when you’re e-mailing, tweeting, using Facebook or checking your bank account from a shared network, like a public WiFi or anything tapped by the NSA, an attacker could be listening in, or even maliciously modifying what goes to your iPhone or iPad.
* * *
「ひどい、実にひどい」
しかし昨日のアップルの簡単な説明に対し、インターネットの暗号解読の一部の専門家たちは、具体的にどんなバグなのかという点について疑問の声を上げた。そして非公式にその詳細情報を入手するにつれて、唖然として言葉を失ったとでもいうべきリツイートが出てきた。「アップルのバグが何なのか分かった。それはひどい、実にひどい」と Johns Hopkins 大暗号学教授の Matthew Green はツイートしている。
But the terse description in Apple’s announcement yesterday had some of the internet’s top crypto experts wondering aloud about the exact nature of the bug. Then, as they began learning the details privately, they retreated into what might be described as stunned silence. “Ok, I know what the Apple bug is,” tweeted Matthew Green, a cryptography professor at Johns Hopkins. “And it is bad. Really bad.”
* * *
バグの詳細分析
今朝になるともっと詳しい内容が Hacker News に浮上した。またグーグルのウェブ暗号専門家 Adam Langley はアップルの公開ソースコードを読み解いてバグの詳細分析を投稿した。
By this morning, the details had surfaced on Hacker News, and Adam Langley, a web encryption expert at Google, posted a detailed breakdown of the bug based on his reading of Apple’s published source code.
* * *
ひと目で分かる
ソフトウェアバグのいくつかは非常に微妙で複雑だ。しかし子供のときに BASIC をかじったことがあるものなら誰にとっても一見しただけで明らかなものもある。iOS 7 のバグは後者に属する。
Some software bugs are infinitely subtle and complicated. Others are comprehensible almost at a glance to anyone who dabbled in BASIC as a kid. The iOS 7 bug is in the latter group.
* * *
問題のコード
static OSStatus SSLVerifySignedServerKeyExchange(SSLContext *ctx, bool isRsa, SSLBuffer signedParams, uint8_t *signature, UInt16 signatureLen) { OSStatus err; ... if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) goto fail; if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; goto fail; if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0) goto fail; ... fail: SSLFreeBuffer(&signedHashes); SSLFreeBuffer(&hashCtx); return err; }
* * *
暗号化キー認証のための関数
分かるだろうか? 上記の関数は iPhone が SSL を通じて暗号化されたサイトに接続するときに呼び出される。ウェブサイトの管理者が暗号化キーを認証(デジタル署名)するためのものだ。
Did you see it? This function is called when a iPhone connects to an encrypted site over SSL: it’s meant to verify that the encryption key is being vouched for — digitally signed — by the operator of the website.
* * *
たった一行のミスが
続いて並んでいる2つの「goto fail」文に注目して欲しい。最初のものは正しい。しかし2番目はタイプミスだ。この余計な一行によってプログラムの実行が回避される。迂回ステントのように、重要な認証チェックをくぐり抜けるのだ。デジタル署名をチェックするこの部分が、決して実行されないコードになっているワケ。
But notice the two “goto fail” lines, one after the other. The first one belongs there. The second is a typo. That extra, duplicative line diverts the program’s execution, like a bypass stent, right past a critical authentication check. The part where the digital signature is actually checked is dead code, never reached.
* * *
OS X にはまだ脆弱性
この問題は新しい iOS 7.0.6 では確かに修正されていると Langley はいう。(iOS 7 ユーザーはこのアップデートをインストールすべきだ。)昨日の iOS 6 のアップデートもまたこのバグを修正している。しかしニュースでは OS X 10.9.1 にはまだこの脆弱性があるという。
The issue, Langley confirms, is indeed fixed in the new iOS 7.0.6 (which you should install, if you’re using iOS 7.) An update to iOS 6 pushed yesterday fixes the bug there as well. Reportedly, OS X 10.9.1 is still affected by the vulnerability.
* * *
単なるミス?
「#gotofail」と呼ばれるようになったこの驚くべき単純さ故に、このバグは決して偶然ではないのではないかという Snowden 流の憶測まで生じている。ただしグーグルの Langley はそういってはいない。
The breathtaking simplicity of what’s already being called #gotofail is spawning Snowden Era speculation that the bug was no accident at all. Google’s Langley is having none of that.
「これは単なるミスだと思う。エディタでうっかり書き、作ったのが誰であれ残念なことだと思う」と彼はいう。
“I believe that it’s just a mistake, he writes, “and I feel very bad for whomever might have slipped in an editor and created it.”
* * *
脆弱性のテストはこちら
脆弱性があるかどうかのテストは GotoFail.com できる。
You can test if you’re vulnerable at GotoFail.com.
* * *
たったの1行のミスが安全性を根こそぎ揺るがせかねないという点がスゴい。
OS X にはまだこの脆弱性が残っているというワケだ。
今回の脆弱性が作為的なものかどうかという点について John Gruber が触れている。
Daring Fireball: “On the Timing of iOS’s SSL Vulnerability and Apple’s ‘Addition’ to the NSA’s PRISM Program” by John Gruber: 22 February 2014
* * *
NSA の陰謀説
On the Timing of iOS’s SSL Vulnerability and Apple’s ‘Addition’ to the NSA’s PRISM Program
Jeffrey Grossman, on Twitter:
SSL 脆弱性は iOS 6.0 で導入された。5.1.1 には入っていなかったのに 6.0 には入っている。
I have confirmed that the SSL vulnerability was introduced in iOS 6.0. It is not present in 5.1.1 and is in 6.0.
事実2:iOS 6.0 は 2012 年9月24日に出荷された。
iOS 6.0 shipped on 24 September 2012.
事実3:リークされた NSA の PRISM プログラムの6枚目のパワーポイントスライドによれば、アップルが「追加」されたのは 2012 年10月だ。
According to slide 6 in the leaked PowerPoint deck on NSA’s PRISM program, Apple was “added” in October 2012.
* * *
陰謀説かうっかりミスか
これら3つの事実が何らかのことを証明しているワケではない。まったくの状況証拠に過ぎない。しかし当てはまると思うひとはそう信じるのだ。
These three facts prove nothing; it’s purely circumstantial. But the shoe fits.
この誤った一行を加えたのが誰なのか興味深いところだ。陰謀論的にいえば、NSA がアップル従業員のスパイのひとりを使ってこのバグを仕掛けたことになるかもしれない。当たり障りのない言い方をすれば、これはアップルのエンジニアがうっかりして引き起こしたミスだというオッカムの剃刀(Occam’s Razor)的な説明になるだろう。マージ(merge)がうまくいかず、「goto fail;」行を複製したため生じたバグのように思える。
Sure would be interesting to know who added that spurious line of code to the file. Conspiratorially, one could suppose the NSA planted the bug, through an employee mole, perhaps. Innocuously, the Occam’s Razor explanation would be that this was an inadvertent error on the part of an Apple engineer. It looks like the sort of bug that could result from a merge gone bad, duplicating the goto fail; line.
* * *
いったんバグができると
いったんバグが出来てしまうと、NSA としてはバグを見つけるためソースコードを手作業で読む必要すらない。新しい OS がリリースされるたびに、なりすまし証明書を自動的にテストするだけでいいのだ。アップルが iOS をリリースする、NSA が自動的になりすまし証明をテストして脆弱性を調べる、ドーン、それでアップルが PRISM に「追加される」というワケ。(NSA としては早くから変更する必要すらない。iOS 6 が開発者向けベータテストの段階だった夏の間に脆弱性を見つけてしまったのかもしれないのだ。)
Once the bug was in place, the NSA wouldn’t even have needed to find the bug by manually reading the source code. All they would need are automated tests using spoofed certificates that they run against each new release of every OS. Apple releases iOS, the NSA’s automated spoofed certificate testing finds the vulnerability, and boom, Apple gets “added” to PRISM. (Wasn’t even necessarily a fast turnaround — the NSA could have discovered the vulnerability over the summer, while iOS 6 was in developer program beta testing.)
* * *
それとも・・・
それとも何事もなく、すべては偶然だったのかも。
Or, maybe nothing, and this is all a coincidence.
* * *
陰謀説パラノイア
陰謀説パラノイアとして考えられる5つの可能性:
I see five levels of paranoia:
1)何も起きなかった。NSA はこの脆弱性を知らなかった。
2)NSA は知っていたが、利用しなかった。
3)NSA は知っていて、これを利用した。
4)NSA 自身がひそかにこれを仕掛けた。
5)アップルが NSA に加担してこれを加えた。
1. Nothing. The NSA was not aware of this vulnerability.
2. The NSA knew about it, but never exploited it.
3. The NSA knew about it, and exploited it.
4. NSA itself planted it surreptitiously.
5. Apple, complicit with the NSA, added it.
* * *
他にもまだ・・・
自分として考えられるのはせいぜい3)までだ。自分としては実際は楽観的シナリオの方だと思う。なぜなら PRISM のスライドから、NSA としてはこの脆弱性を利用することがある程度可能だと主張していることを知っているからだ。だから今は修正されたこのバグを NSA が悪用しなかったとしても、まだ閉じられていない脆弱性がほかにもいくつか存在するかもしれないということなのだ。
Me, I’ll go as far as #3. In fact, I think that’s actually the optimistic scenario — because we know from the PRISM slides that the NSA claims some ability to do what this vulnerability would allow. So if this bug, now closed, is not what the NSA was exploiting, it means there might exist some other vulnerability that remains open.
* * *
気になる最後の一行だが、この手の脆弱性なら他にもまだあるのではないかということか・・・
★ →[原文を見る:Kevin Poulsen]
★ →[原文を見る:John Gruber]
❖ ❖ ❖
❖ ❖ ❖
《Update》SSL バグについて知っておくべきこと(2月25日)
アップルの SSL バグについて知っておくべきことを Macworld 誌が簡潔にまとめている。
アップルに関連して NSA の話題は日本ではあまり触れられないが、それに関連する項目。
Macworld: “What you need to know about Apple’s SSL bug” by Dan Moren, Dan Miller and Serenity Caldwell: 24 February 2014
* * *
アップルと NSA
問:この脆弱性によって NSA は個人の通信をのぞき見できるか?
Q: Could this vulnerability let the NSA snoop on my private communications?
答:時宜を得た鋭い質問。Daring Fireball の John Gruber は、2012 年の iOS 6 のリリースの際無修正のままだったことが明らかなこのバグが、NSA が PRISM プログラムによってアップル製品の監視が可能だと主張したものである可能性を示唆している。NSA が意図的にこのバグを仕掛けたか、ないしは利用したかという点については、陰謀説に対する読者の関心次第だといっている。しかしその可能性を完全に否定しているわけではない。
A: Astute and topical question. Daring Fireball’s John Gruber has suggested that this bug, which has apparently gone unpatched since iOS 6’s release in 2012, could be what the NSA was referring to when it claimed it could conduct surveillance on Apple products under the PRISM program. As to whether or not the NSA specifically planted or exploited the bug, which is in a piece of open-source software, that depends on your own level of interest in conspiracy theories—but it’s certainly not out of the question.
* * *
バグ修正が出る時期
問:バグ修正は何時になるか?
Q: When is a patch expected?
答:問題の重要性に鑑み、早急に修正されると思われる。アップルのスポークスマン Trudy Muller は修正が「近々行なわれる」と Macworld 誌に対して語った。非公式の修正もリリースされているが、アップルからの直接のバグ修正を待つことを勧める。時期が知りたければ、そのためのサイトもある。
A: Given the severity of the problem, we’d expect imminently. Apple spokesperson Trudy Muller told Macworld that a fix was “coming soon.” An unofficial patch has been released, but we’d recommend waiting for the fix directly from Apple. And just in case you want to know the moment it’s out, there’s already a site for that.
* * *
このほか Macworld 誌が準備した想定問答はつぎのようなもの。
・いったいこのバグはどうやって見つかったのか?
・そもそも SSL/TLS とは何? 何をするもの?
・具体的にはどんなことが起きたのか?
・影響を受けるのはどのシステムか?
・Safari だけが影響を受けるのか?
・Chrome など他のブラウザも影響を受けるのか?
・暗号化された Wi-Fi ネットワークでも危険か?
・バグ修正がされるまで Mac を使ったネットバンキングは控えるべきか?
・銀行の個人情報をハッカーがのぞき見しているのか? パスワードは変えるべきか?
– Okay, so how did we find out about this?
– What is SSL/TLS? What does it do?
– What exactly happened?
– What systems are affected?
– So does this just affect Safari?
– Does it affect other browsers, like Chrome?
– But my Wi-Fi network is encrypted—am I still at risk?
– So … should I not be online banking on my Mac until this is fixed?
– Does that mean hackers have been snooping through my banking info? Should I change my passwords?
読者の関心に合わせて原文をお読みください。
★ →[原文を見る:Original Text]
限られた極小メモリ空間を走らせるため、一言一句を切り詰めていた古き時代のコードとは違い、膨大な機能を有する現代のコード群では、些細な単純記述ミスが起こる可能性は高いのでしょうが、お粗末ですね。
“It is not present in 5.1.1 and is in 6.0.” は「5.1.1には入ってなかったが、6.0には入っている」ですかね。
> Ken さん
「たった一行のミス」でした 失礼しました
どんな深刻な脆弱性と言えど、プログラムのバグは、大概、分かってしまえば単純なミスが大半。勿論アップルは再発防止策を講じるだろうが、技術者の締め付け管理を強めて創造性が損なわれる風潮に流されない事を望む。
[…] http://blog.velc.jp/post/77708351226/3 たった一行のミスが・・・ | maclalala2 https://maclalala2.wordpress.com/2014/02/24/%e3%81%9f%e3%81%a3%e3%81%9f%e4%b8%80%e8%a1%8c%e3%81%ae%e3… […]
> アップルのスポークスマン Trudy Muller は修正が「近々行なわれる」と Macworld 誌に対して語った。
“Details matter, it’s NOT worth waiting to get it right.”
早く修正してくれ〜
[…] たった一行のミスが・・・ | maclalala2 […]