SlideShare a Scribd company logo
6
Most read
10
Most read
12
Most read
2013-10-06
すみだITセキュリティ勉強会 その1.5
@inaz2
1

 @inaz2
 Security Engineer & Python Programmer
 Girls Idol Freak
 http://inaz2.hatenablog.com/
About me
2

本題
3

 Peer-to-Peer File Sharing Protocol
 大容量データを高速に転送することに特化
 匿名性はない
 代表的なBitTorrentクライアント
BitTorrent
4
Most
popular
Popular
in Asia
Preinstalled
in Ubuntu
Java

 ファイル
 ダウンロードされるデータ(群)
 .torrent
 Webサーバなどを介して配布されるメタファイル
 ファイルの名前・サイズやTrackerのIPアドレスなどが書かれてい
る
 ノード
 ネットワークに接続しているBitTorrentクライアント
 Peer
 直接接続している(隣接している)ノード
Terminology
(only in this slides)
5

Classic BitTorrent
Architecture
6
Tracker
Peer
(my client)
Peer
Peer
Index server
Peer
1. .torrent の
ダウンロード
2. ファイルを持っている
Peerの取得
3. ファイル断片を送受信
.torrent を配布 ファイルを持っている
Peerの管理

 As a Tracker (with Index Server)
 Index Serverで配布しているファイルを
欲しがっているPeerのIP(+接続時刻)
 As a Peer
 自分がダウンロードしているファイルを
欲しがっているPeerのIP(+接続時刻)
 .torrent ごとにネットワーク (swarm) が作られる
 自分が知らないファイルについてはわからない。
What we can get
7

 元々のアーキテクチャはTracker中心のHybrid P2P
 Trackerに繋がらなくなったら止まる
 Trackerなしでも動くようにする
 Peer間でPeer情報の交換
 Peer間で .torrent のリクエスト & ダウンロード
 Peer間でファイルを持っているPeerの探索
Trackerless download
8

 ハッシュテーブル
 キーと値のペアの組み合わせを集めたテーブル
 キー = .torrent のSHA-1ハッシュ値
 値 = .torrent が指すファイルを持っているPeerの集合
 ハッシュテーブルを複数ノードに分散させる
 問い合わせに答えられなければ、自分の周囲のノード
に問い合わせ直すように答える
Distributed Hash Table
(DHT)
9

 4種類のクエリ
 ping / find_node / get_peer / announce_peer
 get_peer
 リクエスト: .torrent のSHA-1ハッシュ値 (infohash)
 レスポンス: .torrent が指すファイルを持つノード群
 自分が知らない場合は、「自分が知らないこと」と自分の周囲
のノード群を答える
 リクエスト側は、教えてもらったノード群に問い合わせ直す
 ファイルを持っているノードが見つかるまで問い合わせ続ける
BitTorrent DHT Protocol
10

 get_peerクエリのinfohashを収集
 他のユーザが欲しがっているファイルがわかる。
 もちろん、IPと接続時刻も。
WE CAN COLLECT
OTHERS' DESIRES!
11

 infohash はただのSHA-1ハッシュ値
 ファイルの内容を知るためには、対応する .torrent を
得る必要がある
 BEP 9: Extension for Peers to Send Metadata Files
 ファイルを持っているノードから
.torrent を送ってもらうためのプロトコル拡張
infohash → .torrent
12

実践
13

 めんどくさい!!
 Deluge BitTorrent Client
 Python製BitTorrentクライアント
 libtorrentライブラリを使用
 GUI (GTK+)
 クロスプラットフォーム (Linux, Mac OS X & Windows)
 簡単に改造できる
 http://deluge-torrent.org/
Develop a BitTorrent
Client
14

Deluge is a good alternative
to Transmission
15

 https://github.com/inaz2/deluge-hack
 飛んできた infohash を自動でキューに追加
 .torrent が得られたらダウンロードをpause
 放置するとキューがたまりまくって激重になる
Fork & Hack
16

 https://github.com/inaz2/btsniff
 python-libtorrent を使ってコア部分のみ実装
 One-file CLI
