Philippe Laulheret - ハードウェアハッキング入門 - DEF CON 27 カンファレンス
このページのタイトル、字幕、要約、読書メモは保存済みの AI 翻訳です。誤りが含まれる場合があります。タイムスタンプは原文と同じです。原文の字幕を開き、元の動画と照合できます。
Philippe LaulheretはVoIP電話を使ってハードウェアセキュリティ研究を説明し、偵察やデバッグインターフェースからファームウェア調査までを扱います。
文字起こしの出典:YouTubeに作成者がアップロードしたキャプション。AIによる句読点の付加はVidleafによるもので、元の文言とタイムスタンプのアンカーは保持されています。元の文字起こしは以下でご覧いただけます。
AI生成の要約
Philippe LaulheretはVoIP電話の調査を使ってハードウェアセキュリティ研究のプロセスを説明します。講演は公開文書と基板検査からデバッグインターフェース、ファームウェア分析、そして途中で遭遇する問題へと進みます。その価値は、異なる層での観察が互いにどう情報を与え合えるかを示すことにあり、うまくいかなかったアプローチも含まれます。後のケーススタディでは、デバイス調査をソフトウェア脆弱性とその結果のデモンストレーションに結びつけます。最後の議論は、ベンダーパッチの適用、ネットワークの監視、デバイスの適切な分離など、防御策に戻ります。
要点
- [4:37] 調査には失敗したアプローチも含まれ、デバイスによって異なる可能性があるプロセスを強調しています。
- [26:19] ファームウェア分析は、組み込みデバイスがどのように動作するかを理解するための一部です。
- [45:17] 講演は、パッチ適用、監視、ネットワークセグメンテーションに関する防御的な推奨事項で締めくくられます。
記録から生成されました。リンクされた箇所を元のビデオと照合してください。概要と要点はVidleafが2026-10-21に確認しました。
全体概要
McAfee Advanced Threat ResearchのシニアセキュリティリサーチャーであるPhilippe Laulheretが、Avaya 9シリーズVoIP電話(9611gを含む)を実例として用いながら、ハードウェアハッキングの入門を紹介します。彼は、ハードウェアハッキングが重要である理由として、楽しくて力が湧くこと、そして実用的な理由として、ソフトウェアは破るのが難しくなってきている一方で、デバイスを開けて数本のワイヤをはんだ付けする方が簡単な場合があり、手軽に成果を得られることを挙げます。この講演では結果よりもプロセスを重視し、うまくいかなかったことを共有し、あるデバイスでうまくいったことが別のデバイスでうまくいくとは限らないと指摘します。FCCの内部写真、マニュアル、フォーラムを通じた偵察、UART、JTAG、テストポイントなどのハードウェアデバッグインターフェース、ボーレート、プルアップ抵抗とプルダウン抵抗を扱い、最後にはんだごて、フラックス、ワニス被覆ワイヤ、吸い取り線、ヒートガン、マルチメータといったツールと安全について締めくくります。第二部では、ロジックアナライザ、FTDIシリアルケーブル、Bus Pirate、fly swatterやJ Link、JTagulatorといったJTAGデバッガ、フラッシュリーダーなどのツールを概観し、高価なツールほど信頼性が高くソフトウェアも優れている可能性が高いと述べます。また、暗号化されたフラッシュを持ちUARTもファームウェアもない電話に対してChipWhispererでフォールトインジェクションを行う方法を説明し、シェルを取得する三つのアプローチ(UARTコンソール、フラッシュリカバリ、オンラインでのファームウェアダウンロード。これはファームウェアが暗号化されていなかったため成功しました)を紹介し、インサーキットおよびアウトオブサーキットのフラッシュダンプ、JTAGによるRAMダンプ、ScanlimeによるWacomタブレットでのUSBグリッチ、誤検知への警告を伴うBinwalkによるファームウェア解析を扱い、その後、コンソールがなぜ/dev/nullに設定されていたのかを学ぶためにARMブートローダのリバースエンジニアリングを始めます。続いて講演者は、Avaya 9611gのブラックボックスハッキングを順を追って説明し、「EEPROM read successful」などの文字列を使ってIDAでブートローダのアドレスを特定し、ロジックアナライザとデータシートでSPI EEPROMを調べ、コンソール設定関数にパッチを当てます。小さなチップにはんだ付けしたワイヤとBus Pirateを使った後、UARTパッドでの導通テストとFTDIケーブルでのピンの探りによってrootシェルを取得し、イーサネットケーブルを削ってキー付きRJ45 MODポートに合わせます。偵察によりDHClientが見つかり、これは単独でセグメンテーションフォールトを起こし、2007の著作権表示を持っています。オープンソースのオリジナルとパッチ適用済みのソースを比較すると、パッチ版ではmemcpyが4で境界付けられているのに対し、脆弱なサブネットマスク処理ではそうなっていないことが分かり、IDAによりスタックカナリアもマジック4もないことが確認されます。彼はQEMUのフルシステムエミュレーションをセットアップし(DHCPがIPを変更するためユーザーランドでは動作しません)、名前ソケット側をPythonで再実装してSocat経由で共有し、制御されるレジスタを特定するためにパターンデータを伴う過大なサブネットマスクオプションを送るScapyベースのエクスプロイトに切り替えます。PC制御が確認され、スタックは実行不可に見えるため、バイナリ内のシステムコール(おそらくAvayaが追加したもの)が、ドメインオプション経由で見つけた文字列を指す制御されたR4とともに使用され、ASLRは無効化されています。デモでは、悪意あるDHCPクライアントとWebサーバがメインスピーカからの音声を攻撃者のラップトップ上のVLCへ持ち出す様子が示され、彼はネットワーク監視、セグメンテーション、そしてITが約一か月前にリリースされたAvayaのパッチを実際に適用していることの確認を勧めます。締めくくりの挨拶では、組み込みシステムはブラックボックスではないと強調し、誰もがそれらを調べることを勧め、その後Twitter経由での質問を募り、聴衆に感謝します。
タイムスタンプ付きの章の要約
ハードウェアハッキング入門講演
ハードウェアハッキングが重要な理由
Avaya VoIP電話とハードウェアハッキング
- [1:58] この講演ではAvaya電話、特に9シリーズを扱い、スライドには9611gモデルが示されています。
- [2:03] Avayaは最大級のVoIPソリューションプロバイダの一つとして説明され、至る所で見られます。
- [2:08] AvayaはFortune 100企業の約90%に導入されていると言われ、その特定の電話モデルは2006年に始まり、年末頃に寿命が近づいています。
- [2:22] スライドのスクリーンショットには、DOD顧客のみがダウンロードできた古い電話ファームウェアが示されており、電話が多くの異なる場所に届いていることを示しています。
- [2:41] ハードウェアハッキングの先行事例には、インターネットのブログ投稿やチュートリアル、Hardware Hacking Village、よりソフトな側面を練習するためのCTFが含まれます。
- [3:02] リンクはスライドにあり、アップロードされたスライドにはより自立するように多くのテキストがあります。
- [3:11] 講演者は、約五年前に同じ電話で2個のRCを見つけたと述べています。
ハードウェアハッキングのプロセスと未パッチのファームウェア
- [3:22] 講演者はオンラインで入手可能なStepping P3wnsというRSAの講演を勧めています。
- [3:26] 次の40分間はハードウェアハッキングを扱い、電話を補助的な例として使用します。
- [3:36] 約12年前、Foxとオープンソースコードを通じて、セキュリティパッチが決して適用されなかったことがわかりました。
- [3:51] デバイスを突くことで、講演者は約10年間見過ごされていた問題を発見しました。これは約10年前にDefcon向けにリリースされたCVEに関連しています。
- [4:04] この講演ではファームウェア内で何かを見つけることを扱いますが、話者がなぜどのように行ったかのプロセスに重点を置いています。
- [4:21] 話者はうまくいかなかったことも共有します。あるデバイスでうまくいくことが別のデバイスでうまくいくとは限らないからです。
- [4:37] 主なポイントは、手持ちのデバイスをチェックするプロセスを学ぶことです。
- [4:47] ソフトウェア出身の話者は、良いプロセスと忍耐があればハードウェアハッキングはそれほど難しくなく、会場の誰でもできると述べています。
オフィス電話をハッキングする前の偵察
- [5:06] ネットワークアクセスとマイクを備えたLinuxベースの電話がオフィスの各デスクにあるのを見て、どれほど安全なのかという疑問が生じました。
- [5:27] 初期のステップは、同僚の電話を物理的に分解して検査することです。
- [5:31] Wi-FiやBluetoothを備えたデバイスはコンプライアンスのためにFCCのウェブサイトに掲載される必要があり、そこでは内部写真が提供されます。
- [5:50] FCCの写真から、ランダムなデバッグコネクタとフラッシュメモリが明らかになりました。フラッシュメモリは通常、電話のファイルシステムを保存します。
- [6:09] この検査により、ターゲットが簡単か難しいかの見当がつきます。例えば、黒いエポキシで全体が覆われていると難しくなります。
- [6:27] マーケティング資料などのオンライン資料を集めると、電話の機能と攻撃対象領域を把握するのに役立ちます。
- [6:43] 高度なユーザーマニュアルは、電話へのシリアル接続には特別なボックスが必要であることを示していました。
- [7:03] フォーラムを確認すると、電話のデバッグインターフェースとシステム管理者のデフォルトパスワードが明らかになりました。
電話のハードウェアデバッグインターフェース
- [7:28] これはハードウェアハッキングの講演で、ボランティアが提供されています。要点はまず電話を開けることです。
- [7:36] 通常、内部には同じようなものが見つかると予想されます。コンポーネントのラベルをGoogleで検索すると、それが何であるかがわかります。
- [7:45] 話者の電話では、CPUが中央にあり、その上にRAMがあり、疑問符でマークされたラベンダー色の未実装ヘッダーはJTAGかもしれませんが、使用されなかったためこれは不確かです。
- [8:03] ボードには設定を保持するEEPROMがあり、下部にはキー付きのRJ45があり、これは通常のRJ45に奇妙なコネクタを付けたもので、間違ったものを差し込めないようになっています。
- [8:26] UARTは露出したパッドを備えたシリアルコンソールのようなもので、製造時には通常ポゴピンがパッドに接続され、そこにシリアルコンソールがあると期待されます。
- [8:43] 裏面には前の写真で見たNANDフラッシュがあり、ここにデバイスのファイルシステムが保存されるでしょう。
- [9:00] テストポイントとデバッグヘッダーは注目に値します。開発ボードは通常製品ボードと同じで、デバッグコンポーネントが取り除かれていない可能性があり、デバッグシンボル付きでビルドされたソフトウェアに似ています。
- [9:26] テストポイントは、製造時にデバイスの書き込みや適切に書き込まれたことの確認に使用され、時には実世界で何かが故障した際の事後分析にも使用されます。
- [9:43] 探すべきものには、UART、JTAG、TP1やTP2のようにラベル付けされたランダムなテストポイントが含まれます。時にはTP64をグラウンドと短絡させるとデバイスがリセットされ、役立つことがあります。
- [10:13] UARTには3ピンまたは4ピンがあります:グラウンド、送信、受信、そしてオプションでVCC(3または5ボルト)ですが、通常は気にせず、接続する必要もありません。
- [10:36] シリアルコンソールはボーレートと呼ばれる異なる速度を使用し、一般的な値はわずかです。画面に意味不明な文字が表示されたら、ボーレートが間違っている可能性が高く、可能な値を順に試せばいつか何かが見つかるでしょう。
- [10:58] JTAGはCPUのハードウェアデバッグ用で、通常は命令ごとに実行し、多くの形状とピン数があり、興味深いのはほんの数本のワイヤーだけです。
プルアップ/プルダウン抵抗とボードの読み取り
- [11:53] プルアップ抵抗とプルダウン抵抗は、ピンをグラウンドまたはVCCに接続します。
- [11:57] 話者はこれらの抵抗の目的を知りませんが、それらがないと物事がうまく機能しないかもしれず、またはより手間がかかり、グリッチが発生するでしょう。
- [12:06] 必要な抵抗についてARM仕様などの仕様に従えばそれらを省略できるかもしれませんが、時々奇妙に乱れる理由を理解するのに時間を浪費するかもしれません。
- [12:19] 話者はプルアップ抵抗とプルダウン抵抗を推奨しています。
- [12:24] ある同僚のボードは、アドバイスがかなり一般的であることを示しています。左側にUART、右側にいくつかのJTAGコネクタ、シールドの下にメインCPUがあります。
- [12:38] シールドは通常、Wi-Fiモジュールのように干渉を防ぐために行われます。
- [12:43] シールドは通常接地されているので、グラウンドを探すときにシールドやイーサネットポート周りのケーシングがかなり役立ちます。
ハードウェアハッキングのツールと安全
- [13:12] 安全第一:壁に差し込まれたものに作業しない、プラグを抜く、換気の良い部屋を使用する。
- [13:34] はんだごてには交換可能なチップがあります:大きなチップは大きなはんだ付け用、小さなチップは小さなはんだ付け用です。
- [13:38] 顕微鏡は小さなはんだ付けに便利です。腕をまっすぐに保ち、しっかり接地することで、震えても助けになります。
- [14:12] フラックスはピンやパッドに塗る粘着性の物質で、表面実装はんだ付けをうまく機能させます。フラックスを決して忘れないでください。
- [14:29] ワニス被覆銅線は短絡を避け、小さなポイントツーポイントのはんだ付けに役立ちます。
- [14:48] はんだ吸取線は、アイロンで加熱すると余分なはんだを吸収し、ミスをきれいにします。
- [15:15] ホームデポで約$60のヒートガンは、加熱して引っ張ることでコンポーネントを取り外せます。
- [15:27] マルチメータはチップの電圧(黒をグラウンドに、赤プローブで測定)を見つけ、導通モードではんだ接続を確認するためにビープ音を鳴らします。
- [16:03] ロジックアナライザ(ブランドSally)は、ワイヤー上の信号を多くのプロトコルにわたって実際のデータに変換し、デバッグ時の目として機能します。
- [16:36] FTDIシリアルケーブルはラップトップに接続し、UARTポートに接続してコンソールを提供します。例えば、HDMIなしのRaspberry Piシリアルコンソールです。
- [17:01] Bus Pirateはデータを吸収するのではなく送信し、多くのプロトコルに対応し、Pythonでプログラム可能で、フラッシュの読み取りやマイクロコントローラのプログラミングに役立ちます。
ハードウェアハッキングツールの概要
- [17:26] JTAGデバッガはDigitechポート経由で接続し、さまざまな価格帯のものがあります。
- [17:38] ハエ叩きはおそらく30ドルくらいで、まあまあ使えますが、その上のJ Linkはもっと高機能です。
- [17:47] より高価なツールはおそらくより信頼性が高く、より良いソフトウェアが付属しています。
- [17:55] ピンクのボディのJTagulatorはJoe Grandによって作られました。彼はあのバッジを作ったのと同じ人物です。
- [18:04] ボード上のどこにJTAGがあるかわからない場合、すべてのテストポイントをJTagulatorに配線すれば、総当たりで全部見つけてくれます。
- [18:16] フラッシュリーダーは重要なツールです。なぜならフラッシュにはファイルシステムが含まれており、それとやり取りしたいからです。
- [18:27] フラッシュの読み取りには二種類あります。クランプや矩形クリップを使うインサーキット方式か、チップをはんだ除去してソケットアダプタを使う方式です。
- [18:35] Raspberry Piはインサーキット作業に適した選択肢で、右上のFlash Catは長方形のクリップに便利です。
携帯電話に対する高度なハードウェア攻撃
UARTコンソールとファームウェア復元の試み
- [19:47] 三つの可能なアプローチがあります。UARTシリアルコンソールをいじる、フラッシュをいじってファームウェアを復元する、オンラインでファームウェアをダウンロードする、です。
- [19:55] 三つとも有効なアプローチであり、見つかったハードウェアに応じて切り替えると役立つことがあります。
- [20:03] 彼はまずUARTを試し、以前と同じようにFTDIケーブルをUARTポートに接続しました。
- [20:17] コンソールにドットが見えるということは通常、スペースかエスケープを押すと携帯電話の起動プロセスを中断できることを意味しますが、ここではうまくいきませんでした。
- [20:30] デバイスはEEPROMから何かを読み取り、その後コンソールをDev nullに設定しました。これは出力がどこにも行かないため望ましくありません。
- [20:43] その後Linuxに起動し、UARTポートであることは確認できましたが、その後は何も表示されません。おそらくDev nullの状況のためです。
- [21:07] 次に彼はファームウェアの復元を試み、簡単なオンラインの方法が実際にうまくいきました。この場合、ファームウェアは暗号化されていませんでした。
- [21:21] もう一つの選択肢はファームウェアアップデートのスニッフィングで、IoTデバイス全般に役立ち、ネットワークタップやスイッチのポートミラーリングを使用します。
- [21:36] 問題は、ファームウェアアップデートがしばしばHTTPS経由で行われるため、行き詰まってフラッシュのダンプなどのハードウェアハッキングが必要になる可能性があることです。
フラッシュダンプの方法とテクニック
- [21:53] フラッシュをダンプする方法は二つあります。インサーキットプログラミングとアウトオブサーキットです。
- [21:57] インサーキットは部品を取り外したり壊したりする必要がないため便利ですが、主な問題はフラッシュに電源を供給する必要があることです。
- [22:11] Raspberry Piがフラッシュをシステム全体に接続したまま読み取ろうとすると、同じ電源ライン上の他のすべてに電源を供給しようとする可能性があります。
- [22:19] USB PiはVoIP電話に電源を供給するのに十分な強さがないかもしれませんし、十分な強さがあってもCPUが起動を停止してフラッシュと通信し、物事を台無しにする可能性があります。
- [22:37] その状況での選択肢は二つあります。ピン/ボールピンを持ち上げるか、CPUをリセット状態に保つかです。
- [22:51] もう一つのアプローチは、携帯電話が点灯するが起動しないようになるまで、ボード上のランダムなテストポイントをグラウンドに落とすことです。
- [23:03] ヒートガンでチップをはんだ除去できますが、強く引きすぎてピンを曲げないよう注意してください。
- [23:17] 良いトリックは、チップの上に小さなアルミホイルの帽子を作って周囲の部品が熱くなりすぎないようにすることです。
- [23:33] ランダムなUSBメモリで練習するのは非常によくうまくいきました。フラックスを使うのを忘れないでください。
- [23:51] U-Bootは最も一般的なブートローダーで、ここでは使われていませんが、ほぼ他のすべてのデバイスで見られます。
- [23:56] U-Bootはフラッシュをメモリにロードし、それを十六進数でダンプするように指示できますが、通常開発者はそのアプローチをロックするため、スペースを押してブートプロセスを中断することはできません。
- [24:24] Yoloアプローチ:U-Bootがフラッシュからロードしている間に、グラウンドに接続したワイヤーでNANDフラッシュのピンをつついてU-Bootが読み取っている内容を狂わせ、数回試すとシェルが得られます。
JTAGダンプとUSBデバイスのグリッチング
- [25:21] JTAGが機能すれば、RAMをダンプでき、多くのデバイスではそれがメモリにロードされたファームウェアをダンプすることを意味します。
- [25:37] ハードウェアハッキングは、攻撃対象領域のないWacomタブレットに対するScanlimeのアプローチのようなクレイジーなテクニックを可能にします。
- [25:52] Scanlimeは、USBをラップトップに接続するとUSBのやり取り、おそらくUSBディスクリプタが関与することを発見しました。
- [26:01] その瞬間にCPUをグリッチすると、バイナリチェックを見逃してはるかに多くのデータを送信させることができます。
- [26:10] そのグリッチで、彼女は完全なフラッシュと完全なメモリを復元することができました。
Binwalkによるファームウェア解析
- [26:19] ファームウェアは、講演者の場合のように、オンラインでダウンロードするだけで復元できます。
- [26:24] Binwalkはファームウェアを解析するための最良のツールで、バイナリをスキャンしてzipアーカイブやSquashfsやJFFS2のような圧縮ファイルシステムなどの埋め込みファイルを探します。
- [27:01] ある簡単なケースでは、ファームウェアはすでにboot 1、boot 2、JFFS2に分割されたdocファイルだったので、Binwalkの仕事はほとんどなく、ファイルシステムを直接抽出できました。
- [27:19] より興味深いファームウェアファイルはBinwalkでさらに多くを明らかにし、抽出可能なファイルシステムや、おそらく誤検出と思われるランダムなMySQLデータなどが含まれていました。
- [27:36] Binwalkは多くの誤検出を生み出すため、その出力を盲信すべきではありません。
- [27:40] そのイメージに対してstringsを実行するとU-Bootの文字列が現れ、デバイスがU-Bootを使用していること、そして先に説明した手法がそれに適用できる可能性があることが分かりました。
- [27:55] ファームウェアを抽出した後、注目すべき興味深いものには、更新メカニズム、パスワードや証明書などの秘密情報、VoIPスタックなどの主要バイナリ、隠しコマンドのためのブートローダーなどがあります。
- [28:35] 目標はデバイス上でシェルを取得することであり、その手法にはシリアルコンソールの修正、ブート引数のいじり方、最後の手段としてファームウェアのパッチ適用などがありました。
- [29:03] ファームウェアは署名されているため、グリッチングを試みない限りここではパッチ適用は機能しませんが、グリッチングは非常に困難です。しかし、ファイルシステムにパッチを当ててフラッシュに直接再書き込みするという選択肢はあります。
ARMブートローダーのリバースエンジニアリング
- [29:23] 発表者は、コンソールがなぜ/dev/nullに設定されたのかを理解するためにブートローダーをリバースエンジニアリングする予定です。
- [29:39] ARMのリテラルプールはコードセクション内にある小さなデータの塊で、通常は絶対アドレス、即値、またはマジックオフセットをレジスタにロードするために使用されます。
- [30:00] ARMの関数呼び出しでは、引数はR0からR3に渡され、戻り値はR0に入り、戻りアドレスはLR(リンクレジスタ)に保存されます。
- [30:15] ブートローダーは本物のELFではないため、電話がそれをロードする場所に一致するロードアドレスを見つけない限り、IDAはそれをインポートできません。
- [30:34] ロードアドレスを見つけるには、ブートローダーファイル内のヘッダーや割り込みベクタを調べることができます。ARM CPUは割り込みに特定のアドレスを必要とするためです。
- [30:58] リテラルプールは絶対アドレスや文字列へのポインタを含んでいるため有用です。文字列が文字化けしている場合はアドレスが間違っていることを示します。
- [31:15] このケースでは、ブートローダーが起動時にジャンプメッセージを出力し、IDAが文字列を正しく表示していることから正しいロードが確認できたため、アドレスは簡単に見つかりました。
- [31:41] ブートローダーをIDAにロードした状態で、発表者は「EEPROM read successful」などの文字列を検索し、クロスリファレンスを使って処理関数を見つけます。
SPI EEPROMとブートローダーコンソールのパッチ適用
- [31:54] このボードのEEPROMはSpipromと呼ばれており、SPIは先に述べたプロトコルの一つです。
- [32:00] EEPROMは小さなメモリであり、SPIプロトコルは約4本のワイヤを使用し、CPUがコマンドを送信してEEPROMが応答します。
- [32:12] ロジックアナライザのダンプは、実際のSPIトラフィックがどのようなものかを示しており、EEPROMのデータシートはそのラベルをグーグル検索することでオンラインで見つけることができます。
- [32:27] データシートの左下のピン配置はEEPROMへの接続方法を示しており、右側にはどのオペコードがSPIコマンドにマップされるかが記載されています。例えば3は読み取り、2は書き込みです。
- [32:48] IDAとブートローダーでは、コンソールはDev nullに設定されていますが、その上にある関数でコンソールをUART 0またはUART 1に設定することができ、私たちはそれらの文字列が出力されることを望んでいます。
- [33:08] その関数はスタック上のいくつかのバイトをクリアし、マジックアドレスから読み取り、読み取ったバイトを比較し、値が適切であればコンソール設定をDev ttyAMA0に出力します。
- [33:36] EEPROM読み取り関数は、EEPROM読み取り失敗と表示する緑色でハイライトされたログのおかげで簡単に見つかりました。そうでなければ、3を送信するSPI関数を探すこともできました。
- [34:05] SPI関数を見つけるのは困難です。なぜならメモリマップドIOのマジックアドレスを使用しているからです。CPUのデータシートがあればアドレスが指定されていますが、なければ推測するしかなく、それは非常に困難です。
- [34:49] 計画は、読み取りと書き込みのコマンドを把握し、フラッシュとインターフェースを取りたいと考えている状態で、コンソールを構築できるようにEEPROMにパッチを当てることです。
ワイヤのはんだ付けとUARTルートシェルの発見
- [34:59] EEPROMに接続するSPIデバイスとしてBus Pirateが選ばれました。
- [35:09] チップはクリップを使うには小さすぎ、オンラインの治具は高価で五週間待ちだったため、彼は小さなワイヤをはんだ付けしてみました。
- [35:22] 彼ははんだ付けがうまくいくことはないだろうと思っていましたが、実際にはうまくいきました。
- [35:30] Bus Pirateのコードは非常に定型文的で、画像で置き換えるよう求められたマジック値を使用しています。
- [35:45] コンソールはrootに設定されましたが、スペースを押したり入力しようとしても入力はまだ機能しませんでした。
- [36:15] 彼はUARTパッドにマルチメータで導通テストを行い、どこにつながっているかを追跡しました。
- [36:26] UARTのトレースはボードの反対側へ行って戻ってを繰り返し、最終的にキー付きRJ45 MODポートの下を通っています。
- [36:54] FTDIケーブルの送信線にジャンパケーブルを当て、コンソールキーを押しながらピンを一つずつ突くと、二番目のピンでrootシェルが得られました。
イーサネットケーブルのハックとルートシェル
デバイスの偵察とDHClientの発見
- [37:40] コンソールが溢れるとウォッチドッグがデバイスを再起動するため、プロセスを強制終了するマジックコマンドが隅にハイライトされています。
- [37:53] 脆弱性調査は、実行中のプロセスと開いているポート(新しいsequel関連を含む)を調べることから始まります。
- [38:11] IDAを使う代わりに周りを探っているうちに、発表者はDHClientに注目しました。
- [38:16] DHClientを実行すると2007の著作権表示が現れ、発表者はこれを良いことではないと指摘しています。
- [38:20] DHClientを単独で実行するとセグメンテーションフォルトが発生します。
- [38:25] 正しい方法で実行すると、DHClientはデバイス上でより良く動作するように変更されたというデバッグメッセージを出力します。
DHClient DHCPオプションのスタックオーバーフロー分析
- [38:40] Jon Oberheideは約10年前に、その特定のDHClientバージョンに対するDEFCONのエクスプロイトを発表しました。
- [38:51] この電話機はDHCPオプションの処理中にスタックオーバーフローに対して脆弱でした。
- [38:56] DHClientはオープンソースであるため、スタッククッキーやASLRといった緩和策を念頭に置きつつ、元のソースコードとパッチ適用後のソースコードを比較できます。
- [39:11] 脆弱なコードではmemcpyがdata.lenをフィールドとして使用していますが、パッチ適用後のバージョンでは4によって境界が設定されています。
- [39:21] バグはサブネットマスクの処理にあります。サブネットマスクは4バイトであるべきですが、DHCPオプションは約255バイトまで送信でき、それが無条件に信頼されていました。
- [39:34] IDAでは実際の関数にスタックカナリアがなく、マジック4も使用されていないため、依然として脆弱であり、悪用は簡単です。
- [39:48] 電話機のOSであるTDSに取り組むにあたり、講演者はQEMUエミュレーションをセットアップすることを計画しました。
QEMUフルシステムによるDHCPデバッグ
- [39:52] QEMUはARM向けにユーザーランドエミュレーションまたはフルシステムエミュレーションのいずれかを行うことができます。
- [39:58] DHCPはIPの変更を試みることを伴うため、ここではユーザーランドエミュレーションは機能しません。
- [40:02] 代わりにフルシステムエミュレーションを使用し、セットアップのチュートリアルに従いました。
- [40:11] DHCPと連携するためにネットワークを適切に設定する必要があり、QEMU内蔵のDHCPは避けました。
- [40:29] QEMUで実行しても依然としてセグメンテーションフォールトが発生しました。Avayaが変更を加えたことがセグメンテーションフォールトの原因であることが判明しました。
- [40:38] このアプリは名前付きソケットを作成し、VOIPスタックがDHClientと通信してオプションを表示できるようにします。
- [40:56] 左側は起動時にDHClientを設定するためのデータを送信し、右側はPythonで再実装されました。
- [41:00] Pythonスクリプトはホスト上で実行され、Socatを介してQEMUイメージと名前付きソケットを共有します。
ScapyとシェルコードによるDHCPエクスプロイト
- [41:23] 元の概念実証は非常に古いツールを使用していたためコンパイルできず、Scapyベースのエクスプロイトに切り替えました。
- [41:32] Scapyはネットワークパケットを低レベルで操作するためのPythonライブラリです。
- [41:47] バグはサブネットマスクオプションにあり、これはDHCPのタグ・長さ・値形式を使用します。DHCP仕様にもかかわらず、4より大きい長さを送信しても受け入れられます。
- [42:12] ペイロードはパターンデータ(AAAA、BBBB、CCCC)を含むサブネットマスクオプションを送信するため、GDBでクラッシュした際に制御されているレジスタを特定できます。
- [42:33] 彼らはPC(プログラムカウンタ)の制御を確認し、実行の制御を獲得しました。
- [42:47] スタックは実行不可能に見えるため、シェルコードは別の方法で作成する必要があります。
- [42:57] バイナリ内にシステムコールが存在し(おそらくAvayaによって追加されたもの)、R4が制御されているため、既知のアドレスに文字列を配置し、そのアドレスをR4に入れることで機能する可能性があります。
- [43:12] DHClientはサーバーから設定値を受け取るため、値はどこかに保存されている可能性があります。ASLRは無効になっています。
- [43:27] Aで埋めたオプションを多数送信し、メモリを検査することで、最終的にドメインオプションを介して文字列を発見しました。
電話機の悪用デモと緩和策
- [43:49] 電話機が起動中で、左側に10分のウィンドウが表示されています。
- [43:53] 左側では悪意のあるDHCPクライアントがペイロードから実行され、右側ではWebサーバーがポストエクスプロイト機能を提供しています。
- [44:02] 画面で/dev/randomをcatすると、パケットが動作していることを確認するためにノイズのような出力が生成されます。
- [44:07] 電話機はWebサーバーからデータを取得し、講演者の上司であるSteveにちなんで名付けられたsteve.dataというファイルを読み込みます。
- [44:24] メインスピーカーから音声が外部に送信され、攻撃者のラップトップ上でVLCを介して聞くことができ、電話機が盗聴デバイスになります。
- [44:49] Netcatやオーディオ減光ツールなど、使用されるすべてのツールはすでに電話機上にあり、シェルまたはbashスクリプトのみが必要です。
- [44:58] 緩和策として、バグが奇妙なトラフィックを送信するのを防ぐためにネットワークを監視してください。
ネットワークセグメンテーションとパッチ適用のアドバイス
組み込みシステムに関する結びの言葉
[0:00] >>前置きはこれくらいにして、予定通りに進めます。フィリップがここに来ています。ええと、ポートランドから、ええと、私の理解ではフランス経由で来ています。そして彼は、ええと、組み込みデバイスへの侵入について、電話機を含めて、ええと、職場の机にあるかもしれない電話機、ええと、そこまで話すつもりはありませんが、周りにあるかもしれない電話機について話してくれます。組み込みデバイスのハッキングについて学びましょう。フィリップに大きな拍手をお願いします。[拍手]。楽しんでくださいね。>>ありがとうございます。皆さん、ありがとうございます。ええと、ここに来られて本当に興奮しています。大きな名誉ですし、ええと、はい、今日はハードウェアハッキングについて話します。ええと、その入門をお見せしますし、ええと、ハードウェアハッキングへの愛情をお見せできればと思います。ええと、私は誰でしょう?私はPhilippe Laulheretです。ええと、McAfeeのAdvanced Threat Researchのシニアセキュリティリサーチャーです。ええと、私はソフトウェアとハードウェアの電話機の研究をしており、TwitterではPHLaulで見つけられます。McAfeeの前は、ええと、組み込みセキュリティに2年間携わり、その前はC++開発者でした。ですので私は
[1:03]、いや、ソフトウェアのバックグラウンドから来たわけではないんですよね。なので、そもそもなぜハードウェアハッキングに気を遣うべきなのか、と思うかもしれませんよね?ええと、主な理由は二つあると思います。一つ目は、自宅でも職場でもどこでも、手元にあるデバイスをこじ開けて、壊して、開くことができるのは、実際とても楽しくて力が湧くことだということです。それをブラックボックスと見なす代わりに、突いてみて、どう動いているのかを理解し始められるわけです。そしてもっと実利的な話をすると、ここ数年のセキュリティを考えると、ソフトウェアはどんどん破るのが難しくなっています。例えば、メディアデバイスでもウェブサーバーでも何でもいいですが、ウェブサーバー自体の脆弱性を見つけるのは結構大変です。それに対して、デバイスを開けて、配線を二、三本はんだ付けして、そこからシェルを取るだけなら、ずっと簡単です。なのでハードウェアハッキングは素晴らしいんです。基本的に低くぶら下がっている果実がたくさんあるからです。では今日は、Avayaの電話、特に9について話します。スライドの右側にある電話の写真は9611gモデルです。Avayaは最大級のVoIPの一つで
[2:08] ソリューションプロバイダーの一つで、至る所で見かけます。GoogleはFortune 100社の90%で、この特定の電話機種は2006に始まり、年末あたりに寿命が来ると思います。そして面白いことに、スライドの右下には、これらの電話の非常に古いソフトウェアファームウェアのページからの面白いスクリーンショットがあります。そこでは、その特定のファームウェアをダウンロードできるのはDODの顧客だけであることがわかります。つまり基本的に、これらの電話が多くの異なる場所に渡っていることがわかります。さて、先行事例についてです。ハードウェアハッキングでは、今日では多くの情報がインターネット上にあり、ブログ記事やチュートリアルをたくさん見つけられます。いつもHardware Hacking Villageがあるので、ぜひ見に行ってください。CTFもあり、よりソフトな側面を練習できます。スライドの最後にはたくさんのリンクがあるので、後でスライドをダウンロードできます。また、アップロードしたスライドにはより多くのテキストが載っています。なので
[3:11]、もっと独立した形です。もっと読めますし、そう、セキュリティで読んだのですが、同じ電話で2個のRCを見つけたんです、五年前くらいですかね、RSAでStepping P3wnsという講演をしていて、それもオンラインで見ることをお勧めします。では次の40分間、ハードウェアハッキングについて話し、その電話をその会話を支える土台として使います。そして基本的にこの状況全体のアイデアは、ええと、12年ほど前、おそらくFoxとオープンソースコード経由で、そしてセキュリティパッチを一切適用していなかったということです。そして、私がデバイスを突いてみてそれが見つかったわけで、10年間ほど気づかれずにいて、実際には10年前にDefcon向けに公開されたCVEがあったんです。なので、そのファームウェアの中にあった、ある種の馬鹿げた、いわゆる神のようなものが見つかった経緯について話します。でももっと面白いのは、そのプロセス全体、つまりどうやったのか、なぜそうしたのかについて話すことだと思います。なぜ?あ、失礼。
[4:15] なぜその時にやったことをやったのか、つまりプロセスを共有することです。また、試したことがうまくいかなかった場合や、うまくいかなかった選択についても共有します。あるデバイスでうまくいくことが別のデバイスではうまくいかないかもしれません。何ができて何ができないかというメンタルモデルを持つことは、あらゆるデバイスに取り組む際に大いに役立ちます。この講演から人々に持ち帰ってほしいのは、手持ちのデバイスを調べるプロセスを学ぶことです。そして、私にできるなら、この部屋の誰もができると強調したいです。言ったように私はソフトウェアのバックグラウンドが主で、ハードウェアハッキングはまだ少し怖く、少し馴染みが薄いですが、結局のところ、良いプロセスと忍耐があればそれほど難しくありません。さて、このプロジェクトはどう始まったのか。正直に言うと、職場で働いていて、すべての机の上にこの電話が置かれているのを見ました。「待って、これらの電話はLinuxで動いていて、ネットワークアクセスがあり、
[5:17] マイクとかそういうのは、どれくらい、どれくらい安全なのか?ええと、知ってるでしょ、こう、気になるよね、これってどうなってるの、人々はこれのセキュリティを考慮したのか?だから、ええと、最初のステップは、まだ同僚の電話を盗んで分解する前の段階で、まあ、だいたい[聞き取れず]、FCCのウェブサイトをチェックできるんだ。普通、Wi-FiやBluetoothを搭載したデバイスは、コンプライアンス上の理由でFCCのウェブサイトに載っていなきゃいけない。だから、それが見つけたものだ。ええと、それは私の電話じゃない。同じブランドの別モデルで、基本的にかなり近いものだ。だから、こういうクールな写真が全部見られる。でももっと面白いのは、電話の内部だ。ええと、それで見ることができて、左側と右側、赤で、ええと、このランダムなデバッグコネクタをハイライトした。何なのかはわからないけど、そこにあるのを見るのは面白い。そして右側には、ええと、あの、紫で、あのフラッシュメモリがある。だから、普通はそこに電話のファイルシステムが保存される。そしてその全体の目的は、実際のターゲットにアプローチする前に、何を期待すべきかのアイデアを得ることだ。ハードウェアを構築したりとか。だから、ええと、簡単なターゲットになるのか、難しいターゲットになるのか、わかるんだ
[6:23] ええと、もし全部が黒いエポキシで覆われていたら、それはもっと難しいだろう。だからもう一つの重要なステップは、ええと、オンラインの資料を入手することだ。例えば、ええと、マーケティングのパンフレットとか、そうすれば電話の機能やその周辺のエコシステムについてのアイデアが得られて、攻撃対象領域のアイデアも得られる。それにユーザーマニュアルなんかも見つかる。例えば、すごくクールなものを見つけた。上級ユーザー向けのマニュアルで、こう書いてある。電話へのシリアル接続が欲しければ、あの変わった箱が必要だよ、と。ええと、それは興味深い。シリアル接続があることがわかるし、そのためには特別なハードウェアが必要だったかもしれない。でも、それは後で少し見るだろう。ええと、その後、フォーラムもチェックしたくなる。ええと、そうすれば他のユーザーが何をしているかわかる。例えば、電話のデバッグインターフェースのデフォルトパスワードを見つけた。ええと、システム管理者の。だからここで、ええと、それについてオンラインで話している。ええと、運が良ければ、ダウンロードもできる。もっとアイデアが欲しければ、ええと、何があるか。そして次に
[7:23] それをすぐにカバーしよう。オーケー、ええと、では今何をするか。ええと、内部がどうなっているかのアイデアは得た。これはハードウェアハッキングの話だ。だからボランティアを提供する。要点は、まず電話を開けることだ。ええと、コツは、普通は中に同じものが入っていると期待するということだ。ええと、部品のラベルを見れば、ええと、グーグルで検索すれば、それが何かわかる。例えば、これは私の電話で、ええと、CPUの中心が見える。その上にRAM、ラベンダー色っぽい色で、いくつか未実装のヘッダーがあって、疑問符でマークした。これは、同じように、前に写真で見ていたものだと思う。JTAGかもしれないが、使う必要はなかった。だから実際はわからない。ええと、適切に、EEPROMがあり、それは設定とかが入っている。ええと、スライドの下部の濃い青は、キー付きRJ45だ。それを見たとき、ちょっと混乱した。用語すら知らなかった。アイデアはただの普通のRJ45、インターネットプラグのようなものだが、変なコネクタが付いていて、間違ったものを差し込めないようになっている。ええと、もっと面白いのは
[8:26] 黄色で、UARTだ。UARTはシリアルコンソールのようなもので、ええと、こういう専門家のパッドがある。普通は製造時などにポゴピンがパッドに接続される。ええと、これは実際とても興味深い。なぜならシリアルコンソールが見つかるはずだから。裏側には、前の写真で見たNANDフラッシュがある。ええと、そこがファイルシステムが保存される場所だ。オーケー、内部を見た。ええと、他に興味深いのはテストポイントとデバッグヘッダーだ。ええと、基本的にそういう部品にあるもの全部。なぜ内部にあると思うかと問える。いくつか理由がある。一つは、普通、開発ボードが製造ボードと同じで、他のデバッグ部品を外さないかもしれない。ソフトウェアでデバッグシンボル付きでビルドした場合と同じだ。ええと、また製造プロセスの一部として、テストポイントなどがフラッシュに使われるかもしれない
[9:30]、デバイス、あるいは正しくフラッシュされていることを確認することです。そして時には、実世界で何かが壊れることがあります。そして何が起きたのかを理解するために事後分析をしたいと思うものです。それも役に立ちます。では、そういう状況でどんなものを探すべきでしょうか?先ほど見ていたUARTを見ます。これから一分ほどで扱うJTagも見ます。そして、基板のあちこちに、テーブルのあちこちに、ただ鎮座しているランダムなテストポイントもあります。TP1、TP2などとラベル付けされた長いテストポイントがあるかもしれません。それが興味深くないこともありますが、時には興味深いものを見つけることもあります。例えば、TP64をグラウンドとショートさせるとデバイスがリセットされる、というのはある程度役に立つかもしれません。ではUARTを見ると、先ほど言ったようにシリアル接続用です。3ピンか4ピンで来ます。3ピンはグラウンド、送信、受信です。四本目はDCCで、3ボルトとか5ボルトとかです。普通はそれは気にしませんし、差し込む必要もありません。そして、知っておくべきコツは、シリアル
[10:36] コンソールが異なる速度でデータを送信します。そしてそれはボーレートと呼ばれるもののうちのほんのいくつかしかありません。そして一般的なボーレートの値はほんのいくつかしかありません。ですので、もしあなたのシステムをUARTに接続して、画面上に意味不明な文字が表示されるだけなら、おそらく原因はボーレートが間違っていることであり、考えられるすべてのボーレートを順番に試していけば、最終的には何か見つかると思います。さて、JTAGはもう一つの興味深いものです。これはハードウェアデバッグのためのもので、通常はCPUをデバッグし、命令ごとに実行するなどの方法です。そして、それはさまざまな形やピン数などで存在します。スライドの下部にいくつか例がありますが、実際に興味深いのはほんの数本のワイヤーだけです。そしてスライドの最後にJTAGをよりよく理解するための記事へのリンクがあります。しかし基本的に、スライドの右上を見ると、開発ボードがあり、そこに素敵なJTAGコネクタが接続されているのが分かります。一方、右下には、私が
[11:38]、見ていたのは、JTagがあるはずなのに、一度もはんだ付けされたことがなく、そのため直接はんだ付けしなければなりませんでした。ここで覚えておくべきコツは、自分でコネクタをはんだ付けする場合、プルアップ抵抗やプルダウン抵抗と呼ばれる追加の抵抗を付けて、一本のピンをグラウンドやVCCに接続する必要があるかもしれないということです。その目的は、実は目的は知らないのですが、それがないと正しく動かないか、ほとんどの場合もっと手間がかかり、不安定になるからです。そして、例えばARMの仕様などで必要な抵抗についての指示に従うなら、それらを省くこともできますが、なぜ時々奇妙にめちゃくちゃになるのかを理解するのに時間を浪費するかもしれません。なのでプルアップ抵抗とプルダウン抵抗をお勧めします。これは同僚が見ていたランダムな基板で、私が言ったことが実際かなり一般的だということを示すためです。左側にはUARTがあります。右側にはJTagコネクタがあります。上にあるのは、主なCPUで、シールドの下にあります。そして通常、それは干渉を防ぐために行います。なので
[12:43] それはWi-Fiモジュールなので、そういうわけです。そして知っておくと良いのは、通常シールドは接地されているということです。ですので、グラウンドを探している場合、その種のシールドや、イーサネットポートの周りのケーシングなども実際にかなり役立ちます。さて、内部を調べる方法を学んだので、次に内部とインターフェースするために必要なハードウェアを知る必要があります。そこで、重要なクールなハッキングツールセットをいくつか紹介します。最初のものは、このピンやステッカーかもしれません。ご存知か分かりませんが、実際に本当に重要なのは安全です。壁にプラグを差し込んだままのものでは作業しないでください。プラグを抜くことを忘れずに、換気の良い部屋で作業することが重要です。そして、ハードウェアをいじるときに馬鹿なことをしないでください。次に、ラボからの写真で、私ははんだごてを持っています。通常、大きなはんだ付け用の大きなチップと、小さなはんだ付け用の小さなチップを交換できます。顕微鏡を持っているので、小さなはんだ付けをするのに非常に便利です。そしてコツは、私はコーヒーをたくさん飲む傾向があり、手が震えるので
[13:47] 私は「そんなことはできない」と思っていましたが、実際には、慎重にやれば、コツは本当に一生懸命に、ええと、はんだ付けをするときに腕をまっすぐにしてしっかり固定するようにすることです。そして顕微鏡の下では、自分ではできないと思っていたようなこと、やってはいけないと思うようなことでも、実際にはたくさんできるんです。[息を吐く]、すみません、ええと。右上は、ええと、実は小さなはんだ付けに使われるもので、右上の真ん中あたりはフラックス、いわば魔法の接着剤、魔法の、ええと、べとべとした、表面実装やパッドを始めるときにピンに塗る物質で、うまく機能するようにするものです。だから、フラックスを決して忘れないでください。ええと、下は、ええと、同じくらいのサイズの、ええと、銅線、通常はコードを作るときに使う、無線機などに使うような、ええと、エナメル線のようなものです。ええと、コツは、そのワイヤーは実は、ええと、ワニスでコーティングされているので短絡しないということです。それを使って、本当に小さなポイントツーポイントの、ええと、はんだ付けができて、それは実はとても便利です。そしてそのすぐ隣には、ええと、
[14:48] はんだ吸取線です。つまり、考え方としては、はんだを盛りすぎて失敗した場合、失敗したはんだの塊の上に吸取線を置き、その上にはんだごてを置くと、すごく熱くなるので、プラスチックのケース越しに持つようにすると、余分なはんだを全部吸い取ってくれます。そして、自分のものをきれいにできます。それから、ランダムな、ええと、ジャンパーワイヤーの写真を載せました。これは、あると、あるいはたいてい、いつも役に立つものです。そして右下には、あのすごい熱風、ええと、ガンがあります。ええと、Home Depot で60ドルくらいです。これは、塗料を乾かすのを助けるためのものか何かで、よくわかりませんが、実はチップの上にいるとき、部品を加熱して引っ張るだけで取り除きたいときに、とても役に立ちます。ええと、もっとクールなハードウェアといえば、ええと、それはマルチメーターです。ええと、それに馴染みがないなら、知らないチップの電圧を、実際の電圧は何なのかを簡単に見つけられます。黒をグラウンドにつなぎ、赤で、ええと、白でおそらく選択して、ええと、電圧を測るためにあちこち探ります。そして本当にクールなのは、導通モードに設定できて、二つのプローブの間に接続があると、ビープ音が鳴ることです。なので、もしあなたが
[15:51] 先ほど説明したような、お粗末なはんだ付けをした場合、両側が実際にビープ音を鳴らすことを確認するなどして、すべてが思った通りに接続されていることを確かめられます。そしてそれは実はかなり便利な、ええと、ツールです。もう一つは、これはロジックアナライザーです。ええと、名前はサリーのような、ええと、それはブランドです。考え方は、ソフトウェアと同じで、プロセス間で通信する方法があるように、ハードウェアでも、チップ間やCPUとチップの間で通信する方法があります。そして、ええと、多くの異なる標準、異なるやり方があります。しかしロジックアナライザーはそれらの多くを知っていて、ワイヤー上を流れるたくさんの信号を実際のデータに変換します。そしてそれは実はとても便利です。それはあなたの目になるようなもので、ええと、デバッグをしているときに、わかりますよね。
[16:32] そしてそれは、何かのランダムなプロトコルでスパイする、ええと、SPI通信のスナップショットのようなものです。ええと、それはFTDIケーブル、ええと、シリアルケーブルでもあり、さまざまな形などがあります。考え方は、ええと、UARTをやりたいときに、それをラップトップに接続し、ユーザー側をUARTポートに接続すると、コンソールが得られ、シリアルポートとして表示されます。そして、ええと、例として、右下に、ええと、ラズベリーパイがあり、実際にシリアルコンソールにアクセスでき、それとインターフェースするのにHDMIケーブルなどは必要ありません。ふぅ。ええと、バスパイレーツも、ええと、クールなデバイスで、ええと、それは、ええと、ハードウェアハッキングに依存するようなもので、ええと、すみません、ええと、サリーのロジックアナライザーと一緒で、データを吸収する代わりに、データを送信するようなもので、たくさんの異なるプロトコルを話し、Pythonでプログラムできます。だから、フラッシュを読み取ったり、ええと、マイクロコントローラーをプログラムしたりするようなことに非常に便利です。ええと、私が扱ったもっとクールなもの。私はJTagについて話していました、それはJTagデバッガーで、実際にDigitechポートを接続する場所です。それらは
[17:38] は、ええと、価格帯などがいろいろあります。右下はハエ叩きで、たぶん30ドルくらいだと思います。それなりに使えます。その上は J Link で、もっと高級です。考え方としては、高価なものほど、おそらく信頼性が高いということです。より良いソフトウェアなども付いてきます。そして右下のピンクの本体は JTagulator で、あのバッジを作ったのと同じ Joe Grand が後で作ったものです。本当にすごいです。つまり、その基板があって、たくさんのテストポイントがあるまで何なのかわからないけれど、どこかに JTag があるに違いない、でもどこかはわからない、という場合です。すべてのテストポイントを JTagulator に配線するだけで、総当たりで全部見つけようとします。本当にクールです。ええと、それらは重要で、興味深いツールです。ええと、フラッシュリーダーです。通常、フラッシュの内容、フラッシュはファイルシステムなどです。ええと、それとインターフェースを取りたいわけです。ええと、二つの種類があって、たぶん、インサーキットのやり方ができます。チップに付ける小さなクランプか、小さな長方形のクリップをかけるものがあります。ええと、Raspberry Pi はそれに良いものです。そして
[18:42] 右上は、フラッシュキャットのようなもので、ええと、長方形のものに役立ちます。ええと、でもチップを実際に取り外すことも選べて、その場合はソケットアダプターのようなものがあります。チップをクリップして、それをフラッシュキャットなどに差し込めば、読み取ってくれます。そして、なぜ、何が、私の、何が、なぜそれが重要かは、両方ともすぐに説明します。そして最後に、ええと、最後の、ええと、希望のようなものです。たとえば、ええと、フラッシュが暗号化されていて、UART がなく、ファームウェアもないとします。そうすると、もっとクレイジーなこと、たとえばフォールトインジェクションなどの攻撃を試せます。つまり、ChipWhisperer は、より難しい、よりワイルドなデバイスです。その考え方は、ええと、CPU に配線して、CPU の電源をほんの一瞬落とすと、いくつかの命令が乱れて、チェックなどをバイパスできるというものです。それが、人々がゲーム機のハッキングなどに使うものです。ええと、では今、何をするのでしょうか。ええと、電話の中に何があるか、そして、ええと、使えるツールについての考えができました。ええと、三つだと思います
[19:47] は潜在的な道筋を投稿しています。一つは UART、つまりシリアルコンソールをいじること、もう一つはフラッシュをいじってファームウェアか何かを復元しようとすること、そしてオンラインでファームウェアをダウンロードできるかもしれません。そして三つは有効なアプローチで、時には一つから別のものへ、また別のものへと移るのが良く、何かハードウェアを見つけたら、一つから別のものへと移れます。ええと、それで私はまず UART に取り組みました。FTDI ケーブルを、以前やっていた UART ポートにつなぐと、これが迎えてくれます。ええと、左側に、ええと、コンソールのものが、点々々のように見えます。通常、これを見たらスペースかエスケープを押すと、電話の起動プロセスを中断できます。そしてその状況で、ええと、しかしここではどういうわけかうまくいきませんでした。そして、その理由はすぐに説明します。そしてスライドの右上では、ええと、EEPROM から何かを読み取ってから、コンソールを Dev null に設定することにしたのがわかります。コンソールを Dev null にしたくはありません。なぜなら、どこにも行かないからです。しかし、そこに何か可能性があることを知るのは興味深いです。そして最後に、次に起動しているので、それがユニークなポートであることを確認できますが、その後、ええと
[20:48]その後は何もありません。ええと、良い点も悪い点もあります。問題は、Linuxがそうなった後、何も表示されないことです。おそらくDev nullの状況のせいでしょう。そしてキーを押すと話しているのですが、ええと、なぜそれが起こったのかを説明します。ええと、その時点ではまだ、わかった、どこにも進めないと思っていました。それでファームウェアを復元して、何が起きているのか理解しようとしました。ええと、ファームウェアを復元する方法は複数あり、ええと、簡単な方法としてはオンラインでできるものがあります。そして実際それはうまくいきました。ええと、その簡単なスナップショットがあります。ええと、時には暗号化されています。私たちの場合はそうではありませんでした。ええと、でも、そうです。ええと、ファームウェアのアップデートをスニッフィングすることもできます。それは一般的にIoTデバイスに非常に役立ちます。そしてネットワークタブを使えます。これはスライドの右上に描かれているものです。ええと、あるいはスイッチなどでポートをミラーリングすることもできます。ええと、そのすべての問題は、ファームウェアのアップデートがしばしばHTTPS経由で行われることです。あるいは、この場合は行き詰まってしまいます。そしてその場合は、もっとハードウェアハッキング的なことをする必要があり、例えばフラッシュをダンプすることになります。そして、
[21:48]さらに高度なテクニックについて、ええと、簡単にお話しします。では、どうやってフラッシュをダンプするのか?先ほども触れましたが、方法は二つあります。インサーキット・プログラミングと、ええと、アウト・オブ・サーキットです。インサーキットはクールです。なぜなら、部品を外したり壊したりする必要がないからです。でも、いくつか問題があります。ええと、主な考え方は、フラッシュを読むにはフラッシュに電源を供給する必要があるということです。そして、もしそれがまだシステム全体に接続されたままだと、ええと、例えばラズベリーパイでフラッシュを読もうとすると、同じ電源ラインに接続されている他のすべてに電源を供給しようとします。そして、ええと、USBのパイはVoIP電話に電源を供給するほど強くないでしょう、普通は。その場合、ええと、単に動きません。あるいは、ラズベリーパイが本当に強力でそれをやってのけるかもしれませんが、その場合の問題は、CPUが起動を停止し、フラッシュと通信して、それがあなたのものを台無しにしてしまうことです。そういう状況では、通常二つの選択肢があります。ピン、ボールピンを持ち上げて、それが起きないようにするか。あるいは、もう少しヒーロー的なアプローチで、CPUをリセット状態に保つかです。私はその方法で何度も成功しています
[22:51] あるいは、基板上のランダムなテストポイントにグラウンドを当てて、何も見つからないことを祈るようなやり方もあります。そして通常、ある時点で気づくんです、ああ、これをやると電話が光る、起動しない、よし、と。そしてチップをはんだ除去するもっと良い方法としては、ヒートガンなどを使うことかもしれません。ただし注意が必要です。なぜなら、強く引っ張りすぎるとピンが曲がってしまい、使い物にならなくなるからです。知っておくと良いトリックは、チップの上に小さなアルミホイルの帽子のようなものを作ることです。そうすれば、チップを加熱しているときに周囲の部品が熱くなりすぎません。つまり、小さな部品を誤って外してしまうことがなくなり、それを元に戻すのは非常に面倒です。そして右下は、私は電話でそれをやらなければならないと思っていました。だからまず練習しようと思って、ランダムなUSBサムドライブを使って試しました。そして実際、それはとてもうまくいきました。でもコツは忘れないことです、フラックスも少し塗りました、それが助けになるからです。そして、ええ、外すときは気をつけてください。このデバイスでは実際にはうまくいかなかった他のトリックもいくつかあります。でも知っておくと良いです。U-Bootは最も一般的なブートローダーで、ここでは使われていませんが、見つけるでしょう
[23:56] それはほとんど他のすべてのデバイスにあります。そしてアイデアは、そのブートプロセスに指示を出すこともできるということで、丁寧に頼めば、ねえ、フラッシュをメモリにロードできますか、と言うと、U-Bootは画面上にHexでダンプすることもできます。メモリを、この方法で、スクリプトに書いてそれを実行し、フラッシュからすべてを復元できます。それは本当にクールです。しかし通常、開発者はそれをさせてくれません。彼らはそのアプローチをロックすると言っていました。だから、スペースを押してブートプロセスを中断することはできません。しかし、私がYoloアプローチと呼ぶトリックもあります。代わりに、そのアイデアは、U-Bootがフラッシュから新しいスキャナーか何かをロードしようとするというものです。しかしそれが起こっている間に、グラウンドに接続されたワイヤーでNANDフラッシュのいくつかのピンをつつき始めると、U-Bootが読んでいるものがめちゃくちゃになり、数回試した後、U-Bootは、くそ、このカーネルは壊れている、どうすればいいかわからない、と言ってシェルを提供してくれます。だからそれは本当にクールです。しかし、ええ、言ったように、それは私たちの電話ではうまくいきませんでした。でも、オンラインで見つけたクールな例としては、誰かが実際にそれをやっていました。そして、下線を引いたのは
[24:59] ええと、下の紫色の部分に、フラッシュをメモリにログするために必要なコマンドがあります。そして右側の二次的なテキストブロックは、すみません、カーネルをどうすればいいかわからないとパニックになってシェルを提供する様子です。それでは、フラッシュをダンプするためのさらにいくつかのトリックですが、JTagを使うことができます。通常、JTagが機能するなら、RAMをダンプできるはずです。この場合、それは実際にはフラッシュをダンプするのではなく、ファームウェアをダンプすることになりますが、多くのデバイスではすべてをメモリにロードするので、メモリをダンプできれば、同じ手段でかなり良い状態です。そしてこれに関する最後の希望です。これはハードウェアハッキングについて私のお気に入りの一つです。クレイジーなことができます。例としては、インターネット上のScanlimeという人が、Wacomタブレットのファームウェアをダンプしたかったのですが、攻撃面が全くありませんでした。彼女は気づきました、USBのものを[聞き取れず]、USBをラップトップに接続すると、いくつかのUSB交換があり、私は
[26:01] 何も知りませんが、USBディスクリプタのように聞こえます。そしてその時点でCPUをグリッチすると、バイナリチェックを見逃し、はるかに多くのデータを送信します。それで彼女はフルフラッシュ、フルメモリか何かを復元できました。それは本当に印象的です。そしてそれがハードウェアハッキングの素晴らしいところです。さて、私の場合はオンラインでダウンロードするだけでファームウェアを復元しましたが、次はどうするのでしょうか?分析したいと思います。そのための最良のツールはBinwalkと呼ばれます。それは基本的に魔法の辞書で、バイナリの塊を見て、うーん、半分のところにzipファイルがあるように見える、抽出してみよう、と言います。試して、実際にzipファイルだったかどうかによってうまくいくかもしれません。そしてそれをすべてに対して行います。また、Squashfs、JFFS2などの圧縮ファイルシステムを見つけることもあります。そして時には、ファームウェアファイルがELFヘッダーやランダムなARMコードで始まることもあり、それを見ることができます。だから私はまだ取り組んでいません。それがファームウェアファイルで、ウェブサイトからはわかりません。
[27:01] そしてもう一度言うが、これはイージーモードで、ただのdocファイルだ。そして彼らはすでにそれをboot 1、boot 2、JFFS2に分割している。だからBinwalkがここでやることは実際何もなくて、全ファイルシステムを抽出するだけでいい。そしてそれはクールだ。なぜならそこから、ちょうどそのまま、電話の中身を見ることができるからね。ええ、でもBinwalkのより興味深いユースケースは、私が[聞き取れず]電話用の別のファームウェアファイルを取ってきたことだ。そしてこちらの方がはるかに興味深い。なぜならBinwalkが、はるかにたくさんのものを見つけるからだ。そしてええと、私はハイライトした。ファイルシステムを見つけて抽出できる。そしてランダムなMySQLっぽいものもあって、それは誤検知だと思う。そして誤検知がたくさんあることに注意する必要がある。だからBinwalkが言うことを盲目的に信じてはいけない。そしてええと、私が見ていて本当に本当に面白かったのは、その特定のイメージに対してstringsを実行すると、U-Bootの文字列が見つかるんだ。だからそのファームウェアはU-Bootを使っていて、私が前に説明したクールなことは実際にそれで動くんだ、ほら。さて、ファームウェアファイルを抽出したところで、何を探したい?最も興味深いものの一つは、更新メカニズムを見つけることだ。だから暗号化されたファームウェアがあると仮定すると、
[28:04] それをリバースエンジニアリングすれば、鍵や、ハードウェア的なことを一切せずに後続のファームウェア更新を抽出する方法が見つかるかもしれない。そして次に探したいのは、パスワードや証明書などのシークレットだ。ええと、もともと私の目標はメインバイナリを見ることだった。つまり、VoIPスタックを扱うものだ。それを見るのは理にかなうかもしれない。そしてええと、ブートローダーも見たい。なぜなら隠しコマンドがあるかもしれないし、なぜコンソールが動かないのかを説明してくれるかもしれない、そういうことだ。だから覚えておいてほしい、これらすべてのポイントは、デバイス上でシェルを取得したかったということと、そのプロセスは何かということだ。だから私が狙いたいのは、シリアルコンソールを修正することだ。ほら、Dev nullはクールじゃなかった。ええと、でももう一つのアプローチはブート引数をいじることだ。ええと、ここでは明らかに動かない。うーん、でも欲しいコンソールを指定できるし、uniscriptをマークして、ああ、Bin bashをuniscriptにしたい、とすればコンソールが得られる。ええと、そして私が検討していた最後の手段的なものは、ファームウェアにパッチを当てることだ。我々の場合、ファームウェアは署名されている。だからええと、グリッチを試みない限りそれは動かない。グリッチは本当に難しい。
[29:08] しかしファイルシステムにパッチを当てることも試せる。BinwalkがJFFS2のものを抽出する方法で、それを変更してから再パッケージし、フラッシュに直接書き込むことができる。そしてそれは通常正確で、ほとんどの場合うまくいく確実な方法だ。だから代わりに、私はブートローダーをリバースするつもりだ。ええと、そのために、なぜDev null、コンソールがDev nullに設定されていたのかなどを理解したかったからだ。私は非常に詳細にカバーするつもりはなく、すべてをカバーしているAzeria Labsのチュートリアルをチェックすることを皆さんにお勧めする。ここでただ役立つだけだ。ARMにはリテラルプールという概念がある。
[29:44] それはええと、コードセクションの中に、小さなデータの塊が見つかるというもので、通常はレジスタへのロード、絶対アドレス、即値、マジックオフセット、そういったものに使われる。そしてええと、参考までに、関数呼び出しの場合、引数はR0からR3に渡される。戻り値はRVOにある。そして呼び出し元から戻りたいときは、リターンアドレスはLRレジスタに保存される。LRはリンクレジスタの略だ。ええと、そしてここでの大きなトリック、大きな問題は、我々はブートローダーをロードしようとしているということだ。だからそれはええと、実際にはELFではない。だからIDAにインポートしようとしても、IDAはそれをどう扱えばいいかわからない。だからそのためのロードアドレスを見つけて、電話がそれをどこにロードしているかに一致させる必要がある。いくつかのトリックがある。ええと、我々の場合、ロードキーは画面に表示されない、素晴らしい。ええと、そうでなければ、ブートローダーファイル内のヘッダーファイル、ヘッダー、あるいは最近のベクターを見て、特にARM向けに、CPUがリセットや割り込みが起きたときの特定のアドレスを知る必要がある、そういったものを見るといい。そして面白いことに、四角いような、
[30:50] それがどのように設定されているか。だからそれを見つけて、割り込みベクタハンドラのようなものを見つけたら、ああ、これがそのアドレスに違いない、とわかる。そしてええと、最後に、私が言及したリテラルプールは非常に役立つ。なぜなら絶対アドレスを含んでいたり、文字列を指していたりするからだ。だからええと、もし文字列があって、それがめちゃくちゃに見えるなら、おそらく間違ったアドレスを取得している。そしてええと、Quarkslab、なんという大ヒットブログ、チェックすることをお勧めする。だから私が言ったように、我々の場合それは簡単だった。ええと、起動時にジャンプだか何だかを表示する。そしてそれは実際にはWIFIロードだ。
[31:21] そして、ええと、右下の方には、たくさんの、ええと、文字列があって、ええと、文字列を指すアドレスの集まりなんです。ええと、IDAからのシステムスナップショットで、ええと、ええと、プリントされた文字列が全部見えるので、ちゃんと読み込まれていることがわかります。ぐちゃぐちゃになっているわけではありません。よし、これでブートローダーがあってIDAで扱えるようになったので、ええと、文字列を検索したいと思います。ええと、さっき見ていたのは、あの「EEPROM read successful」みたいな文です。なのでIDAのクロスリファレンスを使って、その文字列がどこから来ているのかを見つけて、それを処理している関数を調べられます。ええと、ちなみにですが、EEPROMとSPIについて、基板上のEEPROMはSpipromと呼ばれていて、SPIはさっき話したプロトコルの一つにすぎません。EEPROMはただの、ええと、小さなメモリで、ええと、まあそんなものです。そしてSPI、ええと、プロトコルはただの4本の配線で、ええと、CPUからのコマンドに対するIDとEEPROMの、ええと、返答があって、ええと、これはロジックアナライザを使って実際にどんな風に見えるかを確認したダンプです。ええと、これはEEPROMのデータシートです
[32:22] これはオンラインで、ラベルをググれば見つかります。ええと、すごいのはスライドの左下に、ええと、ピン配置が書いてあって、どうやって接続するかがわかることです。そしてスライドの右側には、ええと、どの、どの、アップコードがSPIコマンドとして送られるかが書いてあります。例えば、ええと、3を送ると、読み取り、読み取りになって、2を送ると、書き込みになります。だからこれは、ええと、知っておくと役立つことですよね?おっと、失礼。ええと、IDAと、ええと、ブートローダーに戻ると、ええと、探していた文字列が見えます。そして私にとって有望なのは、ええと、コンソールがDev nullに設定されているのが見えることですが、その上に、オプションの2を掘り下げることができて、実際に「コンソールをUART 0またはUART 1に設定する」みたいに書いてあるんです。だからこれらのものをプリントさせたいわけです。
[33:08] ええと、それは、その文字列を実際にプリントする関数です。そして、ええと、それがやることは大体、ええと、スタック上のいくつかのバイトをクリアして、それからマジックアドレスから読み取ります。そして、今読んだバイトを、ええと、比較します。良い値が得られれば、実際にコンソール設定で、コンソールを、ええと、Dev ttyAMA0に設定してプリントします。だからそれを起こしたいわけです。ええと、私に聞いてもいいのは、「どうやってそのEEPROM読み取り関数を見つけたの?」ということですよね?それには、ええと、いくつかの方法があります。ええと、私がスクリーンショットで緑にハイライトした簡単な方法は、ええと、右下に、「EEPROM read fails」と書かれたログが見えるので、その関数がEEPROMの読み取りを担当しているとわかります。ええと、でも、もしかしたら、私がこれから見るいくつかは、ええと、変数ほどではないかもしれません。その場合、ええと、さっき言ったように、EEPROMから読み取るには、SPI経由で3を送る必要があると知っています。なので、SPI関数を見つけて、3を送っているのがわかれば、それが何かわかります。黄色でハイライトされているやつです。でも、この種の、ええと、プログラムでSPI関数をどうやって見つけるのでしょうか?ええと、その方法は2つあります。
[34:07] ええと、繰り返しになりますが私の推測では、ログに記録されていたので簡単でした。でも通常、主なコツは、ええと、ええと、マップド、ええと、IO、MMOマップドIOと呼ばれるものがあることです。これはCPU内の魔法のアドレス値のようなもので、そこに書き込むと、実際に、ええと、オートSPIなどでデータが送られます。運が良ければ、CPUのデータシートがあって、それらのアドレスが正確に何かを指定してくれます。運が悪ければ、ええと、推測するしかなく、それは本当に難しいです。そしてその時は、多分何か別のものを探すべきか、あるいは、それに多くの時間を費やすことになるだけだとわかるでしょう。なので今度はEEPROMにパッチを当てて、ええと、コンソールを構築できるようにしたいと思います。行動計画は、読み取り、書き込みのコマンドがわかっているので、ええと、フラッシュとやり取りしたいと思います。そのためには、ええと、ああ失礼、EEPROMには、ええと、ええと、SPI、ええと、デバイスが必要で、それは以前見たBus Pirateが完璧な候補です。そしてチップに接続する必要がありますが、ええと、残念ながら、
[35:09]本当に小さなもので、私が見せたクリップは大きすぎました。オンラインで誰かが作ったリグを買えますが、ええと、高価で、入手に五週間かかります。なので代わりに、私は少し頭がおかしくなって、小さなワイヤーをはんだ付けしようとしました。正直、絶対にうまくいかないと思っていましたが、たまたま実際にうまくいきました。それは最高でした。ええと、フラックスが残っているので、全部クロスのように見えます。ええと、そしてこれがBus Pirate用のコードです。超お決まりの、ええと、ものです。そして、ええと、このマジック値を書き込むと、ああ、すみません、画像に置き換えるように言われていました。でも、ええと、アイデアとしては、その直後にコンソールが、ええと、あなたのR0に設定されたと表示され、コンソールにさらに多くのものが出力されます。それは素晴らしいことです。しかし残念ながら、私はより難しい状況に陥り、入力はまだ機能していません。スペースを押したり入力しようとしたのですが、「rootとして見ますか?」と聞かれ、何も入力しても何も起こりません。「ああ、何が起きた?トレースを切ってしまったのか、データを送れないのか?」ボードがあるので、見てみましょう
[36:09] それを、ええと。それで、これはただ、この物をズームアップしたようなもので、その時私は、ええと、UARTパッドを見て、ミリ単位のもので、どこにつながっているのかをビープ音で探るように始めたんです、ええと、導通テストをたどりながら。そして最終的には右側のいくつかのワイヤーにたどり着いて、ワイヤーというのはボールの片側を反対側につなぐ小さな穴のことです。つまりコツは、UARTを何かに接続する実際のトレースが、ええと、基板の反対側に行って、ああ、行ったり来たりするということです。そしてそれは本当に、ええと、面倒なんです。そして最終的にはどこに行っているのか分からなくなってしまいました。
[36:39]しかし、それはMODポートの下、ええと、キー付きRJ45のようなものでした。ええと、それで、ええと、偵察の側面、偵察の部分を覚えていますか、あの箱があって、「ああ、くそ、それがそれだ」と思いました。それで、またユーロ式のアプローチで、FTDIケーブルの送信側にジャンパーケーブルのプラグを、ええと、持っていました。ええと、それで、あちこち突けるワイヤーがありました。そして反対側では、コンソールでキーを押して何か起こるか見ていました。その間、ピンを一つずつ突いていました。そして二つ目で、実際にうまくいったと思います。そして、ええと、デバイス上でrootシェルに迎えられました。それはクールでした、ええと。しかしコツは、ええと、適切なセットアップの右側で、イーサネットケーブルをプラグに差し込んでいたことです。その時、RJ45のキーがどこにあるか知りませんでした。なので、イーサネットケーブルのプラスチックを削って、押し込めるようにしました。そして、うまくいきました。それは良かったです。
[37:36] ええと、rootシェルが手に入ったので、ええと、たくさんのデバッグ文字列が画面に表示されて、それがうるさいんです。ええと、それで引き金は、プロセスを殺したい、あれは、シャー、コンソールを溢れさせている、という感じでした。ええと、それが起きるとデバイスを再起動するウォッチドッグがあるので、隅に、それを殺すために実行できるマジックコマンドをハイライトしています。それはただのランダムで独特なものです。ええと、それでようやく脆弱性調査ができます。ええと、そして実際にやることは、実行中のプロセスを見て、突き回して、開いているポートを見ることです。ええと、ただたくさんのプロセスがあって、ええと、新しいSQL的なものですが、ええと、そこで全部が面白くなってくるんです。ある時点でIDAで見るのに飽きて、もっと突き回そうと思ったのだと思います。そしてDHClientを見て、ふむ、と思いました。そして本当に面白い部分は、DHClientを実行すると、この2007の著作権表示が見えることです。私は、うわ、それは良いことじゃない、と思いました。そしてDHClientを単体で実行すると、セグフォルトするんです、それは変です。そして正しい方法で実行すると、デバッグメッセージを出して、我々のデバイスでより良く動くように修正した、と言うんです。ふむ、それは面白い、と思いました。それで、もし我々が
[38:36] 振り返って、特定のバージョンを探すと、10年前に、実は、DEFCONで、ええと、Jon Oberheideが、ええと、まさにその特定のバージョンのDHClientに対するエクスプロイトを出していることが分かります。それで、まあ、それは簡単だ、と思いました。ええと、しかしそれが実際にまだ脆弱なままか確認したいです。ええと、その電話は、ええと、DHCPオプションを処理する際に、ええと、スタックオーバーフローを起こすようなものでした。それで、DHClientはオープンソースなので、元のソースコードとパッチのソースコードを比較できます。そして覚えておいてください、スタッククッキー、ASLRなどといった緩和策があるかもしれません。それで左側の脆弱なコードを見ると、赤でハイライトされたmemcpyが見えます。それはdata.lenのようなフィールドを使っています。あるいは我々が置いたパッチ版では、それを4で行っています。つまり考え方は、このバグは、ええと、サブネット、ええと、サブネットマスクとリンクのバグで、サブネットマスクは4バイトであるべきです。しかし、HTPオプションの仕組みでは、ええと、255バイトまで送れると思いますが、送ったものをただ愚直に信頼していたので、それはまずいです。そしてIDAで実際の関数を見ると、ええと、スタックカナリアがなく、そして、ええと、その
[39:39] 左側、右側では、その魔法の4を使っていないので、明らかにまだ脆弱です。それで悪用するのは簡単なものです。ええと、Phone OS TDSに取り組んでいて、QEMUをセットアップしてみようと思いました、ええと、QEMUに詳しくなければ、ARM的なもののエミュレーション、あるいはシステムのミニのようなもので、ユーザーランドかフルシステムのどちらかができます。ユーザーランドはここでは動きません、なぜならDHCPは、ええと、もっとIPを変更しようとするようなもので、それはかっこよくないからです。ええと、代わりに、フルシステムエミュレーションができて、ええと、それらのチュートリアルはそのためのクエリマッチのセットアップ方法を教えてくれます。そしてネットワークを適切にセットアップしたいだけです、ええと、DHCPとやり取りしたいので、当然、ええと、QEMUスタックは自分用のDHCPを提供してしまうので、そうしないようにしなければならず、ええ、という感じです。それでQEMUでDHで実行すると、[聞き取れず]フォルトの後、まだセグフォルトして、ふむ、という感じです。それで分かったのは、Avayaが実際にセグフォルトを引き起こすようなものを修正していたということです。そして、ええと、時間が少し足りなくなってきたので、あまり先に戻りすぎないようにします。しかし、ええと、基本的にはその奇妙なソケットを作っていて、ええと、それは
[40:42] 名前付きソケットです。つまり、VOIPスタックがDHClientと通信してオプションを表示できるメインアプリケーションのようなものです。ええと、アイデアとしては、これがメインアプリケーションで、何をするのか見てみましょう。これはあまり面白くありません。しかし基本的に左側では、起動時にDHClientを設定するためにデータを送信しており、右側ではそれをPythonで再実装しました。ええと、Socatで実行できます。SocatはNetcatのようなもので、より多くのツールを備えたものです。つまり、その名前付きソケットを共有でき、ホスト上でPythonスクリプトを実行し、QEMUのバイナリイメージ上でソケットを実行すれば、それだけで動作します。これでDHClientのデバッグを開始できます。GDBを実行して、実際にバグを実行してみることができます。元の概念実証コードをコンパイルできませんでした。非常に古いツールを使っていて、数時間も経つと、もううんざりだ、疲れた、という感じでした。そこで代わりに、Scapyベースのエクスプロイトを使いました。ScapyはPythonライブラリで、ネットワークパケットをかなり低レベルでいじることができます。そして今、脆弱な部分、脆弱なコードに到達したいと思います。ええと、私は
[41:47] サブネットマスクオプションのバグについて説明していました。DHCPの仕組みは、TLV、つまりタイプ・レングス・バリューのようなものです。つまり、このオプションはサブネットマスクだ、長さはこれ、値はこれ、と言うわけです。そして明らかに4になるはずですが、より多く送っても問題ありません。しかしDHCPの仕様としては。そこでScapyを使ってそれを行えます。ええと、これが私のScapyスクリプトの一部で、ペイロードを適切に設定するのが興味深いところです。基本的にはサブネットマスクオプションを、A、A、A、A、B、B、B、B、C、C、C、Cなどのデータとともに送信するだけです。そうすればGDBでクラッシュしたときに、制御しているレジスタがすべて見え、どのレジスタに影響を与えたいのか、シェルコードのどの部分を変更する必要があるのかが正確にわかります。
[42:33] そして実際に[「pc」、つまりプログラムコンソール]を制御していることがわかります。これは良いことです。エクスプロイトが可能で、実行の制御権を持っていることがわかります。他にもいくつか詳細がありますが、それは省略します。しかし、シェルコードを作成する必要があります。残念ながら、スタックは実行できないようですので、それを回避する必要があります。それは面倒です。しかしクールな点は、システムコールを探すと、そのバイナリにあり、Avayaが追加したものだと思います。そしてR4を制御しています。既知のアドレスにあるメモリに文字列を配置できれば、それがシステムコマンドのような値になり、そのアドレスをR4に入れれば、成功です。ええと、考えてみると、DHCPクライアント、失礼、DHClientはサーバーから設定値を受け取ります。ですからおそらくどこかに保存されるものがあるはずです。そしてASLRが無効になっていることがわかりました。ああ、言い忘れていました。ええと、アイデアとしては、たくさんのオプションとしてA、A、A、Aを送信し、メモリを見てその文字列がどこかにあるか確認するというものです。そして最終的に、ドメインオプション
[43:36] が良いものでした。そして今、実際にすべてを実行したときに何が起こるかというクールなデモをお見せできます。ええと、左側には起動中の電話があります。電話が起動しており、ウィンドウ、10分のウィンドウは、左側が不正なDHCPクライアントで、ペイロードを実行しています。右側はWebサーバーで、侵害後の活動のようなものを提供します。パケットが実行されているのがわかります。動作を確認するために、画面上で/dev/randomをcatしていました。だからノイズのように見えるのです。Webサーバーからデータを取得しており、見えるかどうかわかりませんが、steve.dataのようなものを読み込んでいます。ちなみに、Steveは実際に私の上司です。あれが彼です。[笑い] そしてちょうどその時、まだ、音があるかどうかわかりませんが、メインスピーカーから音声を流出させています。VLCで見ると、私が話したり手を叩いたりすると、攻撃者のラップトップで実際に音声が読み取られています。これはかなり怖いことです。なぜなら電話を、ええと、あなたの
[44:37]ご存知の通り、盗聴デバイスです。[拍手]。ありがとうございます。ええと、ちなみに、私が使ったツールはすべて実際に電話に入っています。Netcatや、音声をSDNにダンプするようなものなど、シェルスクリプト、bashスクリプトなどを書くだけです。ええと、結論として、ええと、緩和策としては、ネットワークを監視して、奇妙なDHCPパケットを送るようなバグがないようにする必要があります。ええと、実際、McAfeeの、ええと、ファイアウォールはそれを検出できます。ちなみに、ネットワークを分離して、例えばコーヒーポットが電話に奇妙なDHCPパケットを送れないようにする必要があります。そして、ITが実際に電話にパッチを当てるようにしてください。なぜなら、ええと、パッチノートのリリースに時間がかかり、Avayaが一ヶ月前にパッチをリリースしたからです。実際にパッチが当てられていることを確認してください。ええと、なぜこの種のバグが起きたのか考えるなら、技術データは本当に扱いが難しく、[聞き取れず]善意の誰かが、ええと。わかりました。ええと、誰かがそのものをぼやけさせて忘れてしまうのです
[45:42] ということです。ええと、そして手短に言うと、組み込みシステムはブラックボックスではないので、皆さんにそれらを見ることをお勧めします。今すぐにもできます。質問があればTwitterなどで聞いてください。皆さん、お時間をいただきありがとうございました。[拍手]
英語の原文字幕を見る
[0:00] >>Without further adieu, because we stay on schedule. Philippe is here uh, from uh, from Portland, by way of uh, France from what I understand. And he is going to talk to, the, talk to us about uh, breaking into embedded devices, including phones, uh, phones that you might have on your desk at work phones that might be, I'm not even gonna get into that, phones that might be around. Let's learn about embedded device hacking. Let's give Philippe a big round of applause. [Applause]. Have a good time man. >>Thank you. Thank you, everyone um, so I’m really excited to be here, it’s like a big honor and um, yes, so today we are going to talk about hardware hacking and um, I’m going to show you this introduction to it and I hope um, I can show some love about um, hardware hacking. So uh, who am I? I’m Philippe Laulheret um, I’m a senior security researcher at McAfee, um, Advanced Threat Research. So I, I do um, software and hardware phone research, and you can find me on Twitter at PHLaul. Before doing McAfee, I spent 2 years doing uh, embedded security and before that I was a C++ Dev. So I'm
[1:03] not, not coming from a um, software background actually. So you could wonder like, why should you care about um, hardware hacking in the first place? Right? Um, I can see like two main reasons uh, first is that it's actually really fun and empowering to be able to um, you know, break op, break, open a device that you would like have in your home at work wherever. And instead of considering that it's a black box, you can instead you know, like start poking at it and understanding how it works. And then in a more like pragmatic way um, if, if we consider like security in the past couple of years uh, software is becoming much and much harder to like break. Like if you try to uh, I know like, pwn like uh, whatever like um, a media device like a web server like find, finding a vuln in the web server by itself is kind of hard. With, if instead you can just like open the device, solder a couple of wires, and get like a shell from that, that's much easier. So hardware hacking is great, because it's also like a lot of uh, low hanging fruits basically. So uh, today, we're going to talk about uh, Avaya phones um, and especially like the 9. The phone picture on the right side of the slide is a 9611g model. Uh, so Avaya is like one of the biggest uh, VoIP
[2:08] um, solution provider you can find them like all over the place. Uh, Google's like 90% of the Fortune 100 company and I think that's specific model of phone started in 2006, and is going to be enough life like at the end of the year or something. And the funny um, on the bottom right of my slides there is this a funny like um, screenshots from like a page from like a really old software firmware for these phones. Where um, actually like, you can see that um, you can only download that specific firmware, if you're like a DOD customer so um, basically then, uh, see that these phones are going to a lot of different places. So uh, we're getting prior art. Uh, in hardware hacking, it’s like a lot of information nowadays is on the internet, like you, you can find a lot of blog posts, tutorials um, there’s always like the Hardware Hacking Village that you all go, go and check out. Uh, CTF as well where you can like practice, uh, like kind of like the softer side of stuff and um, on my slides, I like a bunch of links at the end uh, so you can like download the slides at later time and um, also the slides uh, I’ve like, the one I've uploaded I’ve like, more text on them. So it's like
[3:11] a more like standalone. So you can read more um, and yeah, I read that in security uh, I found like 2 RC’s in the same uh, phone uh, something like five years ago or something, um, and they like talk at RSA called Stepping P3wns I would also recommend to check out online. So uh, for the next 40 minutes um, so I'm going to talk about um, hardware hacking and use that phone as a base to like support that conversation. Um, And basically the idea of like the whole situation is um, uh, like couple of like, 12 years ago, maybe uh, via Fox and open source codes, and um, they never applied security patches to that. And um, it turns out that like me, by poking at the device, I found that and it was like, women like unnoticed for like 10 years as they were like actually like a CV that got released like, yeah 10 years ago for Defcon. So I'm going to talk about uh, how I found that like that it was like some stupid like you know God inside that firmware. But more interesting, I think is uh, talking about the whole process, you know, like, how I did it, um, and why I did what I did it Why? Oops, sorry.
[4:15] Why I did stuff I did when I did it um, you know like, magic like sharing um, the process so that. And you know, also like sharing uh, know, what if the stuff I tried didn't work or, or selection stuff that didn't work, because, you know what, what works for one device might not work for another. And having just like that mental model of what we can do and what you cannot uh, helps you a lot approaching at any kind of device. And that's, I really think why I want people to take away from that talk is more like um, learning the process of that you can check out like whatever device you have. And yeah, we want to like insist that um, if I can do it, I think everyone in this room can do it as well. As I said I’m more from like software background, and the hardware hacking is still like, you know, like um, little scary, little foreign to me, but it's in the end, it's really not that hard if you have like a good process and you know, me work with patience. So uh, how did whole project start uh. Um, uh, to be honest, I was like, you know, working at work, and there were like all these cubicles, on the, on every desk, I see this like phone like standing on, on the desk. I’m like, wait a minute, these phones are running Linux, they have you know, network access, they have like
[5:17] mics and stuff is like, how, how secure is that? You know, like, I know, you, you wonder like, what's up with it, did people consider the security of this? So um, the first step before you know even like, I still like stealing my coworkers phone and breaking it apart, you can like, and that's generally [inaudible], you can check out the FCC websites usually like any device that has Wi Fi or Bluetooth, has to be um, on the FCC website for a compliance reason. So, that's what I found. Um, That's not my phone. That's like a, also model of same brands, basically and like pretty close. So you see all these cool pictures. But more interesting is the, the inside of the phone. Uh, so we can then see it and on the left side in right, in red um, I’ve highlighted this like random debug connector, I don't know what it is, but that's interesting to see that's there. And on the right side um, there is like that, like um, in purple there is that flash memory. So that's usually where the file system of the phone is going to be stored. And the whole point of that is just to get an idea of what to expect, you know, before even approaching a real target, like building hardware and stuff. So that um, you, you know, like if it's going to be an easy target or hard target
[6:23] uh, you know, if everything was covered in black epoxy, that will be harder. So another important step is like figure, um, getting like um, online material, like um, you know, um, marketing brochure, so you have an idea of what the phone, what are phone capabilities in the ecosystem surrounding it, so that you have an idea of um, you know, like the attack surface. And you can also find like user manuals and stuff. And for instance, I found that one that was pretty cool. It's like a user, like a, advanced user manual that says, oh, if you want a serial connection to the phone, you need that funky box. And uh, yeah, which is interesting it teach, it tells us that yeah, you can find it’s serial connection and you may have had some special hardware for that, but, are we going to see that in a bit. And uh, after that, you also want to check like forms and um, so that you can find out what poor user are doing like for instance, I found like the default passwords for the phone in debug interface, because um, and system admin. So here, uh, talk uh, talking about that online. And uh, if you're lucky, you can also download if you're more of an idea of uh, what's up there. And then we'll
[7:23] cover that in a minute. Okay, so uh, what do we do now, uh, now we have an idea of like, what it might look inside. This is a hardware hacking talk. So we're going to provide volunteers and so the point is like you open the phone first. Um, and the trick is like, usually you always expect to find the same stuff inside. And uh, if you look at the labours of the components, you will see uh, you, and you Google that uh, you will find out like what it is. So for instance that's my phone, and um, you can see the centre of the CPU a, above it like the RAM, in like a lavender ish colour, like some unpopulated like header that I marked with a question mark. This, I think the same way, there are the one we were like seeing in the picture before and I, it might be JTag, I did not have to use it. So I don't know actually. Uh, in proper, we have like the Eeprom’s that’s uh, with the whole like some settings and stuff. Uh, in dark blue in the bottom of the um, of the slide is like a keyed RJ45. So I was kind of, kind of confused when I was looking at that. And I didn't know even the term for it. And the idea is just a regular, RJ45 uh, like Internet plug, but with a weird um, connector so that you cannot plug the, the wrong stuff into it. Um, and uh, more interesting
[8:26] in yellow uh, the UART’s. So it's UART is kind of like the serial console and um, we have like these experts like uh, pads. And so usually like in manufacturing or something you would have like a pogo pins that would like generally connect to the pads. And this uh, that one is actually really interesting, because you would find like serial con, you'd expect to find the serial consol on that. And on the back, we can see the NAND flash that we've seen the previous picture. And um, yeah, from that is like where the file system would be, like stored on, on the device. So okay, you have um, you, we looked at the stuff inside and the, the like, other thing that's interesting to look at is test points and debug headers. So, and like basically all this kind of stuff that on those components. And you can ask, why would you expect to find them inside? And a couple of reasons like ones like just, usually like the Dev board that, that the guys are going to use is the same as the production board. And maybe they're not, just not going to solve the other debug components. It's the same as if you are like software, and it was built with like debug symbols, for instance. And um, also like part of the manufacturing process um, you, this test points and stuff might be used for like flashing
[9:30] the device ,or making sure it's flashed properly. And sometimes, you know, like something died on um, in, in the, in the real world. And they want to like do a post mortem to understand what happened. And that's useful as well. So what kind of stuff you want to look for in that situation? You want to look at UART that we like looking at before. JTag that I'm going to, uh, cover like in a minute. And then like you can also have like random test point that are chilling there that like all over um, the all over the table, all over the board. And there might be like long test points, er, like labour like TP1, TP2, whatever. And sometimes that, that might be like not interesting to you, but sometimes you can find interesting stuff like um, you might find that like oh if you short like TP64 uh, with ground is going to reset the device, which might be actually useful in some extent. So uh, looking at UART uh, so as I said is for like serial connection. And it comes in like 3 or 4 pins. The 3 pins will be uh, ground uh, transmit and receive. And the fourth pin would be like DCC, so 3 volts, 5 volt whatever. And usually you don't care about that one, you don't even want to plug it, you don't have to. And might uh, yeah, and uh, the, the trick to know is uh, the serial
[10:36] console uh, some data at different speed. And there are only like a couple of it's, called like Baudrates. And there was only like a few uh, common baud rates values, so if you try to plug your, your system in on, into the UART, and you just see gibberish on screen, the, probably the reason is, you just have the baud rate wrong and you could just like try to cycle through like all the possible, possible one, and it would find something eventually I think. Um, JTag is another one that's um, interesting um. So that's for like hardware debugging and ways that you could, like, you know uh, debug the CPU usually, and execute like instruction by instruction and whatnot. And it, they come in many different uh, shapes, number of pins and whatnot. So some example like on the bottom of the slides uh, but actually only a couple of wires are interesting and uh, at the end of the slides I have like a link to an article about like understanding JTag better. But basically, like, if you look on the top right side uh, of my slides, there is like a Dev board and say like a nice uh, JTag Connector like plugged there. And on the other hand, like on the bottom right, it's like some uh, random device I
[11:38] was looking at, which you can see, there should be a JTag, but it's never been soldered on and so I had to solder directly onto that stuff. And the trick to remember here, if you kind of like solder your own connector, is uh, you actually may have to add like extra resistors called like pull up and pull down resistors that connects like one pin to ground or one pin to like VCC. And the point of that is, actually, I don’t know the point of that, but uh, the reason is that if you don't have them, it might not work well or it's more work most of the time, it's going to be glitchy. So um, and if you follow the instructions from like, for instance like a arm, a specification for like what resistor you need, so, you might skip them, but then you might waste time like understanding why it's a weird, like weirdly f*****d up sometimes. So I would recommend the pull up and pull down resistors. So that's just random board that my coworker was looking at uh, just to show you that what I said is actually fairly generic. Uh, on the left side, we have like UART. On the right side there like some JTag connectors. Uh, up there is the mmm, the primary there is like, the main CPU, whatever that’s under like a shield. And usually you, you do that for um, preventing um, interferences. So
[12:43] it's like a Wi Fi module, so that's why. And the good thing to know is usually the shield is grounded. So like, if you're looking for the ground on your thing, you're like, either the shield on that kind of stuff, or like the casing around the Ethernet port or whatever is also act, actually like fairly useful. So uh,now that we learn how to uh, look into stuff, we need to know what hardware you need for um, interfacing with what's inside. So I'm going to present like a bunch of uh, cool hacking tool set that's important. So the first one uh, you may want this pin or like the stickers, I don’t know if you're familiar with that um, the actually, like, what's really important is like, safety. Um, so you know, don't work with stuff that’s plugged in the wall. Uh, remember to unplug stuff working like well ventilated room, it's important. And uh, yeah, just don't be stupid when you're like uh, messing with hardware uh, but yeah. So next uh, picture from the lab uh, I'm holding a um, soldering irons. You can usually switch tip for like a fairly large tip for like big soldering and tiny ones for small soldering. I have a microscope, so that's really useful for doing uh, tiny soldering. And the trick is I, I tend to drink a lot of coffee and I shake, so
[13:47] I will, I would, I was thinking like I couldn’t do that, but actually, if you um, if you careful and the, the trick is like really try to um, you know, when you soldering, like try to hold your arm like straight and well grounded. And under the microscope, you can actually do a lot of stuff that’s, you just don’t think, you wouldn't be able to use, you would think you shouldn't be able to do it, but you actually, actually can. [Breathes out], sorry, um. Top right side um, it's more actually used for the tiny soldering and the um, mid sec top right is like flux, so it's kind of um, magic glue, magic uh, gooey sta, it’s a substance that you put on um, pins to uh, when you start doing surface mount or pads so that it works really well. So don't, never forget, flux. Uh, bottom is um, sa, like, in the same uh, size, like uh, copper wires, like a minal wire that you use, usually for making codes, you know, for like radio or whatever. Um, and the trick is that the, the wire is actually um, coated in uh, varnish so it doesn't short. And you can use it to do like really tiny point to point like soldering, and that's actually really useful. And just next to it, you have like some
[14:48] desoldering wick. So like, the idea is, if you put too much solder and you f**k it up uh, you can put the wick on top of the solder block that you messed up with and you um, put the soldering iron on top of that, it's going to get really hot, so you want to hold it through like the plastic casing and it’s going to absorb all the like extra solder. And you can clean up your stuff. Then I put a picture of like some random like uh, jumper wires that are, are, or usually, always useful to have. And on the bottom right, I have like that crazy heat uh, gun. Uh, it's just like 60 bucks at Home Depot. It's meant to like, help paint dry or something, I'm not sure, but it's actually really useful for if you’re on the chip, if you want to remove component by just like heating them and pulling them off. So uh, more cool hardware um, that's a multimeter. Um, if you're not familiar with that, it's easy to for, find voltage of chip you don't know, like what's the actual voltage, so the black goes to ground and the, with the red you uh, with the white probably select poking around to uh, measure the voltage. And there was a really cool stuff is you can set in continuity mode and when you have like connection between the two probes, it beeps. So if you do
[15:51] like crappy soldering job, as I was describing just before, you can make sure that you actually did a proper job where like everything is connected the way you think, by you know making sure that both like, when you probably, both side it actually beeps. And that's actually fairly useful uh, tool. The other one is, this is a Logic Analyzer. Uh, the name is like a Sally, um, that's a brand. And the idea is, the same as in software, you have like ways of communicating between process, like in hardware, you have like ways of communicating between chips or the CPU and the chip. And it’s uh, it's like a lot of different standards, different ways of doing stuff. But the logic analyzer like know a lot of them and it's going to convert like a bunch of signals going , going on to wires into actual data. And that's actually really useful. That would be your eyes, like when you're doing uh, debugging, you know.
[16:32] And that's like your snapshot of like some SPI communication uh, which spies with some random protocol. Uh, that's like an FTDI cable also come in many uh, serial cable, it comes in many different shapes and stuff. And the idea is just like, when you want to do like UART, you, you plug that into your laptop, and you connect the user side to like the UART port and you get like a console, it shows up as a serial port. And uh, as an example I’ve um, on the bottom right um, like a raspberry pi that’s, you can actually get to serial console and you don't need like HDMI cable or anything to interface with that. Whoo. Um, the Bus Pirate uh, also like cool device um, it does um, It, it's kind of dependent of the hardware hacking at um sorry, with um, the Sally logic analyzer, so instead of absorbing data, it's like send data, so it speaks a bunch of different protocol and you can use Python to programme it. So it's extremely useful if you want to like read flash, programme um, microcontrollers and that kind of stuff. Um, more cool stuff I covered. I was talking about JTag, that's the JTag debuggers that you, that's where you would plug actually like the Digitech port on. They
[17:38] come in many different like uh, price range and whatnot. So on the bottom right is a fly swatter it's like, probably like 30 bucks, I think. And it works okay, and above it it's like a J Link, which is more fancy. And the idea like, the more expensive the stuff is, the more, the probably the more reliable it is. And it comes with like better software and whatnot. And on the bottom right, the pink bodies are JTagulator later that Joe Grand, the same guy who made up those badges uh, made. And it's really awesome. So, if you're like that board, you don't know what it is until like a bunch of test point and you like, I bet there is some JTag somewhere in it, but you don't know where. You can just wire like all the test points to the TJagulator and is going to brute force like and try to find everything. So it's really cool. Um, those are interest, important tool is uh, Flash readers. So usually Flash content, the Flash as the file system and stuff. And um, so you want to like interface with that. And uh, it comes in two flavour, I guess, you can do like in circuit stuff. So you have like either like your little like clamp that you put on the chip or a little rectangular one um, in to clip on. Um, so like the Raspberry Pi is a good one for that. And on
[18:42] the top right, is like a flash cat, uh, it’s like useful for the rectangular one. Um, but you can also like, choose to like, actually disorder the chip and, in that case, you would have like some socket adapter. So you can clip the chip on and then you plug it into your Flash cat and whatever, and it's going to read it. And that, I will cover like why, whats, my, whats, why it's important like both in a minute. And finally, it's kind of the um, last uh, hope. So let's say uh, you know your Flash is encrypted, there is no UART , there is no firmware. So you can try to do like the more crazy stuff like, first injection and such an attack. So that's the chips whispers like more like a kind of hard, more badass device. And the idea with that is um, it, you can do stuff like um, you are wire it um, to the CPU and you're going to drop the power on the CPU for like a split second and it’s going to like mess up some instruction and you can bypass checks and stuff. That's pro, what people use for like gaming console hacking and, and um, that kind of stuff. So uh, what do we do now um, that we have an idea of what's inside the phone and um, you know um, the tools we can use. So like, I think it's three
[19:47] posts potential track, one is messing with the UART, so the serial console, and this one is uh, messing with the flash and trying to recover the firmware or something and then maybe you can just download the firmware online. And the three are like valid approach and sometimes it's good to just go from one to another to another and you know what, whatever you find like some hardware you can like go from one to another. Uh, so I went for the UART first and that's what I'm greeted at by when I connect my FTDI cable to the UART ports that I, I was doing before. So um, we can see that on the left side, the, the um, the console thing, it's like dot dot dot, usually when you see that, you can press space or escape and it's going to interrupt the booting process of the phone. And in that situation, uh, but somehow here it didn't work. And I, I will cover that why in a minute. And on the top right side of the slide um, we can see like it read something from the EEPROM and then decided to set the console to Dev null. So you don't want console to be Dev null because if that goes nowhere. But that's interesting to know that um, there is some potential there. And finally, it's like booting in next so it con, confirm us that it's a uniques port, but then uh,
[20:48] there's nothing more uh, after that. So there's some good thing, bad things. The problems are like nothing shows up after like the Linux is as we did, probably because of the Dev null situation. And when I press keys are talking and um, I'm going to like come up with like, why that happened. So at that point, I was still like, okay, I, I cannot go anywhere. So I'm going to try to recover the firmware to try to understand what's up with that. Uh, multiple ways of recovering firmwares uh, is like an easy ways like you can do it online. And actually that worked um, there is like a quick snapshot of that, uh, sometimes it’s encrypted. On our case, it wasn't. Um, but, yeah. So you can also try to sniff a firmware update uh, that’s really useful for IoT devices in general. And you can use a network tab, which is like the thing pictured on the top right of the slide. Um, or you can mirror your port on your switch or whatever. Uh, the problem with all of that is oftentimes a firmware updates going to do over like h, HTPS, or it might be, in this case, you're like stuck. And then you want to go for like a more like uh, hardware hacking stuff or like you’re going to dump a flash, for instance. And like
[21:48] even more advanced techniques that I will briefly like uh, talk about. So how do you dump a flash? There’s two ways, as I was mentioning, just before, you can do in circuit programming and um, out of circuits. So in circuit is cool, because you don't have to, you know, like remove stuff, break stuff. But a couple of issue is that um, the main idea is to read the flash, you need to power the flash. And if you, if it's like still plugged into the whole system. Uh, it, when you're like Raspberry Pi, for instance, going to try to read the flash, it's going to tr, try to power like everything else that's connected to the same like like power line. And either you know, USB Pi is not strong enough to power like a VoIP phone, which you would expect. And in that case uh, but it's just not going to work. Or maybe your Raspberry Pi is really strong and it’s going to do it, but then the problem is the CPU stop booting and it’s going to talk with the flash and that's going onto to mess up your stuff. So in that situation, you have like two choices usually, either you can try to like lift up the pin, the ball pins, so that it doesn't happen. Or you can kind of go a little more like hero approach where you want to keep the CPU in reset. So I've been successful with that many times
[22:51] or I just like starts like trying to ground like random test points, of stuff on the boards, praying that is not going to find anything. And usually at, at some point like, I'm going to notice that okay, when I do that the phone like light up, it doesn't boot, that's good. And maybe better ways you can desolder the chip with it like to be like heatgun or whatnot. You have to be careful though, because if you like pull it too hard, you might like bend pins and is going to be like useless. Um, with a good trick to know is that you can make a little like um, tinfoil hat or whatever, like on the chip, so that like when you're heating up the chip, like the stuff around, it doesn't get too hot. Er, so you don't accidentally like knock off like some like tiny like components, that would be like a pain in the butt to um, put back. And uh, bottom right is like I was, I was, I thought I would have to do that on the phone. So I wanted to practice first and then just took like some random uh, USB thumb drive and I tried. And actually, that worked really ff, nice. But the trick is to remember, I also put some flux because it helps. And uh, yeah, just don't, be careful with, when you put it off. A few other tricks that actually didn't work on this one. But I, good to know. Uh, U-Boot is the most common boot loader uh, not used here, but it's, you would find
[23:56] that on pretty much every other device. And the idea is you can also instruct a boot process of that and asked nicely you would, hey, can you load the flash in memory, and then uh, U-Boot is also able to dump in a Hex like in the screen um. The, the memory, is this way, you can just get, write into the script to do that and recover everything from the flash, which is really cool. But usually like Dev don't like letting you do that. They said they lock that approach, so, so you cannot like press space to interrupt the boot process. But there is a trick that I also call like the Yolo approach where, instead, when. The idea is like U-Boot is going to load from the flash like the, the new scanner or something. But if while it’s happening, you start like poking with, you know, like a wired is connected into ground and they started poking the NAND flash, like some of the pins, it's going to mess up like what’s uh, u-boot is reading and after a couple of tries, u-boot is going to be like, d**n that kernel is f**ked up, I don't know what to do and it’s going to give you like a shell. So that's really cool. But yeah, as I said that one we don’t work on our phone unfortunately. But uh just some cool example that I found online was like some guy actually did that. And uh, I underlined in
[24:59] uh, in the like purple on, on the bottom, like the command you need to use to like log the, the, the flash in memory. And on the right side, the secondary block of text is um, sorry, is, how uh, you will just panicking and be like, er, I don't know how to do with your kernel and give you the, the shell. So uh, how um, so a few more like tricks for um, dum, dumping the flash, so you can use JTag. So usually you have uh, if, if JTag works, you're going have to be able to um, dump the RAM. So in this case, that won't be really like dumping the flash, it will involved dumping the firmware, but, in a lot of devices it’s going to load the whole stuff in memories, so if you can dump the memory you are, you, you the same means you pretty good there. And kind of the last hope with this. That's one of my favourite about hardware hacking is, you can do crazy uh, stuff uh, and an example is a Scanlime um, that person on the internet who um, she had a um, a Wacom tablet that she wanted to dump the um, the firmware off and there was like no attack surface at all, which she realised that like when you [inaudible] USB stuff, and when you plug your USB um, onto the laptops, there is some USB exchange that I
[26:01] don't know anything off, but it sounds like USB descriptor. And if you, if you glitch the CPU just at that time, um, it's going to like, know, miss like a binary check and is going to send a way more data. And with that uh, she was able to recover like the full flash, full memory or something. So it's really impressive, but, and that's what's kind of awesome about hardware hacking. Okay, so uh, we recovered the firmware uh, in my case, just by downloading online, but, what do we do now? We want to analyse it. Um, the best tool for that is called Binwalk. And it's just basically magic dictionary that's going to like look at your binary blog of stuff and be like, mmm, halfway through it looks like there is a zip file, I'm going to try to extract it. It tries, maybe it works, maybe it doesn't depending if it was actually zip filed or not. And it does that for everything. And uh, it might also find like compressed file system such as Squashfs, JFFS2 etc. And sometimes like your um, your firmware file might just start with like Elf headers or just like random like ARM code that you could like, look at. So I haven't been work on. So that's the firmware file, I don't know it from the website.
[27:01] And once again, it's easy mode, it's just a doc file. And they already like split it up into boot 1, boot 2 and JFFS2. So like, Binwalk has nothing to do here, really, and I can just extract the all file system. And that's cool, because from there, I can look at what's on the phone, just like that. Uh, but the more interesting, use case for Binwalk is, I took like a different uh, firmware file for like, a [inaudible] phone. And this one is way more interesting, because Binwalk for, find like a way more lot, lot of stuff. And uh, I've highlighted, like you find the file system and is able to extract it. And there's also that random like my SQL stuff, which I think is a false positive, then you need to be aware that there will be a lot of false positives, so don't blindly trust what the Binwalk says. And uh, really, really funny stuff that I was looking at uh, if you run strings on that specific image um, you will find a U-Boot strings. So, that fun is using U-Boot and the cool stuff I was describing before, would actually work on that one, look. So now that you have extracted the firmware file, what do you want to look for? One of the most uh, interesting stuff is uh, finding the you, update mechanism. So assuming you have uh, encrypted firmware,
[28:04] like if you reverse engineer that you might find the keys and how to extr, to extract like subsequent uh, firmware updates without having to do like, any hardware stuff. And then you want to look for like secrets, like uh, passwords, certificates and so and so forth. Uh, originally, my goal was to look at the main binaries. So that's just the thing and deal with like the VoIP stack. Uh, that could be make sense to look at that. And um, also you want to look at the bootloader because, it may have a hidden commands, explain why all console is not working, that kind of stuff. So, remember, the point of all of that was, I wanted to get a shell on the device and um, what's the process to do that? So, the one I want to go for is, I want to fix the serial console, you know like the Dev null was not cool. Um, but also approach will be like messing with your boot arguments. Um, not working here, obviously. Uhm but you know, you can specify the console you want and the, uniscript can be marked, oh I want Bin bash as my uniscript and you have a console. Uh, and like kind of last resort stuff that I was considering as well is, you could patch the firmware. In our case the firmware is signed. So uh, that won't work unless you try to glitch it, which really hard.
[29:08] But you can also try to patch a file system. So the way Binwalk extract the JFFS2 stuff, you could modify it and then like repackage and flush it directly onto the flash. And that's usually accurate, foolproof methods like, that would work in most cases. So instead, I'm going to uh, reverse uh, um, the Bootloader. And um, for that, um, because I wanted to understand like, why Dev null, a con, the console was set to Dev null and stuff. I'm just going to cover um, in much detail and I would be come on you to check out Azeria Labs Tutorials that cover everything, which just useful here um. There is this notion in ARM of literal pool.
[29:44] Which is um, inside the code section, you would find some little chunk of data and that's usually like used to la, loading registries, um, absolute addressees, imminent values, magic offset, that kind of stuff. And uh, FYI, like in ca, in case of function calls um, the arguments are going to R0 to R3. The rooted value is in RVO. And when you like, want to return from your caller, it's, the, the return address is saved in like the LR register, that stand for like link register. Um, and the big trick, big problem here is um, we're like trying to load the boot loader. So it's uh, it's not really Elf. So if you tried to import in IDA, IDA doesn't know what to do with it and so you need to find the loading address for that stuff, so it match what, where the phone is loading it. Couple of tricks um, so none of your load key is going to be printed on screen, that's our case, sweet. Um, but otherwise, you want to look at like header file, headers in the, in the bootloader file or maybe recent vectors so that stuff for like, specifically for ARM, like the CPU needs to know uh, specific addresses where like, a recess or an intrep happening and it's like funny like um, square like,
[30:50] how it’s being set up. So if you find that and you find like what looks like an intrep vector handle or something, you can find like, ah, that must be the address. And uh, finally, the literal pool I was mentioning uh, really useful with a because it's going to contain like absolute addresses or point to strings and stuff. So uh, if, if like you have strings, and they look like all f**ked up, you probably got the wrong address. And uh, Quarkslab, uh, what a blockbuster blog, so I would recommend you checking it out. So as I said, in our case, it was easy. Um, when it boots it prints uh, the jump, whatever. And that's actually WIFI loaded.
[31:21] And um, on the bottom right side, it's like a bunch of uh, strings um, so it's a bunch of addresses that point to strings. Uh, the system snapshot from IDA and um, we can see that uh, um,it's all the strings like prints well, so that means that it's loaded properly. It's not like all messed up. Okay, so now that we have the bootloader and we can like work it with IDA, uh, we want to search for strings uh, we were looking at, you know, like that sentence like EEPROM read successful, whatever. So we can use like cross reference in IDA to find where the string is coming from and look at the function that handles that. And uh, yeah, just as a FYI, but like EEPROM and Spi, so the EEPROM that's on the board is called a Spiprom and Spi is just one of this protocol I was mentioning before. EEPROM is just uh, like a small memory, um, whatever. And the spi uh, protocol is just like 4 wires um, and the ID to CPU in command and EEPROM like reply, and uh, and that's a dump from like using the logic analyzer to have a look at what it would look like in real life. Uh, that's the data sheets of the EEPROM
[32:22] that you can find on, online, if you google the, the label on it. Um, the cool thing is in the bottom left uh, of the slide, it tells you like, the pinouts, so you how to connect stuff to it. And on the right side of the slide um, it tells you which, which, upcodes are for Spi command would send. Like for instance, if you send uh, 3 it’s going to be read, read, if you send 2, it's going to be write. So that's uh, that's something useful to know, right? Oops, sorry. Back to the um, back to the IDA and the uh, bootloader, we can see uh, the strings we were like looking for. And something is for me promising is, we can see the uh, console set to Dev null, but above that, that I could bur, 2 of the option and it’s actually saying like, oh, setting console to like UART 0 or UART 1. So we want these ones to be printed.
[33:08] Um, that's a, that's a function that actually does print that string. And uh, what it does is roughly um, cleaner, clear some bites on the stack. And then you read for me from from a magic address. And it's going to compare like bytes um, that has just been read. When if we have the good value, it’s going to actually print on the console setting, the console for uh, Dev ttyAMA0. So we want that to happen. Uh, and something you can ask me is like, oh, how did you find that read EEPROM function, you know? And there like more a couple of ways of doing that. Uh, the easy way that I've highlighted in green, that screenshot, is uh, on the bottom right, you can see some like logging that says, oh, EEPROM read fails. So I know that function is responsible for reading EEPROM. Uh, but maybe, maybe the few more I’m going to look is not uh, as uh, variables. In which case um, as I said before, like, to read from a EEPROM you know you have to send 3over SPI. So, if you find like the SPI function, and you see like sending 3, you know what it is. This whatever highlighted in yellow. But then like, how do you find a spi function in this kind of um, programme? Uh, 2 ways for that.
[34:07] Um, my guess once again, it was logged, so it was easy. But usually like, the main trick is um, you have this um, something called um, mapped uh, IO MMO mapped IO. It's this kind of like magic address values in the CPU that like if you write to them, it's actually going to send data over like you auto spi or whatever. If you're lucky, you're going to have a data sheet for the CPU. And it specifies exactly what are those addresses. If you're unlucky um, you have to guess and that's really hard. And, at the time, maybe you should like look for something else, or just you know, you're going to spend a lot of time on that. So we want to uh, patch the EEPROM now, so we can uh, build the console. The plan of action is, we know the read, write comments uh, we want to interface with the flash. So to do that um, uh sorry, the EEPROM, we, we um, we needed like a spiuh, device and that we've seen before the Bus Pirate is a perfect candidate for that. And we need to connect to the chip, uh, unfortunately,
[35:09] like it's really tiny one and so like the clip I was showing how like too big for that. You can buy online some rigs that people make um, it's like, expensive, and it's like five weeks to get them. So instead, I went kind of crazy and I tried to solder like um, little wires onto the thing. And I was like, honestly, that's never going to work, but happened to actually work. And that was like, sweet. And uh, it's all like look like cross because it’s like all the flux that remains on that. Um, and that's the code for the Bus Pirate. It's super like boilerplate uh, thing. And when you just write um, this magic values that uh, sorry, I was asked to like, replace, them with like, images. But uh, the idea is like, just after that you're greeted with console is set to uh, like your R0 and now we have a lot of more stuff uh, printed on console, which is great. But unfortunately I, I get like this a harder like, the input are still like not working, I was like trying to press space or type like, it’s as, asking for oh, you want to look as root? What’s, I type, nothing happens, like ah, what happened? Did I just cut the trace, so you cannot send data? We have the boards, we can look
[36:09] at it, um. So uh, this just like, like a zoom up on the thing and at that time, I was like, you know, looking at the UART pad and start like with my millimetre, like trying to beep out, like where it goes, you know it’s, following the continuity testing. And eventually it reached some wires, like on the right side and wires are that little hole that's connect one side of the ball to the other. So the trick is the actual like trace that connects UART to whatever uh, goes to the other side of the board and goes oh, back and forth. And it's like really, like tedious. And eventually I kind of lost where it was going.
[36:39] But it was kind of under that MOD port, uh, that's like the keyed RJ45. Um, and so um, remember like the recon side uh, recon part, um, we have that box and it’s like ah, d**n, that’s, that’s the thing. So I kind of went via like, my euro approach again where, I was holding like a, a plug, like a jumper cable in my um, the transmit of my FTDI cable. And uh, so I had like this like wire that I could poke around. And on the other side, I was like pressing keys on the console trying to see if something happened. And meanwhile, I was poking like to the pins one by one. And I think at the second one, it actually worked. And I got greeted by uh, like a root shell on the device. So that was cool um. But the trick was um, the, on the right side of like a proper setup, where I plugged my ethernet cable into the plug. So at that time, I didn't want know where the key the RJ45 was. So I was just like sanded the plastic of the ethernet cable so I could like shove it in, and yeah, it just works, so that was nice.
[37:36] Uh, now that we have a root shell is it like uh, a lot of debug strings prin, printed on screen and that's annoying. So um, the trigger was like, I want to kill the process, it's like, sha, that's like flooding my console. Uh, there’s a watchdog that’s going to reboot the device if that happens, so I highlight in the corner, like the magic commands that you can run to kill that. It’s just like a random, unique stuff. Uh, so now we can finally do some Vuln research. Um, and really what you are going to do is look at process running, poke around, look at open ports. Uh, there's just a bunch of processes, uh, new sequel stuff, but um, that’s when it’s all getting interesting. I think at some point I was tired of looking in the IDA and I was like, I’m going to poke more. And I looked at DHClient and like huh, and the really funny parts like, I run the DHClient and I see this like 2007 copyright. I was like, woah, that's not a good thing. And if you just run DHClient by itself, it's Segfaults, like that's weird. And if you like, run it the right way, they print a debug message that say oh, we modified it to work it better on our device. I’m like, huh, that's interesting. So, if we
[38:36] look back, and we look for the specific version, it turns out that, 10 years ago, actually, for DEFCON uh, Jon Oberheide um, really is like an exploit for that specific version of the DHClient, so I was like, well, that's, that's easy. Um, but we want to make sure it's actually vil, still vulnerable. So the um, the phone was like a doing like um, Stack Overflow, like while handling DHCP options. So we can compare the original source code with the patch source code because DHClient is open source. And just keep in mind, that might be like mitigation, like stack cookies, ASLR whatnot. So if we look at the vulnerable code on the left side, we can see a memcpy like highlighted in red. That’s using like data.len as a field. Or on the patched version that we place, that by 4. So the idea is like, this bug is uh subnet, uh, it's a bug in the subnet mask and link, and the subnet mask should be like 4 bytes. But, the way the HTP option works, is that you can send up to like 255 bytes, I think, and it used to just dumly trust, whatever you're sending, which is bad. And if we look in IDA like the actual like function, uh, we can see there is no stack canary and the vinner, the, the, on the
[39:39] left, on the right side, it's, it's not using that magic 4, so it's, it’s obviously like still vulnerable. So it simple to exploit stuff. Um, working on the phone os TDS, I was like, I'm going to try to set up QEMU um, if you're not familiar with QEMU it’s kind like emulation of ARM stuff or like mini of system and can do either like Userland or Full-System. Userland wouldn't work here because uh, DHCP is um, more going, try to modify an IP and stuff and that's not cool. Um, but instead, we can do, do a Full-System emulation and uh, those tutorials tell you how to like, set up a query match for that. And we just want to set up the network properly, uh, because we want to interface with the DHCP and naturally um, the um, QEMU stack would give you a digi, DHCP for yourself, so you have to be, stay like don't do that and, yeah. So I run it in DH in QEMU and after like [inaudible] fault and it's still Segfault and it’s like, huh. So it turns out that like, Avaya modified stuff that actually causing the Segfault. And um, I was going to go back too fast, because I'm running like a little of out of time. But uh, basically it's creating that weird socket, uh, it’s like
[40:42] a name socket and uh, so that’s like the main application that the VOIP stack can talk with DHClient and show options. Um, and uh, the idea’s like, that's like the main application, then we can see what it does. That's non, not super interesting. But basically on the left side, it’s like sending data to configure DHClient at startup and on the right side, I re-implemented that in Python. And uh, you can run that with like Socat, um, so, Socat is just like, kind of like Netcat in um, in more like um, more tools, so you can share that name socket and the idea, you run the Python script on the host, you on socket on the um, QEMU like binar, image, and that just work. So now we can start debugging uh, DHClients, um, you can run GDB, we can try to like, actually run the bug. I do, I couldn't compile the original proof of concepts, it was like using a really old tools and it's just after like, hella, like couple of hours like, ah f**k that, I’m tired. So instead uh, I use a Scapy based uh, exploit. Scapy is a Python library that lets you like, you know, mess with uh, network packets, like a fairly low level. And um, so now we want to like reach the um, vulnerable part, vulnerable code, so um, I
[41:47] was explaining the bug in the uh, subnet mask option. And how, the way DHCP works is like a tea, tag length value like type of stuff. So you say, Oh, this option is a uh, subnet mask, here's the length, here’s the value. And obviously it was like, it would be 4, but if you send more, it's fine. But for the DHCP specs. And so we can use Scapy for doing that. So uh, that's my, like a chunk of my Scapy script and just the payload in properly is interesting. Um, basically just sending the subnet mask option with uh, data that will be like A, A, A, A, B, B, B, B, C, C, C, C and so on and so forth. So that um, when it crashes in GDB uh, we can see like all the register we control, and we know um, exactly um, you know, if we want to af, affect which register, which chunk of the shell code we need to change.
[42:33] And we can see that we actually controlling uh, [“pc’s” so the programme console, so that's good. We know that we have um, we can exploit, we have control, control for execution. And there like a few more details that I'm going to skip over. But um, we need to sta, to craft a shell code now. Uh, unfortunately, like it's it looks like the stack is uh, you cannot execute the stack, so we will have to work it. And that's tedious. But um, cool stuff is like if you look for there is like a system calling, that binary that I think also, Avaya added. And we do control R4. So if we put us, if we can put a string in memory in an address we know, that could be a value like, system comment, and put the address in R4, we good. Um, so if you think about it, DHCP client, DHClient, sorry, receive configuration values from the server. So probably there is going to be stuff that are stored somewhere and um, it turns out that ASLR is disabled, I, sorry, I forgot to mention that. Um, but then we, the idea is like, I just some like, sending like A, A, A, A’s as like, a bunch of uh, options and then look at memory to see if I could find that string somewhere. And eventu, eventually, the domain option
[43:36] was a good one. And so um, now I can show you uh, a cool demo that's, what happened when you actually run the whole stuff. So uh, on the, um, on the left side, we have the phone that's booting. The phone is booting and the window uh, the 10 minute window is like, on the left side is a, rog DHCP client running off payload. And on the right side is um, it's a web server that uh, will provide like uh, life post exploitation kind of stuff. So we can see the packet is running. To make sure it works, I was uh, catting dev random on the uh, on the screens. That's why it's looks like noise. It's fetching data from the um, web server and and I don’t know if you can see but it’s loading like steve.data. Uh, FYI, like, Steve is actually my uh, boss. That's him. [Laughter] And uh, just then um, uh, still like ex, I don’t know if there is sound but I’m ex- filtrating audio from the main speaker. And you can see it in VLC that when I'm speaking and clapping my hands, it's actually like reading the audio on the attacker laptop. So that's pretty scary because you can turn your um, phone into um, you
[44:37] know, listening device. [Applause]. Thank you. So um, yeah, and just FYI like all the tools I use like actually already on the phone, like you're like Netcat, your like stuff to like dim the audio to like, SDN, so you, ju, just like writing some shell script, like bash script, whatever. So um, as conclusion uh, for mitigation, like, you want to make sure you monitor your network so that you don't have like bugs like sending uh, you know, like weird DHCP packets. And uh, actually like McAfee uh, firewall, like can detect that. FYI, you want to segregate your network um, to make sure that, for instance, the coffee pot is not able to like send weird DHCP packets to your phone. And make sure IT actually patch your phone, because you know, it took, it's the patch notes release like, Avaya release a patch like a month ago. So make sure it's actually patched. And uh, if you want to think about why this kind of bug happened like, tech, technical data is really hard to handle and, no [inaudible] someone in good face um. Okay. Um, somebody would face um, fogged the stuff and they forget
[45:42] about it. So um, and just as a really quick um, embedded systems are not black boxes, so I would just encourage everyone to um, look at them and uh, you can do it now as well. So if you have question uh, ask me on Twitter or whatever and thank you for your time, guys. [Applause]
Vidleafワークベンチで開く
トランスクリプトを検索し、行を選択し、タイムスタンプ付きの引用をコピーし、翻訳します。
帰属
「Philippe Laulheret - Intro to Hardware Hacking - DEF CON 27 Conference」by DEFCONConference(https://www.youtube.com/@defconconference)、CC BY 3.0(https://creativecommons.org/licenses/by/3.0/)の下でライセンスされています。ソース動画:https://www.youtube.com/watch?v=HuCbr2588-w。このページは、段落区切りとタイムスタンプを追加した動画のテキスト文字起こしです。制作者はVidleafと提携しておらず、Vidleafを推奨するものでもありません。VidleafはAIによる句読点の付加とAI生成の要約を追加しましたが、元の文言はこのページで引き続き参照できます。
あなたは制作者または権利者ですか?訂正や削除をリクエストする:copyright@vidleaf.app(これらのページについてを参照)。
最終更新