Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DNS水責め攻撃と監視 / DNS water torture attack Monitori...
Search
kazeburo
July 12, 2023
Technology
5
4k
DNS水責め攻撃と監視 / DNS water torture attack Monitoring and SLO
mackerel Meetup #14 Tokyo - 2023/07/11
kazeburo
July 12, 2023
Tweet
Share
More Decks by kazeburo
See All by kazeburo
ガバメントクラウド開発と変化と成長する組織 / Organizational change and growth in developing a government cloud
kazeburo
4
1.3k
DBやめてみた / DNS water torture attack and countermeasures
kazeburo
13
12k
IaaSにおけるPlatform Engineeringとこれから / Platform engineering in IaaS
kazeburo
2
1.2k
高信頼IaaSを実現するDevOps / DevOps for Highly Reliable IaaS
kazeburo
1
550
権威DNSサービスへのDDoSと ハイパフォーマンスなベンチマーカ / DNS Pseudo random subdomain attack and High performance Benchmarker
kazeburo
3
5.1k
DNS権威サーバのクラウドサービス向けに行われた攻撃および対策 / DNS Pseudo-Random Subdomain Attack and mitigations
kazeburo
7
12k
sacloudns
kazeburo
2
320
「orchestratorとGTID運用を支える監視」の勉強 / Monitoring orchestrator and GTID operation
kazeburo
2
1.3k
最近の監視(仮)/Recent system monitoring with mackerel
kazeburo
3
4.7k
Other Decks in Technology
See All in Technology
組織デバイスのための効率的なアプリケーション更新戦略
kenchan0130
0
430
Amazon ECS & AWS Fargate 今昔物語 / past and present stories of Amazon ECS and AWS Fargate
iselegant
17
3k
怖くないオフライン機能開発 〜基本的な技術で実現する現場向けオフライン機能 / Developing offline functions without fear ~ Offline functions for the field realized with basic technology
kaminashi
1
150
Kubernetes Meetup Tokyo #67 - KEP-3619: Fine-grained SupplementalGroups Control / k8sjp67-kep-3619
everpeace
0
320
Vespaを利用したテクいベクトル検索
szdr
3
240
Do you know “Environment Variables” ?
akimiya
0
130
【㈱アイモバイル】エンジニア向け会社説明資料
imobile
0
480
RDS for Db2 データ移行編 - Part2:S3経由のバックアップ・リストアでデータ移行 /20241011-RDSforDb2-dojo
mayumihirano
0
120
What a Good Platform Looks Like and How to Get There @ Large Financial Organization, Oct 2024
mfpais
PRO
0
130
From LibreOffice to « La Suite » : providing civil servants with Free Software sovereign tools
bluehats
0
110
Automated Tests Now and Future @ SQiP Workshop Special Lecture 2024
teyamagu
PRO
1
290
ラブグラフ紹介資料 〜プロダクト解体新書〜 / Lovegraph Product Deck
lovegraph
0
14k
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
41
9.2k
Pencils Down: Stop Designing & Start Developing
hursman
119
11k
4 Signs Your Business is Dying
shpigford
180
21k
GraphQLの誤解/rethinking-graphql
sonatard
65
9.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
GitHub's CSS Performance
jonrohan
1030
450k
Creatively Recalculating Your Daily Design Routine
revolveconf
217
12k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
26
4.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Build The Right Thing And Hit Your Dates
maggiecrowley
32
2.3k
How To Stay Up To Date on Web Technology
chriscoyier
787
250k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
Transcript
さくらインターネット Masahiro Nagano @kazeburo DNS⽔責め攻撃と監視 mackerel Meetup #14 Tokyo -
2023/07/11
Me • ⻑野雅広 (ながのまさひろ) • @kazeburo - Twitter, Threads &
GitHub • さくらインターネット株式会社 クラウド事業本部 SRE室 室⻑ • mixi, livedoor (LINE), mercari を経て 2021年から現職 • mackerelアンバサダー
本⽇のアジェンダ • DNS⽔責め攻撃と監視 • DNSとSLO
%/4ਫΊ IUUQTKBXJLJQFEJBPSHXJLJ&&#"%&"#&%#&&'&&"&&"&
DNS⽔責め攻撃 • 2023年3⽉頃より攻撃件数が急増、社会的な影響もあり • ランダムサブドメイン攻撃(Pseudo-Random Subdomain Attack)とも • 攻撃対象のDNSのゾーンにランダムに⽣成したサブドメインを問い合わせ て、DNSの機能停⽌、機能低下を狙う攻撃
実際の攻撃の記録 07:25:11.719035 IP 209.216.160.2.50051 > 133.242.64.100.53: 43104 A? meetmodeling.example.com. (50)
07:25:11.719057 IP 205.171.30.238.44916 > 133.242.64.100.53: 64321% [1au] A? _.modeling.example.com. (71) 07:25:11.719069 IP 172.70.109.31.63292 > 133.242.64.100.53: 40380 [1au] A? osaExpe1-pLatINUM.exAmpLe.cOm. (66) 07:25:11.719071 IP 3.139.136.204.44597 > 133.242.64.100.53: 32383% [1au] A? webdirect.foster.example.com. (65) 07:25:11.719113 IP 18.188.77.103.42513 > 133.242.64.100.53: 14853 [1au] A? note-modeling.example.com. (62) 07:25:11.719132 IP 172.70.33.19.27971 > 133.242.64.100.53: 35379 [1au] A? indian-awarded.example.com. (63) 07:25:11.719147 IP 12.121.89.48.43564 > 133.242.64.100.53: 23891 A? matchfiling.example.com. (49) 07:25:11.719156 IP 74.125.181.130.64517 > 133.242.64.100.53: 25285% [1au] A? xmL.mODeLING.eXaMple.CoM. (61) 07:25:11.719166 IP 165.225.41.202.17203 > 133.242.64.100.53: 53044% [1au] A? qatawarded.example.com. (59) 07:25:11.719176 IP 96.114.53.67.20082 > 133.242.64.100.53: 41999 [1au] A? netherlands.filing.example.com. (67) 07:25:11.719190 IP 172.253.195.196.35276 > 133.242.64.100.53: 45639% [1au] A? tdd-modeling.example.com. (61) 07:25:11.719195 IP 172.253.217.12.40587 > 133.242.64.100.53: 62658% [1au] A? web.modeling.example.com. (61) 07:25:11.719197 IP 172.253.9.4.50295 > 133.242.64.100.53: 37961% [1au] A? co.awarded.example.com. (59) 07:25:11.719224 IP 172.71.29.39.30489 > 133.242.64.100.53: 2496 [1au] A? SfaaSobvioUs.ExamplE.Com. (61) 07:25:11.719235 IP 209.66.107.33.57264 > 133.242.64.100.53: 50511 [1au] A? hap.modeling.example.com. (61) 07:25:11.719275 IP 96.114.53.69.53157 > 133.242.64.100.53: 5679 [1au] A? gitcn-awarded.example.com. (62) 07:25:11.719312 IP 172.70.229.30.59530 > 133.242.64.100.53: 45890 [1au] A? ipafoster.example.com. (58) 07:25:11.719336 IP 172.217.46.78.59507 > 133.242.64.100.53: 60186% [1au] A? testcloud-modeling.example.com. (67) 07:25:11.719351 IP 69.47.193.166.52891 > 133.242.64.100.53: 238 [1au] A? bfmpassing.example.com. (59) 07:25:11.719353 IP 34.218.119.91.26001 > 133.242.64.100.53: 31511% [1au] A? signal-modeling.example.com. (64) 07:25:11.719365 IP 34.218.119.91.13381 > 133.242.64.100.53: 4210% [1au] A? pairfiling.example.com. (59) • ランダムな⽂字列、単語の組み合わせ • ⼤⽂字・⼩⽂字まざり(Google Public DNS仕様) • ラベル数が増えることもあり
攻撃⽅法のイメージ bot化した サーバ群 攻撃者(?) オープンリゾルバ パブリックDNS 権威DNS サーバ ʮय़ʹى͖ͨ%/4ਫΊឿᓾരܸͷ؍هʯΛࢀߟ IUUQXXXFPOUBQDPNNJTDJPUTMJEFQBQFSIUNM
攻撃のアクセス元 • オープンリゾルバ、Public DNS • 仕様に準じたクエリなのでネットワーク機器でのフィルタリングが不可能 • クエリ発⾏数の上位はGoogleやCloud fl areのIPアドレスが多い
• ⼀般のユーザも利⽤している • rate limitやクエリのblockができない • ここがDNS⽔責め攻撃の対策の難しいところ
さくらのクラウドでの攻撃事例 • 2022年8⽉にサービスに影響を与えるものとして発⽣ • 以後、現在に⾄るまで断続的に攻撃が継続 • 最⼤4000万クエリ/分 (通常5000クエリ/分) • 800万クエリ/分が数時間〜3⽇間継続ことも
• (Route53のコストだと100万円になる
⽔責め攻撃への対策 • スケールアップ • dnsdist (DNS⽤proxy)でのホワイトリスト • 頻繁に攻撃のあるゾーンに対してDNSサーバの前段でフィルタリング • DNSサーバ(PowerDNS)のバックエンドの切り替え
• RDBMSを利⽤したバックエンドからインメモリでの処理に • RDBMSによる管理性が失われるので、ゾーンデータを配布するミドルウェアを新たに書き起 こした • 可視化・モニタリング
Mackerel plugins • mackerel-plugin-pdns • https://github.com/kazeburo/mackerel-plugin-pdns • hanazuki/mackerel-plugin-pdns のGo⾔語版 •
mackerel-plugin-dnsdist • https://github.com/kazeburo/mackerel-plugin-dnsdist
None
⽔責め検知とアラート • dnsdistでのクエリ数が⼀定でアラート • 対策が進むにつれて閾値をだいぶあげた • サービスに影響がなければアラートは 抑えるのが⼤事
グラフボードでざっくり確認 • 週に数回グラフボードをみて、気になればログで攻撃対象ゾーンを確認 • 新たなゾーンへの攻撃であれば対策が必要か検討する
mackerel-plugin-maxcpu • バックグラウンドで毎秒CPU使⽤率を計 測し、その最⼤・平均・パーセンタイル 値をメトリクスとして記録 • https://github.com/kazeburo/ mackerel-plugin-maxcpu • 攻撃による瞬間的な負荷を把握するため
DNSとSLO
DNSの役割 • 名前と対象(IPアドレスなど)を、あらかじめ対応つけておく • 名前と対象の対応付けを調べて、問い合わせ元に返す IUUQTXXXOJDBEKQKBNBUFSJBMTJXPOEFNBOEEOT ࣌ؒͰֶͼ͢%/4ͷΈͷΩϗϯ
DNSの役割 • 名前と対象(IPアドレスなど)を、あらかじめ対応つけておく • 権威DNSサーバ • 名前と対象の対応付けを調べて、問い合わせ元に返す • フルリゾルバ、DNSキャッシュサーバ IUUQTXXXOJDBEKQKBNBUFSJBMTJXPOEFNBOEEOT
࣌ؒͰֶͼ͢%/4ͷΈͷΩϗϯ
DNSキャッシュサーバ • サービスの付随要素として提供 • 例えばISPの提供するDNSキャッシュサーバ • 共有型での提供(社内でも利⽤) • SLA?
DNSキャッシュサーバ • 重要な基盤技術のひとつ • しかし、障害が起きるまで意識されない • SLOの公開によって、社内外で名前解決の可⽤性を共有モデルとしていくこ とはできないか • DNSサーバの管理チームにSLOを提案
DNSのSLIを考える • ユーザ視点で考える • 弊社のDNSキャッシュサーバのユーザとは • クラウド/VPSの仮想サーバ、MaaSの物理サーバ、レンタルサーバのホス トなど各種基盤。Linux や FreeBSD
が多い • クライアントを知ることが⼤事、また、サービス本来の利⽤者・エンド ユーザも考慮
resolv.confとDNS名前解決 • resolv.conf が右のように書かれていた場合 1. 198.51.100.3 がタイムアウト5秒 2. 198.51.100.4 が
5秒 × 2 ÷ サーバ台数 (⼩数点切り捨て)のタイムアウト=5 秒 3. これを2回繰り返して、合計20秒間名前解決を⾏う • 正直⻑い • options timeout:Nや試⾏回数を増やすoptions attempts:Mは利⽤者側にて対応をが必要 • (systemd-resolvedになると別) nameserver 198.51.100.3 nameserver 198.51.100.4 nameserver 198.51.100.3 nameserver 198.51.100.4 options timeout:1 rotate
DNSキャッシュサーバのSLI(検討) • 2台(2 IP)で1組 • resolv.confのデフォルト状態 • 5秒、5秒 × 2回の20秒
• resolv.confでtimeoutを1秒、attempts:3を想定し、5秒以内にレスポンス • 1秒、1秒 × 3回
Mackerel Plugin • mackerel-plugin-resolver-synthetic • https://github.com/kazeburo/mackerel-plugin-resolver-synthetic • resolv.confの設定と動作を真似して名前解決ができるかをメトリクス化 • さくらのクラウドの仮想サーバから、提供しているDNSキャッシュサーバを
モニタリング
# one of them is alive % ./mackerel-plugin-resolver-synthetic --timeout 5s
-H 198.51.100.1 -H 198.51.100.2 -H 8.8.8.8 -Q example.com 2023/06/27 21:20:08 failed to resolv on 198.51.100.1 with timeout 5.000000s: read udp 192.168.68.110:58507- >198.51.100.1:53: i/o timeout 2023/06/27 21:20:11 failed to resolv on 198.51.100.1 with timeout 3.000000s: read udp 192.168.68.110:49304- >198.51.100.1:53: i/o timeout resolver-synthetic.service.available 100 1687868403 resolver-synthetic.rtt.milliseconds 8023 1687868403 # all dead % ./mackerel-plugin-resolver-synthetic --timeout 5s -H 198.51.100.1 -H 198.51.100.2 -Q example.com 2023/06/27 21:21:56 failed to resolv on 198.51.100.1 with timeout 5.000000s: read udp 192.168.68.110:51016- >198.51.100.1:53: i/o timeout 2023/06/27 21:22:01 failed to resolv on 198.51.100.2 with timeout 5.000000s: read udp 192.168.68.110:59771- >198.51.100.2:53: i/o timeout 2023/06/27 21:22:06 failed to resolv on 198.51.100.1 with timeout 5.000000s: read udp 192.168.68.110:53296- >198.51.100.1:53: i/o timeout 2023/06/27 21:22:11 failed to resolv on 198.51.100.2 with timeout 5.000000s: read udp 192.168.68.110:50395- >198.51.100.2:53: i/o timeout resolver-synthetic.service.available 0 1687868511 resolver-synthetic.rtt.milliseconds 20002 1687868511
SLOダッシュボード • 値の取得開始から2週間 • 今後、SLOの数値のチーム内での決 定、社内への告知、社外への公開 • 可⽤性向上のヒント、事例も合わ せて公開する必要
まとめ • 権威DNSサーバへの⽔責め攻撃と監視 • mackerel-plugin-{pdns,dnsdist,maxcpu} • DNSキャッシュサーバの監視とSLO • mackerel-plugin-resolver-synthetic
SAKURA internet ࣾձΛࢧ͑Δ ύϒϦοΫΫϥυɾେنܭࢉࢿݯΠϯϑϥΛ Ұॹʹ࡞Γ·ͤΜ͔ʁ ソフトウェア開発、 インフラ基盤から フロントエンドまで
採⽤強化中! さくらインターネットではエン ジ ニア採⽤を強化しています さくらインターネットは新たなアイ デ アの創出に強い熱意と情熱を持って挑戦するお客様を は じ め、私たちとつな が りのあるす べ ての⼈たちのために、未来のある べ き姿を想い描きな が ら ―「やりたいこと」を「 で きる」に変える ― あらゆるア プ ローチを “インターネッ ト”を通 じ て提供します。 詳しくはWebサイトにて、カジュアル⾯談もやってます 👉 www.sakura.ad.jp/lp/22engineer/