Hack more
17

 Ubuntu Serverのtorrentを使ってネットワークにjoin
 観測期間
 2013-10-04 02:18 ~ 2013-10-05 00:57
Experiments
18

 見つかったファイルの数: 3629
 内容の一部
 Taylor Swift - Red (2012)
 TVアニメ「進撃の巨人」OP1&OP2テーマ
 月島きらり starring 久住小春(Koharu Kusumi) - バラ
ライカ(Balalaika)
 店長推薦作品 BT-98-不能停止的疼痛 美人妻 阪上友香
 楽しい!!✌('ω'✌ )三✌('ω')✌三( ✌'ω')✌
Results
19

 BitTorrent DHT Protocolの細かい仕組み
 各クライアントにID (SHA-1値) が振られる
 各 .torrent にもID (SHA-1値) が振られる
 クライアントのIDに近いIDを持つ .torrent が集まるように
なっている
 距離は XOR によって定義: distance(A,B) = |A xor B|
 幅広く .torrent を収集するには、定期的なクライアントIDの変
更 (ID hopping) が必要
 多数のノードをP2Pネットワークに仕込むタイプの攻撃は、
結託攻撃 (Sybil Attack) と呼ばれる
Road to Sybil Attack
20

 BitTorrentでDHT有効 = 他人に欲しいファイルを
持っている人を知らないか問い合わせる
 get_peersクエリを収集することで、他人が欲しがっ
ているファイルを知ることができる
 Future works
 get_peersクエリ以外のトラフィックの利用
 ID hoppingの実装
Recap
21

 "Crawling BitTorrent DHTs for Fun and Profit"
by Scott Wolchok (DEF CON 18)
 https://www.defcon.org/images/defcon-18/dc-18-
presentations/Wolchok/DEFCON-18-Wolchok-Crawling-Bittorrent-DHTS.pdf
 "Defeating Vanish with Low-Cost Sybil Attacks Against Large DHTs"
by Scott Wolchok et al. (NDSS 2010)
 http://z.cs.utexas.edu/users/osa/unvanish/papers/vanish-broken.pdf
 http://www.cs.utexas.edu/users/witchel/pubs/unvanish10ndss.pptx
 "Large-scale monitoring of DHT traffic" by Ghulam Memon et al. (IPTPS 2009)
 http://www.usenix.org/event/iptps09/tech/full_papers/memon/memon.pdf
 "The Sybil Attack" by John R. Douceur (IPTPS 2001)
 http://research.microsoft.com/apps/pubs/default.aspx?id=74220
References
22

Thank you!
@inaz2
http://inaz2.hatenablog.com/
23

More Related Content

PDF
WebSocketのキホン
PDF
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
PPTX
Zabbix概論2018
PDF
ロードバランスへの長い道
PDF
Docker入門 - 基礎編 いまから始めるDocker管理
PDF
データセンターネットワークでのPrometheus活用事例
PDF
インターネットの仕組みとISPの構造
WebSocketのキホン
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Zabbix概論2018
ロードバランスへの長い道
Docker入門 - 基礎編 いまから始めるDocker管理
データセンターネットワークでのPrometheus活用事例
インターネットの仕組みとISPの構造

What's hot (20)

PDF
Mercari JPのモノリスサービスをKubernetesに移行した話 PHP Conference 2022 9/24
PDF
IAM Roles Anywhereのない世界とある世界(2022年のAWSアップデートを振り返ろう ~Season 4~ 発表資料)
PPTX
SPAセキュリティ入門~PHP Conference Japan 2021
PDF
Open Caching Update
PPTX
WebRTC SFU mediasoup sample
PDF
MySQLバックアップの基本
PDF
Dockerイメージの理解とコンテナのライフサイクル
PDF
OSS活動の活発さと評価の関係について
PPTX
できる!KickstartとAnsible!
PPT
35歳でDBAになった私がデータベースを壊して学んだこと
PDF
Swagger ではない OpenAPI Specification 3.0 による API サーバー開発
PDF
InnoDBのすゝめ(仮)
PDF
さくらのVPS で IPv4 over IPv6ルータの構築
PDF
Pcapngを読んでみる
PDF
AWS Black Belt Online Seminar 2018 Amazon DynamoDB Advanced Design Pattern
PDF
pgvectorを使ってChatGPTとPostgreSQLを連携してみよう!(PostgreSQL Conference Japan 2023 発表資料)
PDF
ISPネットワーク運用で覗いてるもの
PDF
QGISプログラミング入門 FOSS4G 2013 Hokkaido
PDF
20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...
PDF
AWS re:Inforce2019 re:Cap LT
Mercari JPのモノリスサービスをKubernetesに移行した話 PHP Conference 2022 9/24
IAM Roles Anywhereのない世界とある世界(2022年のAWSアップデートを振り返ろう ~Season 4~ 発表資料)
SPAセキュリティ入門~PHP Conference Japan 2021
Open Caching Update
WebRTC SFU mediasoup sample
MySQLバックアップの基本
Dockerイメージの理解とコンテナのライフサイクル
OSS活動の活発さと評価の関係について
できる!KickstartとAnsible!
35歳でDBAになった私がデータベースを壊して学んだこと
Swagger ではない OpenAPI Specification 3.0 による API サーバー開発
InnoDBのすゝめ(仮)
さくらのVPS で IPv4 over IPv6ルータの構築
Pcapngを読んでみる
AWS Black Belt Online Seminar 2018 Amazon DynamoDB Advanced Design Pattern
pgvectorを使ってChatGPTとPostgreSQLを連携してみよう!(PostgreSQL Conference Japan 2023 発表資料)
ISPネットワーク運用で覗いてるもの
QGISプログラミング入門 FOSS4G 2013 Hokkaido
20190828 AWS Black Belt Online Seminar Amazon Aurora with PostgreSQL Compatib...
AWS re:Inforce2019 re:Cap LT
Ad

Similar to Sniffing BitTorrent DHT ~人はBTで何を落とすのか~ (20)

PDF
Try new transport protocol SRT (ver. 2)
PPT
Inside MF
PDF
20210510 software design
PDF
Using Xeon D 10GBase-T
PDF
20140802 Bluetooth を使って Universall App で大連携
PPTX
Dockerと外部ルータを連携させる仕組みを作ってみた
PDF
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)
PDF
HTTP2入門
PPTX
KubeCon EU報告(ランタイム関連,イメージ関連)
PDF
最近こんなのやってるぜ!
PPTX
OverlayFS を使って Raspberry Pi を Network Bootする
PPTX
191030 anna-with-python
PDF
Lagopusで試すL3ルーティング + α (Lagopusの設定方法いろいろ)
PDF
フラッター開発におけるシークレット情報取扱考察
PDF
LibreOfficeコミュニティに不具合修正パッチを送ってみた
PDF
CEDEC 2025 『ゲームにおけるリアルタイム通信への QUIC導入事例の紹介』
PDF
Rubyで創るOpenFlowネットワーク - LLまつり
PDF
2015 0807 ConoHa I am the bone of the OpenStack API CLI tool
PDF
Prometheus meetup tokyo#3 slide
PDF
[JPCERT/CC POC Meeting] 研究紹介 + DLLハイジャックの脆弱性
Try new transport protocol SRT (ver. 2)
Inside MF
20210510 software design
Using Xeon D 10GBase-T
20140802 Bluetooth を使って Universall App で大連携
Dockerと外部ルータを連携させる仕組みを作ってみた
Grafana LokiではじめるKubernetesロギングハンズオン(NTT Tech Conference #4 ハンズオン資料)
HTTP2入門
KubeCon EU報告(ランタイム関連,イメージ関連)
最近こんなのやってるぜ!
OverlayFS を使って Raspberry Pi を Network Bootする
191030 anna-with-python
Lagopusで試すL3ルーティング + α (Lagopusの設定方法いろいろ)
フラッター開発におけるシークレット情報取扱考察
LibreOfficeコミュニティに不具合修正パッチを送ってみた
CEDEC 2025 『ゲームにおけるリアルタイム通信への QUIC導入事例の紹介』
Rubyで創るOpenFlowネットワーク - LLまつり
2015 0807 ConoHa I am the bone of the OpenStack API CLI tool
Prometheus meetup tokyo#3 slide
[JPCERT/CC POC Meeting] 研究紹介 + DLLハイジャックの脆弱性
Ad

More from inaz2 (13)

PDF
Can We Prevent Use-after-free Attacks?
PDF
Why is Security Management So Hard?
PDF
HTTPプロクシライブラリproxy2の設計と実装
PDF
Protecting Passwords
PDF
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
PDF
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
PDF
Abusing Interrupts for Reliable Windows Kernel Exploitation (ja)
PDF
WinDbg Primer
PDF
proxy2: HTTPS pins and needles
PDF
ROP Illmatic: Exploring Universal ROP on glibc x86-64 (ja)
PDF
How to apt-get from the internal network: remote sshd with kneesocks
PDF
CRYPT+YOU, UNDERSTAND TODAY!
PDF
Making a Proxy for Fun and Profit
Can We Prevent Use-after-free Attacks?
Why is Security Management So Hard?
HTTPプロクシライブラリproxy2の設計と実装
Protecting Passwords
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
Abusing Interrupts for Reliable Windows Kernel Exploitation (ja)
WinDbg Primer
proxy2: HTTPS pins and needles
ROP Illmatic: Exploring Universal ROP on glibc x86-64 (ja)
How to apt-get from the internal network: remote sshd with kneesocks
CRYPT+YOU, UNDERSTAND TODAY!
Making a Proxy for Fun and Profit

Sniffing BitTorrent DHT ~人はBTで何を落とすのか~

  • 2.   @inaz2  Security Engineer & Python Programmer  Girls Idol Freak  http://inaz2.hatenablog.com/ About me 2
  • 4.   Peer-to-Peer File Sharing Protocol  大容量データを高速に転送することに特化  匿名性はない  代表的なBitTorrentクライアント BitTorrent 4 Most popular Popular in Asia Preinstalled in Ubuntu Java
  • 5.   ファイル  ダウンロードされるデータ(群)  .torrent  Webサーバなどを介して配布されるメタファイル  ファイルの名前・サイズやTrackerのIPアドレスなどが書かれてい る  ノード  ネットワークに接続しているBitTorrentクライアント  Peer  直接接続している(隣接している)ノード Terminology (only in this slides) 5
  • 6.  Classic BitTorrent Architecture 6 Tracker Peer (my client) Peer Peer Index server Peer 1. .torrent の ダウンロード 2. ファイルを持っている Peerの取得 3. ファイル断片を送受信 .torrent を配布 ファイルを持っている Peerの管理
  • 7.   As a Tracker (with Index Server)  Index Serverで配布しているファイルを 欲しがっているPeerのIP(+接続時刻)  As a Peer  自分がダウンロードしているファイルを 欲しがっているPeerのIP(+接続時刻)  .torrent ごとにネットワーク (swarm) が作られる  自分が知らないファイルについてはわからない。 What we can get 7
  • 8.   元々のアーキテクチャはTracker中心のHybrid P2P  Trackerに繋がらなくなったら止まる  Trackerなしでも動くようにする  Peer間でPeer情報の交換  Peer間で .torrent のリクエスト & ダウンロード  Peer間でファイルを持っているPeerの探索 Trackerless download 8
  • 9.   ハッシュテーブル  キーと値のペアの組み合わせを集めたテーブル  キー = .torrent のSHA-1ハッシュ値  値 = .torrent が指すファイルを持っているPeerの集合  ハッシュテーブルを複数ノードに分散させる  問い合わせに答えられなければ、自分の周囲のノード に問い合わせ直すように答える Distributed Hash Table (DHT) 9
  • 10.   4種類のクエリ  ping / find_node / get_peer / announce_peer  get_peer  リクエスト: .torrent のSHA-1ハッシュ値 (infohash)  レスポンス: .torrent が指すファイルを持つノード群  自分が知らない場合は、「自分が知らないこと」と自分の周囲 のノード群を答える  リクエスト側は、教えてもらったノード群に問い合わせ直す  ファイルを持っているノードが見つかるまで問い合わせ続ける BitTorrent DHT Protocol 10
  • 12.   infohash はただのSHA-1ハッシュ値  ファイルの内容を知るためには、対応する .torrent を 得る必要がある  BEP 9: Extension for Peers to Send Metadata Files  ファイルを持っているノードから .torrent を送ってもらうためのプロトコル拡張 infohash → .torrent 12
  • 14.   めんどくさい!!  Deluge BitTorrent Client  Python製BitTorrentクライアント  libtorrentライブラリを使用  GUI (GTK+)  クロスプラットフォーム (Linux, Mac OS X & Windows)  簡単に改造できる  http://deluge-torrent.org/ Develop a BitTorrent Client 14
  • 15.  Deluge is a good alternative to Transmission 15
  • 16.   https://github.com/inaz2/deluge-hack  飛んできた infohash を自動でキューに追加  .torrent が得られたらダウンロードをpause  放置するとキューがたまりまくって激重になる Fork & Hack 16
  • 17.   https://github.com/inaz2/btsniff  python-libtorrent を使ってコア部分のみ実装  One-file CLI Hack more 17
  • 18.   Ubuntu Serverのtorrentを使ってネットワークにjoin  観測期間  2013-10-04 02:18 ~ 2013-10-05 00:57 Experiments 18
  • 19.   見つかったファイルの数: 3629  内容の一部  Taylor Swift - Red (2012)  TVアニメ「進撃の巨人」OP1&OP2テーマ  月島きらり starring 久住小春(Koharu Kusumi) - バラ ライカ(Balalaika)  店長推薦作品 BT-98-不能停止的疼痛 美人妻 阪上友香  楽しい!!✌('ω'✌ )三✌('ω')✌三( ✌'ω')✌ Results 19
  • 20.   BitTorrent DHT Protocolの細かい仕組み  各クライアントにID (SHA-1値) が振られる  各 .torrent にもID (SHA-1値) が振られる  クライアントのIDに近いIDを持つ .torrent が集まるように なっている  距離は XOR によって定義: distance(A,B) = |A xor B|  幅広く .torrent を収集するには、定期的なクライアントIDの変 更 (ID hopping) が必要  多数のノードをP2Pネットワークに仕込むタイプの攻撃は、 結託攻撃 (Sybil Attack) と呼ばれる Road to Sybil Attack 20
  • 21.   BitTorrentでDHT有効 = 他人に欲しいファイルを 持っている人を知らないか問い合わせる  get_peersクエリを収集することで、他人が欲しがっ ているファイルを知ることができる  Future works  get_peersクエリ以外のトラフィックの利用  ID hoppingの実装 Recap 21
  • 22.   "Crawling BitTorrent DHTs for Fun and Profit" by Scott Wolchok (DEF CON 18)  https://www.defcon.org/images/defcon-18/dc-18- presentations/Wolchok/DEFCON-18-Wolchok-Crawling-Bittorrent-DHTS.pdf  "Defeating Vanish with Low-Cost Sybil Attacks Against Large DHTs" by Scott Wolchok et al. (NDSS 2010)  http://z.cs.utexas.edu/users/osa/unvanish/papers/vanish-broken.pdf  http://www.cs.utexas.edu/users/witchel/pubs/unvanish10ndss.pptx  "Large-scale monitoring of DHT traffic" by Ghulam Memon et al. (IPTPS 2009)  http://www.usenix.org/event/iptps09/tech/full_papers/memon/memon.pdf  "The Sybil Attack" by John R. Douceur (IPTPS 2001)  http://research.microsoft.com/apps/pubs/default.aspx?id=74220 References 22